Fix silly error from last commit

This commit is contained in:
Damien Churchill 2010-02-26 14:49:19 +00:00
parent b8521e7e28
commit 0ffca9a1f6
1 changed files with 10 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class Web(_UI):
help="Sets the port to be used for the webserver", help="Sets the port to be used for the webserver",
action="store", default=None) action="store", default=None)
group.add_option("--profile", dest="profile", group.add_option("--profile", dest="profile",
help="Profile the web server code" help="Profile the web server code",
action="store_true", default=False) action="store_true", default=False)
try: try:
import OpenSSL import OpenSSL
@ -118,6 +118,15 @@ class Web(_UI):
self.server.install_signal_handlers() self.server.install_signal_handlers()
self.server.start() self.server.start()
if self.options.profile:
hsp.stop()
hsp.close()
import hotshot.stats
stats = hotshot.stats.load(deluge.configmanager.get_config_dir("deluge-web.profile"))
stats.strip_dirs()
stats.sort_stats("time", "calls")
stats.print_stats(400)
def start(): def start():
web = Web() web = Web()
web.start() web.start()