##// END OF EJS Templates
profile: introduce a "start" method to the profile context...
marmoute -
r32784:086c1ef0 default
parent child Browse files
Show More
@@ -152,8 +152,24 b' class profile(object):'
152 self._output = None
152 self._output = None
153 self._fp = None
153 self._fp = None
154 self._profiler = None
154 self._profiler = None
155 self._entered = False
156 self._started = False
155
157
156 def __enter__(self):
158 def __enter__(self):
159 self._entered = True
160 self.start()
161
162 def start(self):
163 """Start profiling.
164
165 The profiling will stop at the context exit.
166
167 If the profiler was already started, this has no effect."""
168 if not self._entered:
169 raise error.ProgrammingError()
170 if self._started:
171 return
172 self._started = True
157 profiler = encoding.environ.get('HGPROF')
173 profiler = encoding.environ.get('HGPROF')
158 proffn = None
174 proffn = None
159 if profiler is None:
175 if profiler is None:
General Comments 0
You need to be logged in to leave comments. Login now