Show More
@@ -147,17 +147,19 b' class profile(object):' | |||
|
147 | 147 | Profiling is active when the context manager is active. When the context |
|
148 | 148 | manager exits, profiling results will be written to the configured output. |
|
149 | 149 | """ |
|
150 | def __init__(self, ui): | |
|
150 | def __init__(self, ui, enabled=True): | |
|
151 | 151 | self._ui = ui |
|
152 | 152 | self._output = None |
|
153 | 153 | self._fp = None |
|
154 | 154 | self._profiler = None |
|
155 | self._enabled = enabled | |
|
155 | 156 | self._entered = False |
|
156 | 157 | self._started = False |
|
157 | 158 | |
|
158 | 159 | def __enter__(self): |
|
159 | 160 | self._entered = True |
|
160 |
self. |
|
|
161 | if self._enabled: | |
|
162 | self.start() | |
|
161 | 163 | |
|
162 | 164 | def start(self): |
|
163 | 165 | """Start profiling. |
@@ -228,8 +230,5 b' def maybeprofile(ui):' | |||
|
228 | 230 | just use a single code path for calling into code you may want to profile |
|
229 | 231 | and this function determines whether to start profiling. |
|
230 | 232 | """ |
|
231 |
|
|
|
232 | with profile(ui): | |
|
233 | yield | |
|
234 | else: | |
|
233 | with profile(ui, enabled=ui.configbool('profiling', 'enabled')): | |
|
235 | 234 | yield |
General Comments 0
You need to be logged in to leave comments.
Login now