# HG changeset patch # User Christophe de Vienne # Date 1420301241 -3600 # Node ID 9a112017974a8044c186769f4867b39b06d5581d # Parent 7f2cfe9f79cbdfd7e9517f22578236afded50a8c Add profiling options diff -r 7f2cfe9f79cb -r 9a112017974a ccplugin.py --- a/ccplugin.py Sat Jan 03 02:39:43 2015 +0100 +++ b/ccplugin.py Sat Jan 03 17:07:21 2015 +0100 @@ -57,6 +57,20 @@ 'default': None, 'choices': ('debug', 'info', 'warning', 'error'), 'help': 'debug if -D is set, error otherwise', }), + ('profile', + {'short': 'p', 'action': 'store_true', + 'default': False, + 'help': 'Enable profiling'}), + ('profile-output', + {'type': 'string', + 'default': None, + 'help': 'Profiling output file (default: "program.prof")'}), + ('profile-dump-every', + {'type': 'int', + 'default': None, + 'metavar': 'N', + 'help': 'Dump profile stats to ouput every N requests ' + '(default: 100)'}), ) _reloader_environ_key = 'CW_RELOADER_SHOULD_RUN' @@ -285,7 +299,11 @@ host = cwconfig['interface'] port = cwconfig['port'] or 8080 - app = wsgi_application_from_cwconfig(cwconfig) + app = wsgi_application_from_cwconfig( + cwconfig, profile=self['profile'], + profile_output=self['profile-output'], + profile_dump_every=self['profile-dump-every'] + ) repo = cwconfig.repository() try: