comparison mercurial/profiling.py @ 30330:3fd53cc1aad8

profiling: make statprof the default profiler (BC) The statprof sampling profiler runs with significantly less overhead. Its data is therefore more useful. Furthermore, its default output shows the hotpath by default, which I've found to be way more useful than the default profiler's function time table. There is one behavioral regression with this change worth noting: the statprof profiler currently doesn't profile individual hgweb requests like lsprof does. This is because the current implementation of statprof only profiles the thread that started profiling. The ability for lsprof to profile individual hgweb requests is relatively new and likely not widely used. Furthermore, I have plans to modify statprof to support profiling multiple threads. I expect that change to go through several iterations. I'm submitting this patch first so there is more time to test statprof. Perfect is the enemy of good.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 04 Nov 2016 21:44:25 -0700
parents faf1b8923da2
children 189a1030affb
comparison
equal deleted inserted replaced
30329:faf1b8923da2 30330:3fd53cc1aad8
121 Profiling is active when the context manager is active. When the context 121 Profiling is active when the context manager is active. When the context
122 manager exits, profiling results will be written to the configured output. 122 manager exits, profiling results will be written to the configured output.
123 """ 123 """
124 profiler = os.getenv('HGPROF') 124 profiler = os.getenv('HGPROF')
125 if profiler is None: 125 if profiler is None:
126 profiler = ui.config('profiling', 'type', default='ls') 126 profiler = ui.config('profiling', 'type', default='stat')
127 if profiler not in ('ls', 'stat', 'flame'): 127 if profiler not in ('ls', 'stat', 'flame'):
128 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler) 128 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
129 profiler = 'ls' 129 profiler = 'stat'
130 130
131 output = ui.config('profiling', 'output') 131 output = ui.config('profiling', 'output')
132 132
133 if output == 'blackbox': 133 if output == 'blackbox':
134 fp = util.stringio() 134 fp = util.stringio()