xhprof: Fix magnitude of %real measurements from scoped profiler
authorBryan Davis <bd808@wikimedia.org>
Wed, 17 Dec 2014 23:36:04 +0000 (16:36 -0700)
committerBryan Davis <bd808@wikimedia.org>
Wed, 17 Dec 2014 23:36:04 +0000 (16:36 -0700)
Change-Id: I06e5b3d82cfddd1a407c56819c9bdd91f160e928

includes/profiler/ProfilerXhprof.php

index a40c44a..162ec00 100644 (file)
@@ -140,7 +140,7 @@ class ProfilerXhprof extends Profiler {
                // Merge in all of the custom profile sections
                foreach ( $this->sprofiler->getFunctionStats() as $stats ) {
                        // @note: getFunctionStats() values already in ms
-                       $stats['%real'] = $stats['real'] / $main['real'];
+                       $stats['%real'] = $stats['real'] / $main['real'] * 100;
                        $stats['%cpu'] = $main['cpu'] ? $stats['cpu'] / $main['cpu'] * 100 : 0;
                        $stats['%memory'] = $main['memory'] ? $stats['memory'] / $main['memory'] * 100 : 0;
                        $profile[] = $stats; // assume no section names collide with $metrics