Advertisement
DigitalMag

Perfomance reading

Jun 26th, 2020
1,657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import pstats
  2. import sys
  3.  
  4. def main():
  5.  
  6.     if len(sys.argv) > 1: file = sys.argv[1]
  7.     else:
  8.         if sys.version_info.major==3:
  9.             file = input("Enter pathname:")
  10.         else:
  11.             file = raw_input("Enter pathname:")
  12.  
  13.         if file == "": file = r"C:\Users\User\Desktop\main.prof"
  14.  
  15.     p = pstats.Stats(file)
  16.     p.strip_dirs().sort_stats(-1).print_stats()
  17.  
  18.  
  19. if __name__ == '__main__':
  20.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement