mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 17:36:13 +01:00
add osc_hotshot.py, a wrapper script for profiling osc.py
This commit is contained in:
parent
37001eef4b
commit
5ea51d3918
31
osc_hotshot.py
Executable file
31
osc_hotshot.py
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import hotshot, hotshot.stats
|
||||
import tempfile
|
||||
import os, sys
|
||||
import osc
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
(o, filename) = tempfile.mkstemp(prefix = 'osc_profiledata_', dir = '/dev/shm')
|
||||
del o
|
||||
|
||||
try:
|
||||
|
||||
prof = hotshot.Profile(filename)
|
||||
|
||||
osc.init_basicauth()
|
||||
prof.runcall(osc.main)
|
||||
print 'run complete. analyzing.'
|
||||
prof.close()
|
||||
|
||||
stats = hotshot.stats.load(filename)
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time', 'calls')
|
||||
stats.print_stats(20)
|
||||
|
||||
del stats
|
||||
|
||||
finally:
|
||||
os.unlink(filename)
|
Loading…
Reference in New Issue
Block a user