X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/profiler/output/ProfilerOutputStats.php diff --git a/includes/profiler/output/ProfilerOutputStats.php b/includes/profiler/output/ProfilerOutputStats.php new file mode 100644 index 00000000..bb865518 --- /dev/null +++ b/includes/profiler/output/ProfilerOutputStats.php @@ -0,0 +1,56 @@ +params['prefix'] ) ? $this->params['prefix'] : ''; + $contextStats = MediaWikiServices::getInstance()->getStatsdDataFactory(); + + foreach ( $stats as $stat ) { + $key = "{$prefix}.{$stat['name']}"; + + // Convert fractional seconds to whole milliseconds + $cpu = round( $stat['cpu'] * 1000 ); + $real = round( $stat['real'] * 1000 ); + + $contextStats->increment( "{$key}.calls" ); + $contextStats->timing( "{$key}.cpu", $cpu ); + $contextStats->timing( "{$key}.real", $real ); + } + } +}