2016-04-07 15:03:22 +02:00
|
|
|
#!/usr/bin/env python
|
2015-11-01 17:11:06 +01:00
|
|
|
from __future__ import print_function
|
2013-07-02 17:30:04 +02:00
|
|
|
import sys
|
|
|
|
import pstats
|
|
|
|
|
|
|
|
'''
|
|
|
|
This is a helper script to make it easy to show profile
|
|
|
|
results after using a Python decorator. It's meant to be
|
|
|
|
a simple example that you can hack on, or better yet, you
|
|
|
|
can find more advanced tools for showing profiler results.
|
|
|
|
'''
|
|
|
|
|
|
|
|
try:
|
|
|
|
fn = sys.argv[1]
|
|
|
|
except:
|
2015-11-01 17:11:06 +01:00
|
|
|
print('''
|
2013-07-02 17:30:04 +02:00
|
|
|
Please supply a filename. (If you use the profiled decorator,
|
|
|
|
the file will have a suffix of ".profile".)
|
2015-11-01 17:11:06 +01:00
|
|
|
''')
|
2013-07-02 17:30:04 +02:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
p = pstats.Stats(fn)
|
|
|
|
p.strip_dirs().sort_stats('cumulative').print_stats(25)
|
|
|
|
p.strip_dirs().sort_stats('time').print_stats(25)
|