[cocci] Improve rule identification for SmPL script profiling
Markus Elfring <[email protected]> Thu, 23 Apr 2026 15:40:09 +0200
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
Hello,
The program parameter “--profile” is generally supported.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/03a1af0a3316ddfc2b54d827b8b9627a841c85c9/docs/manual/spatch_options.tex#L762-763
I occasionally appreciate to take another look also at software run times
for selected SmPL rules.
I would find an adjusted output format clearer then.
diff --git a/cocci.ml b/cocci.ml
index 64503ee9..3a1d35e3 100644
--- a/cocci.ml
+++ b/cocci.ml
@@ -1563,7 +1563,7 @@ let printtime str = Printf.printf "%s: %f\n" str (Unix.gettimeofday ())
let rec apply_cocci_rule r rules_that_have_ever_matched parse_strings es
(ccs:file_info list ref) =
- Common.profile_code r.rule_info.rulename (fun () ->
+ Common.profile_code ("Rule " ^ r.rule_info.rulename) (fun () ->
show_or_not_rule_name r.ast_rule r.rule_info.ruleid;
show_or_not_ctl_text r.ctl r.metavars r.ast_rule r.rule_info.ruleid;
Can further users of the Coccinelle software benefit from similar code refinements?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/03a1af0a3316ddfc2b54d827b8b9627a841c85c9/cocci.ml#L1586-1590
Regards,
Markus