On Tue, 27 Dec 2011 19:02:29 -0800, Tim Starling tstarling@wikimedia.org wrote:
On 28/12/11 13:53, Daniel Friesen wrote:
The typical thing to go into StartProfiler.php for someone who wants to use it is: $wgProfiler['class'] = 'Profiler';
;) ie: It's pure config, it's not even php code.
That's because the actual starting of the profiler happens after StartProfiler.php finishes but before LocalSettings.php starts. When you said there was no extra value to StartProfiler.php, I thought you were imagining some system where the profiler would be started at the top of LocalSettings.php
Running LocalSettings.php itself is often slow, especially the extension setup files. So it's important that the profiler is running at this time.
-- Tim Starling
I'm imagining the very little that goes on in StartProfiler.php (which is basically config) will go into LocalSettings.php, probably early on.
All that goes into StartProfiler.php is configuration of the $wgProfiler variable.
We load $IP/includes/profiler/Profiler.php first, right after the AutoLoader. Following that we set `$wgProfiler = array();` and include StartProfiler.php if present. Following that we load DefaultSettings.php and then LocalSettings.php
DefaultSettings.php doesn't invoke the profiler. So Profiler::$__instance is never set until the first wfProfileIn call made AFTER LocalSettings.php loads. Thinking about it requiring extensions probably don't even typically invoke the profiler anywhere within LocalSettings since anything like that is probably deferred into a function.
So, we're not actually running the profiler within LocalSettings.php or anywhere before it.
((And if we really wanted to do that, I'd almost argue for a setup where wfProfilerIn will queue up a deferred list of profiling entries and then when LocalSettings.php finishes we make a call after the inclusion that commits them. So that we don't have to worry about the profiler even being created till after the profiler config is setup))