From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- includes/profiler/output/ProfilerOutputStats.php | 57 ++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 includes/profiler/output/ProfilerOutputStats.php (limited to '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..ef6ef7c9 --- /dev/null +++ b/includes/profiler/output/ProfilerOutputStats.php @@ -0,0 +1,57 @@ +collector->getContext()->getStats(); + + foreach ( $stats as $stat ) { + // Sanitize the key + $key = str_replace( '::', '.', $stat['name'] ); + $key = preg_replace( '/[^a-z.]+/i', '_', $key ); + $key = trim( $key, '_.' ); + + // 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 ); + } + } +} -- cgit v1.2.3-54-g00ecf