/usr/share/pyshared/swap/my_profiler.py is in python-swap 1.2.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """Profile.py
This will try to profile cwm.
"""
import hotshot, hotshot.stats
from cwm import doCommand
import os, sys
def runProfile(logfile):
profiler = hotshot.Profile(logfile)
saveout = sys.stdout
fsock = open('/dev/null', 'w')
sys.stdout = fsock
profiler.runcall(doCommand)
sys.stdout = saveout
fsock.close()
profiler.close()
stats = hotshot.stats.load(logfile)
stats.strip_dirs()
stats.sort_stats('cumulative', 'time', 'calls')
stats.print_stats(60)
if __name__ == '__main__':
try:
os.remove('/tmp/profile.log')
except OSError:
pass
runProfile('/tmp/profile.log')
|