The Profiler.php class, when called upon to process any profiler outputs at the end of a web request, requires a RequestContext. This is especially problematic for Maintenance CLI process as it somewhat unpredictable to construct a RequestContext there, and is probably one of very few cases where that currently happens for CLI processes.
The Profiler::getContext method guards against this by falling back to RequestContext::getMain() and emitting a warning. But, this is never reached because the only real caller to Profiler::logData is wfLogProfilingData which helpfully does this:
$profiler = Profiler::instance(); $profiler->setContext( RequestContext::getMain() );
.. which is called at the end of web requests (MediaWiki::restInPeace), but also CLI processes (Maintenance::shutdown).
The only thing Profiler actually uses this for is for this one call:
And all that ultimately does is, is run this plain PHP statement:
microtime( true ) - $_SERVER['REQUEST_TIME_FLOAT']