include the ability to profile the web server, code lifted straight from the daemon

This commit is contained in:
Damien Churchill 2010-02-26 14:25:17 +00:00
parent 50ae65b58a
commit b8521e7e28

View File

@ -59,6 +59,9 @@ class Web(_UI):
group.add_option("-p", "--port", dest="port", type="int",
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"
action="store_true", default=False)
try:
import OpenSSL
except:
@ -107,6 +110,11 @@ class Web(_UI):
if self.options.ssl:
self.server.https = self.options.ssl
if self.options.profile:
import hotshot
hsp = hotshot.Profile(deluge.configmanager.get_config_dir("deluge-web.profile"))
hsp.start()
self.server.install_signal_handlers()
self.server.start()