scripts: Add --profile-dot to run_profile.
This commit is contained in:
parent
43898ebb71
commit
ee0eabc202
@ -39,18 +39,29 @@ if '--profile-keep' in sys.argv:
|
|||||||
profilefile = os.path.join(os.getcwd(), 'profile')
|
profilefile = os.path.join(os.getcwd(), 'profile')
|
||||||
else:
|
else:
|
||||||
profilefile = os.path.join(tempdir, 'profile')
|
profilefile = os.path.join(tempdir, 'profile')
|
||||||
|
|
||||||
if '--profile-noconv' in sys.argv:
|
if '--profile-noconv' in sys.argv:
|
||||||
sys.argv.remove('--profile-noconv')
|
sys.argv.remove('--profile-noconv')
|
||||||
noconv = True
|
noconv = True
|
||||||
else:
|
else:
|
||||||
noconv = False
|
noconv = False
|
||||||
|
|
||||||
|
if '--profile-dot' in sys.argv:
|
||||||
|
sys.argv.remove('--profile-dot')
|
||||||
|
dot = True
|
||||||
|
else:
|
||||||
|
dot = False
|
||||||
|
|
||||||
callgraphfile = os.path.join(tempdir, 'callgraph')
|
callgraphfile = os.path.join(tempdir, 'callgraph')
|
||||||
profiler = cProfile.Profile()
|
profiler = cProfile.Profile()
|
||||||
profiler.run('qutebrowser.qutebrowser.main()')
|
profiler.run('qutebrowser.qutebrowser.main()')
|
||||||
profiler.dump_stats(profilefile)
|
profiler.dump_stats(profilefile)
|
||||||
|
|
||||||
if not noconv:
|
if not noconv:
|
||||||
subprocess.call(['pyprof2calltree', '-k', '-i', profilefile,
|
if dot:
|
||||||
'-o', callgraphfile])
|
subprocess.call('gprof2dot -f pstats profile | dot -Tpng | feh -F -',
|
||||||
|
shell=True) # yep, shell=True. I know what I'm doing.
|
||||||
|
else:
|
||||||
|
subprocess.call(['pyprof2calltree', '-k', '-i', profilefile,
|
||||||
|
'-o', callgraphfile])
|
||||||
shutil.rmtree(tempdir)
|
shutil.rmtree(tempdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user