home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / python2.4 / site-packages / AppInstall / prof.py < prev    next >
Encoding:
Python Source  |  2006-08-28  |  911 b   |  35 lines

  1. #!/usr/bin/env python
  2.  
  3. from AppInstall import *
  4. from Menu import *
  5.  
  6. import hotshot
  7. import hotshot.stats
  8.  
  9.  
  10. if __name__ == "__main__":
  11.     datadir = "/usr/share/gnome-app-install"
  12.     desktopdir = "/usr/share/app-install"
  13.  
  14.     name = "gai.prof"
  15.     prof = hotshot.Profile(name)
  16.     if sys.argv[1] == "-m":
  17.         # menu
  18.         cache = apt.Cache()
  19.         treeview = gtk.TreeView()
  20.         prof.runcall(ApplicationMenu, desktopdir, datadir, cache, treeview, treeview, apt.progress.OpProgress())
  21.         prof.close()
  22.     elif sys.argv[1] == "-a":
  23.         # app
  24.         cmd = "app = AppInstall(datadir, desktopdir, sys.argv)"
  25.         prof.runctx(cmd, globals(), locals())
  26.         prof.close()
  27.     elif sys.argv[1] == "-d":
  28.     # display results
  29.         stat = hotshot.stats.load(name)
  30.     stat.strip_dirs()
  31.     stat.sort_stats('time', 'calls')
  32.         stat.print_stats(20)
  33.         stat.print_callers(20)
  34.         stat.print_callees(20)
  35.