profiling code

Andrea Crotti andrea.crotti.0 at gmail.com
Tue Dec 20 05:40:08 EST 2011


I would like to automate some kind of performance profiling, to see if
the application (and possibly pieces of it) becomes slower/faster and why.

So I did something like this, where the statement passed also called 
parse_arguments,
which is nice because I can run the other script with the normal options.
But how do I pass arguments to the performance analyser script then?

def profile_startup():
     # just run something from inside here
     code = 
compile('Develer(parse_arguments()).full_run(test_only=True)', 
'dev_main', 'exec')
     results = 'profiled.prof'
     runctx(code, globals(), {}, filename=results)




More information about the Python-list mailing list