}
$result = '';
try {
- wfIncrStats( "resourceloader_cache.$filter.miss" );
$result = $this->applyFilter( $filter, $data );
if ( $options['cacheReport'] ) {
$result .= "\n/* cache key: $key */";
}
private function applyFilter( $filter, $data ) {
- switch ( $filter ) {
- case 'minify-js':
- return JavaScriptMinifier::minify( $data,
- $this->config->get( 'ResourceLoaderMinifierStatementsOnOwnLine' ),
- $this->config->get( 'ResourceLoaderMinifierMaxLineLength' )
- );
- case 'minify-css':
- return CSSMin::minify( $data );
- }
- return $data;
+ $stats = RequestContext::getMain()->getStats();
+ $statStart = microtime( true );
+
+ switch ( $filter ) {
+ case 'minify-js':
+ $data = JavaScriptMinifier::minify( $data,
+ $this->config->get( 'ResourceLoaderMinifierStatementsOnOwnLine' ),
+ $this->config->get( 'ResourceLoaderMinifierMaxLineLength' )
+ );
+ break;
+ case 'minify-css':
+ $data = CSSMin::minify( $data );
+ break;
+ }
+
+ $stats->timing( "resourceloader_cache.$filter.miss", microtime( true ) - $statStart );
+ return $data;
}
/* Methods */
*/
final protected function buildContent( ResourceLoaderContext $context ) {
$rl = $context->getResourceLoader();
+ $stats = RequestContext::getMain()->getStats();
+ $statStart = microtime( true );
// Only include properties that are relevant to this context (e.g. only=scripts)
// and that are non-empty (e.g. don't include "templates" for modules without
$content['templates'] = $templates;
}
+ $statTiming = microtime( true ) - $statStart;
+ $statName = str_replace( '.', '_', $this->getName() );
+ $stats->timing( "resourceloader_build.all", $statTiming );
+ $stats->timing( "resourceloader_build.$statName", $statTiming );
+
return $content;
}