Skip to content

Instantly share code, notes, and snippets.

@mkorpela
Created December 3, 2015 16:09
Show Gist options
  • Save mkorpela/0e76c48eb6453dc21712 to your computer and use it in GitHub Desktop.
Save mkorpela/0e76c48eb6453dc21712 to your computer and use it in GitHub Desktop.
import cProfile
import pstats
from pabot.pabot import main
import os, sys
import tempfile
profile_results = tempfile.mktemp(suffix='.out', prefix='pybot-profile', dir='.')
cProfile.run('main(sys.argv[1:])', profile_results)
stats = pstats.Stats(profile_results)
stats.sort_stats('cumulative').print_stats(50)
os.remove(profile_results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment