diff options
author | drebs <drebs@leap.se> | 2014-09-08 17:12:45 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2014-09-10 10:13:58 -0300 |
commit | 2f1ee76a7169abc100efdf706f12a0abf6032f04 (patch) | |
tree | 2b4413b685a06abbf939cb270e5f0d3e7c29e154 /scripts/profiling/storage/profile-format.py | |
parent | 3ab68fd26bae17c82dbbb0c0171933b8a7540c73 (diff) |
Add benchmarking scripts.
Diffstat (limited to 'scripts/profiling/storage/profile-format.py')
-rw-r--r-- | scripts/profiling/storage/profile-format.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/profiling/storage/profile-format.py b/scripts/profiling/storage/profile-format.py new file mode 100644 index 00000000..262a52ab --- /dev/null +++ b/scripts/profiling/storage/profile-format.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import argparse +import pstats + + +def parse_args(): + # parse command line + parser = argparse.ArgumentParser() + parser.add_argument( + '-f', dest='statsfiles', action='append', required=True, + help='a stats file') + args = parser.parse_args() + return args.statsfiles + + +def format_stats(statsfiles): + for f in statsfiles: + ps = pstats.Stats(f) + ps.strip_dirs() + ps.sort_stats('time') + ps.print_stats() + ps.sort_stats('cumulative') + ps.print_stats() + + +if __name__ == '__main__': + statsfiles = parse_args() + format_stats(statsfiles) |