From 14eb2b598fc5c2f70f3f4692dc58f0206b07d728 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Tue, 9 Aug 2011 21:32:19 -0400 Subject: Automatically detect kernprof and profile main() in sim.py. Also synchronize CUDA calls. --- sim.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sim.py') diff --git a/sim.py b/sim.py index 0d775f4..34477f9 100755 --- a/sim.py +++ b/sim.py @@ -75,7 +75,13 @@ def write_event(T, ev, event_id, hits, photon_start=None, photon_stop=None): root.fill_hits(ev, len(hits['t']), hits['t'], hits['q'], hits['history']) T.Fill() -#@profile +# Allow profile decorator to exist, but do nothing if not running under kernprof +try: + profile = profile +except NameError: + profile = lambda x: x + +@profile def main(): parser = optparse.OptionParser('%prog') parser.add_option('-b', type='int', dest='nbits', default=10) -- cgit