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:
Jun Wu 2018-09-14 19:01:31 -07:00 committed by Facebook Github Bot
parent a9ed32f839
commit 9fb16dc4ec
4 changed files with 5 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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