> I'm interested in some dynamic execution counts (sys.getdxp). I have a
> Python executable built with that. The recommended way to capture
> execution profiles is to run the desired program with -i and use that
> to grab and write the opcode profile.
> That would be quite cumbersome when using pyperformance since each
> benchmark is run as a separate Python process and there are so many
> benchmarks.
I bit the bullet and set PYINTROSPECT=true, then pasted this little snippet
of code at each introspection prompt:
import pickle
import sys
COUNTFILE = "/tmp/dxp-profile.pck"
try:
counts = pickle.load(open(COUNTFILE, "rb"))
except IOError:
counts = sys.getdxp()
else:
new_counts = sys.getdxp()
counts = [sum(pair) for pair in zip(counts, new_counts)]
pickle.dump(counts, open(COUNTFILE, "wb"))
raise SystemExit
then went about my business, typing Shift-Ctrl-v whenever I noticed the
REPL prompt. Since I shouldn't have to do this on a regular basis, that's
good enough for now. Still seems like it might be nice to be able to
execute a snippet of code automagically after the end of each benchmark,
perhaps by taking advantage of Python's -i flag.
Skip
_______________________________________________
Speed mailing list -- [email protected]
To unsubscribe send an email to [email protected]