Guest User

Untitled

a guest
May 27th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import time
  2. import cProfile, pstats, StringIO
  3. import os
  4. import shutil
  5. import tempfile
  6.  
  7. start_time = time.time()
  8.  
  9. pr = cProfile.Profile()
  10. pr.enable()
  11. # Insert function you want called here.
  12. pr.disable()
  13. sortby = 'cumulative'
  14. fd, tmpfile = tempfile.mkstemp()
  15. os.close(fd)
  16. pr.dump_stats(tmpfile)
  17. shutil.move(tmpfile, '/usr/local/smartfile/www/CPROFILE')
  18.  
  19. print("Function took {} seconds.".format(time.time() - start_time))
Add Comment
Please, Sign In to add comment