mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
profiling: remove redundant "enabled" argument from "profiling.profile"
Summary: The `profiling.profile` method already takes a `ui` object which contains information about whether to enable profiling or not. The `enabled` argument is redundant. Remove it. Reviewed By: singhsrb Differential Revision: D9828553 fbshipit-source-id: 7face72aa23364ce7ca56feaf4f4ead95ef69bb9
This commit is contained in:
parent
a9ed32f839
commit
9fb16dc4ec
@ -1169,8 +1169,7 @@ def _dispatch(req):
|
||||
for ui_ in uis:
|
||||
ui_.setconfig("profiling", "enabled", "true", "--profile")
|
||||
|
||||
profile = lui.configbool("profiling", "enabled")
|
||||
with profiling.profile(lui, enabled=profile) as profiler:
|
||||
with profiling.profile(lui) as profiler:
|
||||
# Configure extensions in phases: uisetup, extsetup, cmdtable, and
|
||||
# reposetup
|
||||
extensions.loadall(lui)
|
||||
|
@ -315,8 +315,7 @@ class hgweb(object):
|
||||
should be using instances of this class as the WSGI application.
|
||||
"""
|
||||
with self._obtainrepo() as repo:
|
||||
profile = repo.ui.configbool("profiling", "enabled")
|
||||
with profiling.profile(repo.ui, enabled=profile):
|
||||
with profiling.profile(repo.ui):
|
||||
for r in self._runwsgi(req, repo):
|
||||
yield r
|
||||
|
||||
|
@ -222,8 +222,7 @@ class hgwebdir(object):
|
||||
return False
|
||||
|
||||
def run_wsgi(self, req):
|
||||
profile = self.ui.configbool("profiling", "enabled")
|
||||
with profiling.profile(self.ui, enabled=profile):
|
||||
with profiling.profile(self.ui):
|
||||
for r in self._runwsgi(req):
|
||||
yield r
|
||||
|
||||
|
@ -165,19 +165,18 @@ class profile(object):
|
||||
manager exits, profiling results will be written to the configured output.
|
||||
"""
|
||||
|
||||
def __init__(self, ui, enabled=True):
|
||||
def __init__(self, ui):
|
||||
self._ui = ui
|
||||
self._output = None
|
||||
self._fp = None
|
||||
self._fpdoclose = True
|
||||
self._profiler = None
|
||||
self._enabled = enabled
|
||||
self._entered = False
|
||||
self._started = False
|
||||
|
||||
def __enter__(self):
|
||||
self._entered = True
|
||||
if self._enabled:
|
||||
if self._ui.configbool("profiling", "enabled"):
|
||||
self.start()
|
||||
return self
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user