mercurial/profiling.py
changeset 32786 0ead06d54ffe
parent 32785 37ec8f24d912
child 32788 eede022fc142
equal deleted inserted replaced
32785:37ec8f24d912 32786:0ead06d54ffe
   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