Mercurial > hg
changeset 29785:88d3c1ab03a7
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.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 14 Aug 2016 18:28:43 -0700 |
parents | e3501546f7e4 |
children | fc2442492606 |
files | mercurial/profiling.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)