equal
deleted
inserted
replaced
158 |
158 |
159 def __enter__(self): |
159 def __enter__(self): |
160 self._entered = True |
160 self._entered = True |
161 if self._enabled: |
161 if self._enabled: |
162 self.start() |
162 self.start() |
|
163 return self |
163 |
164 |
164 def start(self): |
165 def start(self): |
165 """Start profiling. |
166 """Start profiling. |
166 |
167 |
167 The profiling will stop at the context exit. |
168 The profiling will stop at the context exit. |
228 |
229 |
229 The purpose of this context manager is to make calling code simpler: |
230 The purpose of this context manager is to make calling code simpler: |
230 just use a single code path for calling into code you may want to profile |
231 just use a single code path for calling into code you may want to profile |
231 and this function determines whether to start profiling. |
232 and this function determines whether to start profiling. |
232 """ |
233 """ |
233 with profile(ui, enabled=ui.configbool('profiling', 'enabled')): |
234 with profile(ui, enabled=ui.configbool('profiling', 'enabled')) as p: |
234 yield |
235 yield p |