Merge pull request #678 from kaizhang/master
[MACS.git] / test / pyprofile_stat
blob3f4a6f3aaf9bdaf931665909fb92373c2caf628c
1 #!/usr/bin/env python
2 # Time-stamp: <2019-10-30 16:07:15 taoliu>
4 import sys
5 import pstats
6 # ------------------------------------
7 # Main function
8 # ------------------------------------
9 def main():
10 if len(sys.argv) < 3:
11 sys.stderr.write("need 2 paras: %s <prof file> <time|calls|cumulative|...>\n" % sys.argv[0])
12 sys.exit(1)
14 p = pstats.Stats(sys.argv[1])
15 sort_term = sys.argv[2]
17 p.strip_dirs().sort_stats(sort_term).print_stats(30)
20 if __name__ == '__main__':
21 main()