Permalink
Browse files

Added sorting.

  • Loading branch information...
1 parent df56985 commit 30b363e8ecc24dbd5f242486c6f4f56ca2f7930a @technosophos committed Dec 7, 2010
Showing with 7 additions and 0 deletions.
  1. +4 −0 src/WhoCallsStackTrace.php
  2. +3 −0 src/whocalls
@@ -35,5 +35,9 @@ public function enterFunction($depth, $function_id, $elapsed_time, $memory_consu
}
}
}
+
+ public function countComparator($a, $b) {
+ return $a['count'] > $b['count'] ? 1 : ($a['count'] > $b['count'] ? -1 : 0);
+ }
}
?>
View
@@ -27,6 +27,9 @@ if (empty($report)) {
die("No symbols found");
}
+print "Sorting\n";
+usort($report, array($collector, "countComparator"));
+
foreach ($report as $trace) {
printf("%s (called %d time%s)", $trace['trace'], $trace['count'], $trace['count'] == 1 ? '':'s');
print PHP_EOL;

0 comments on commit 30b363e

Please sign in to comment.