So, remember all that time I spent working on something with timeit?
I think that might have paid off.
from pygos.clocker import Clocker
frame=list(placeholder) #'frame' and 'placeholder' start as copies of each other. This changes, however.
for item1 in placeholder:
for item2 in next_frame:
Using inspect, it figures out what everything is and from whence it is imported. Just throw it in "fetch" and it'll track down the source and make sure it's imported into the setup script.
Clocker.fetch-A list of functions, classes, or objects to track down from whatever modules they were in in the current session. On Clocker.make_script(), tracks them down and adds a relevant import statement to the setup script.
Clocker.setup-A list of variables to be defined in the setup script. Basically, for each key, creates a line "key=value". The value CAN be set to a normal value instead of a string containing it, but this only works in cases where __repr__ is a valid constructor (lists,dictionaries,and numbers, but not normal strings (they must be nested within additional '')). For best use, have your setup values all be strings.
Clocker.runcount- Pretty self-explanatory, just the number of times for timeit to run.
Clocker.make_script()-Exposed so that you can check and see that the script is there and working correctly. This is called automatically on Clocker.run().
Clocker.run()-Basically just times setup script and then gets results for all tests, runcount times, through timeit.