I need to get the cumulative process time for a function that returns arguments and I'm having trouble doing so programmatically. After I get the process time, I want to log it to a file, along with other information. My problem is that I can't figure out how to do this programmatically in a good way. I see that the cProfile module has the method "getstats" which returns a list with the information I need but I don't see how I can access it.
Here is some pseudocode showing what I'm hoping to do: # Get a cProfile object with the profile information of my function. # This syntax doesn't work and this is the first part I need help with. p = cProfile.run('(a,b,c)=myFunc(x,y,z)') # Get the process time. The timeit.clock() function would give me process time # but it doesn't allow me to access the return arguments afterward so I can't use it. # The syntax of the next line doesn't work but this is an example of what I hope to do. top_entry = p.getstats()[0] cum_time = top_entry[3] # totaltime # Now, log all this info to a CSV file. (No help needed here.) csv_file.writerow([a,b,c,x,y,z,cum_time]) Once this works, I will wrap the above code in a loop which iterates through thousands of combinations of the parameters x,y,z. Thanks in advance for your help. Reg -- http://mail.python.org/mailman/listinfo/python-list