summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-02 12:13:05 +0000
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 18:16:21 -0700
commit414a0d9d48df6b840aee9337255219e0d184e829 (patch)
tree176ddeccd452431ff4a03a9fbd263d97ccb2eace /lib
parent7330a6c8f83b6340041d7dcbebfaa51977d5495f (diff)
backports: add Coccinelle SmPL profiling support to gentree.py
This adds support to let you pass --profile when running Coccinelle. This will skip all patches, rewriting Makefiles, Kconfigs, etc, and it will also keep a copy of the original src directory prior to applying the spatch. You pass the spatch file as an argument when using this. Screenshot of relevant output on 11-dev-pm-ops.cocci: $ time ./gentree.py --clean --verbose --profile-cocci 11-dev-pm-ops.cocci \ /home/mcgrof/linux-next/ \ /home/mcgrof/build/backports-20140311 Copy original source files ... Apply patches ... Profiling Coccinelle SmPL patch: 11-dev-pm-ops.cocci Applying SmPL patch collateral-evolutions/network/11-dev-pm-ops.cocci > init_defs_builtins: /usr/local/share/coccinelle/standard.h > warning: line 15: should pci be a metavariable? > (ONCE) Expected tokens pm pci_driver driver pci SIMPLE_DEV_PM_OPS > MODULE_DEVICE_TABLE > Skipping:./net/mac802154/ieee802154_dev.c > Skipping:./net/mac802154/mac_cmd.c > Skipping:./net/mac802154/mib.c > Skipping:./net/mac802154/monitor.c > Skipping:./net/mac802154/rx.c > Skipping:./net/mac802154/tx.c > Skipping:./net/mac802154/wpan.c > starting: Common.group_assoc_bykey_eff > ending: Common.group_assoc_bykey_eff, 0.000114s > --------------------- > profiling result > --------------------- > Main total : 0.584 sec 1 count > parse cocci : 0.422 sec 1 count > pre_engine : 0.422 sec 1 count > Main.infiles computation : 0.156 sec 1 count > HACK : 0.069 sec 1 count > C parsing.tokens : 0.043 sec 1 count > C parsing.fix_define : 0.022 sec 1 count > get_glimpse_constants : 0.021 sec 1 count > C parsing.lex_ident : 0.006 sec 673 count > Common.full_charpos_to_pos_large : 0.006 sec 1 count > Main.outfiles computation : 0.004 sec 1 count > worth_trying : 0.004 sec 7 count > Common.full_charpos_to_pos : 0.003 sec 2 count > Common.=~ : 0.000 sec 4 count > check_duplicate : 0.000 sec 1 count > Main.result analysis : 0.000 sec 1 count > Common.group_assoc_bykey_eff : 0.000 sec 1 count > asttoctl2 : 0.000 sec 1 count > post_engine : 0.000 sec 1 count > show_xxx : 0.000 sec 2 count This goes on... and a page per thread spawned and the results will be specific to the files tha the thread worked on. On the above results we can see Coccinelle spent little to no time working on the above files as it determined it had nothing to do there. On big iron backports server: real 0m31.226s user 7m25.712s sys 0m34.492s Cc: Peter Senna <peter.senna@gmail.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Gilles Muller <Gilles.Muller@lip6.fr> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/bpcoccinelle.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bpcoccinelle.py b/lib/bpcoccinelle.py
index 77e9d6d7..37307d24 100644
--- a/lib/bpcoccinelle.py
+++ b/lib/bpcoccinelle.py
@@ -52,7 +52,8 @@ def spatch(cocci_file, outdir,
outfile.close()
ret_q.put((sprocess.returncode, fn))
-def threaded_spatch(cocci_file, outdir, logwrite, print_name, test_cocci):
+def threaded_spatch(cocci_file, outdir, logwrite, print_name,
+ test_cocci, extra_args=[]):
num_cpus = cpu_count()
threads = num_cpus * 3
if test_cocci:
@@ -64,7 +65,8 @@ def threaded_spatch(cocci_file, outdir, logwrite, print_name, test_cocci):
for num in range(threads):
p = Process(target=spatch, args=(cocci_file, outdir,
- threads, num, t, ret_q))
+ threads, num, t, ret_q,
+ extra_args))
jobs.append(p)
for p in jobs:
p.start()