Skip to content

Instantly share code, notes, and snippets.

@lambacck
Created August 16, 2011 20:19
Show Gist options
  • Save lambacck/1150065 to your computer and use it in GitHub Desktop.
Save lambacck/1150065 to your computer and use it in GitHub Desktop.
Don't need to call the run method
from cProfile import Profile
profiler = Profile()
def write_chains():
chain_count = 0
for chain in chains:
chain_count += 1
print chain_count
if chain_count == 2305838:
profiler.enable()
try:
write_chains()
except KeyboardInterrupt:
profiler.dump_stats('prof_output2')
@lambacck
Copy link
Author

Of course I think this excludes write_chains from the call tree collected from cProfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment