Files
zulip/tools/show-profile-results
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

24 lines
616 B
Python
Executable File

#!/usr/bin/env python3
import pstats
import sys
'''
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 IndexError:
print('''
Please supply a filename. (If you use the profiled decorator,
the file will have a suffix of ".profile".)
''')
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)