From b8521e7e282819092d3b248ff7219bbd65958d55 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Fri, 26 Feb 2010 14:25:17 +0000 Subject: [PATCH] include the ability to profile the web server, code lifted straight from the daemon --- deluge/ui/web/web.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index ba9554336..6fcd2227e 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -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()