home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / pyshared / AppInstall / prof.py < prev    next >
Encoding:
Python Source  |  2009-03-31  |  888 b   |  33 lines

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