Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import cProfile, pstats, StringIO
- import os
- import shutil
- import tempfile
- start_time = time.time()
- pr = cProfile.Profile()
- pr.enable()
- # Insert function you want called here.
- pr.disable()
- sortby = 'cumulative'
- fd, tmpfile = tempfile.mkstemp()
- os.close(fd)
- pr.dump_stats(tmpfile)
- shutil.move(tmpfile, '/usr/local/smartfile/www/CPROFILE')
- print("Function took {} seconds.".format(time.time() - start_time))
Add Comment
Please, Sign In to add comment