From 8bd42a0693d04b21f2216f65022080d5f64f9c2d Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sat, 17 Jan 2009 16:59:45 +0000 Subject: [PATCH] Make it easy to turn on profiling of pybindgen --- bindings/python/ns3modulegen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bindings/python/ns3modulegen.py b/bindings/python/ns3modulegen.py index 21f9e72d9..a54fb5768 100755 --- a/bindings/python/ns3modulegen.py +++ b/bindings/python/ns3modulegen.py @@ -146,5 +146,14 @@ def main(): out.close() if __name__ == '__main__': - main() + if 0: + try: + import cProfile as profile + except ImportError: + main() + else: + print >> sys.stderr, "** running under profiler" + profile.run('main()', 'ns3modulegen.pstat') + else: + main()