Julien Fiore wrote: > Thanks Caleb for the advice, > > I profiled my code with the following lines: > > import profile, pstats > > profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log') > p = pstats.Stats('profile.log') > p.sort_stats('time') > p.print_stats(10) > > The outputs tells me that the openness() function takes most of the > time. This is not very useful for me, as openness() contains most of my > code. How to know which instructions take most time in the openness > function ? Do I have to separate the code into smaller functions ?
Yes. The profiler collects statistics for functions, not for individual lines of code. Kent -- http://mail.python.org/mailman/listinfo/python-list