mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 18:06:13 +01:00
d6af7d2f85
descriptor, instead of opening it again
35 lines
697 B
Python
Executable File
35 lines
697 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import hotshot, hotshot.stats
|
|
import tempfile
|
|
import os, sys
|
|
|
|
from osc import commandline
|
|
from osc.core import init_basicauth
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
(fd, filename) = tempfile.mkstemp(prefix = 'osc_profiledata_', dir = '/dev/shm')
|
|
f = os.fdopen(fd)
|
|
|
|
try:
|
|
|
|
prof = hotshot.Profile(filename)
|
|
|
|
init_basicauth()
|
|
prof.runcall(commandline.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:
|
|
f.close()
|
|
os.unlink(filename)
|