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",
action="store", default=None)
group.add_option("--profile", dest="profile",
help="Profile the web server code"
help="Profile the web server code",
action="store_true", default=False)
try:
import OpenSSL
@ -118,6 +118,15 @@ class Web(_UI):
self.server.install_signal_handlers()
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():
web = Web()
web.start()