Make it easy to turn on profiling of pybindgen
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sat, 17 Jan 2009 16:59:45 +0000
changeset 4105ce8be572c4d4
parent 4104 19147674758a
child 4106 625ff60e1865
Make it easy to turn on profiling of pybindgen
bindings/python/ns3modulegen.py
     1.1 --- a/bindings/python/ns3modulegen.py	Sat Jan 17 16:58:42 2009 +0000
     1.2 +++ b/bindings/python/ns3modulegen.py	Sat Jan 17 16:59:45 2009 +0000
     1.3 @@ -146,5 +146,14 @@
     1.4      out.close()
     1.5  
     1.6  if __name__ == '__main__':
     1.7 -    main()
     1.8 +    if 0:
     1.9 +        try:
    1.10 +            import cProfile as profile
    1.11 +        except ImportError:
    1.12 +            main()
    1.13 +        else:
    1.14 +            print >> sys.stderr, "** running under profiler"
    1.15 +            profile.run('main()', 'ns3modulegen.pstat')
    1.16 +    else:
    1.17 +        main()
    1.18