Comments
Patch
@@ -83,17 +83,19 @@ def statprofile(ui, fp):
try:
import statprof
except ImportError:
raise error.Abort(_(
'statprof not available - install using "easy_install statprof"'))
freq = ui.configint('profiling', 'freq', default=1000)
if freq > 0:
- statprof.reset(freq)
+ # Cannot reset when profiler is already active. So silently no-op.
+ if statprof.state.profile_level == 0:
+ statprof.reset(freq)
else:
ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
statprof.start()
try:
yield
finally:
statprof.stop()