Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to speed things up implementing some of the functions in C. So I need profiling.
I first tried to use the default python profiler, but profiling my application multiplies the execution time by a factor between 10 and 100 ! So I decided to give a try to hotspot. I just followed the example of the python library reference, but I have some strange results concerning cpu time. My profiling script is something like the following: def run_foo(): print time.clock() function_to_profile() print time.clock() prof = hotshot.Profile("essai.prof") benchtime= prof.runcall(run_foo) prof.close() stats = hotshot.stats.load("essai.prof") stats.strip_dirs() stats.sort_stats('time', 'calls') stats.print_stats(20) The goal is to profile the function function_to_profile(). Running this script gives me a CPU executime time of around 2 seconds, whereas the difference between the two clock calls is around 10 seconds ! And I don't run any other cpu consuming tasks at the same time, so this cannot come from other running processes. Is there something perticular about hotspot timing I should know ? I am not sure how I can get more accurate results with hotspot. I would appreciate any help, Thanks -- http://mail.python.org/mailman/listinfo/python-list