profiling: don't error with statprof when profiling has already started
statprof.reset() asserts if profiling has already started. So don't
call if it profiling is already running.
--- a/mercurial/profiling.py Sun Aug 14 17:51:12 2016 -0700
+++ b/mercurial/profiling.py Sun Aug 14 18:28:43 2016 -0700
@@ -88,7 +88,9 @@
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)