186 % profiler) |
186 % profiler) |
187 profiler = 'stat' |
187 profiler = 'stat' |
188 |
188 |
189 self._output = self._ui.config('profiling', 'output') |
189 self._output = self._ui.config('profiling', 'output') |
190 |
190 |
191 if self._output == 'blackbox': |
191 if True: |
192 self._fp = util.stringio() |
192 if self._output == 'blackbox': |
193 elif self._output: |
193 self._fp = util.stringio() |
194 path = self._ui.expandpath(self._output) |
194 elif self._output: |
195 self._fp = open(path, 'wb') |
195 path = self._ui.expandpath(self._output) |
196 else: |
196 self._fp = open(path, 'wb') |
197 self._fpdoclose = False |
197 else: |
198 self._fp = self._ui.ferr |
198 self._fpdoclose = False |
199 |
199 self._fp = self._ui.ferr |
200 if proffn is not None: |
200 |
201 pass |
201 if proffn is not None: |
202 elif profiler == 'ls': |
202 pass |
203 proffn = lsprofile |
203 elif profiler == 'ls': |
204 elif profiler == 'flame': |
204 proffn = lsprofile |
205 proffn = flameprofile |
205 elif profiler == 'flame': |
206 else: |
206 proffn = flameprofile |
207 proffn = statprofile |
207 else: |
208 |
208 proffn = statprofile |
209 self._profiler = proffn(self._ui, self._fp) |
209 |
210 self._profiler.__enter__() |
210 self._profiler = proffn(self._ui, self._fp) |
|
211 self._profiler.__enter__() |
211 |
212 |
212 def __exit__(self, exception_type, exception_value, traceback): |
213 def __exit__(self, exception_type, exception_value, traceback): |
213 if self._profiler is None: |
214 if self._profiler is None: |
214 return |
215 return |
215 self._profiler.__exit__(exception_type, exception_value, traceback) |
216 self._profiler.__exit__(exception_type, exception_value, traceback) |