8 $ret = shell_exec("GET 'http://$server/stats.kvp?agg=*&keys=:mutex.*:'");
9 $stats = json_decode($ret);
11 exit("No mutex profile data was found on server\n");
14 foreach ($stats as $name => $count) {
15 if (preg_match('/mutex.([0-9a-f:]+).(hit|time)/', $name, $m)) {
20 $hits[$stack] = $count;
22 $times[$stack] = $count;
27 arsort($hits); $hits = array_slice($hits, 0, $top);
28 arsort($times); $times = array_slice($times, 0, $top);
31 print str_repeat('=', 70)."\n";
32 foreach ($hits as $stack => $count) {
33 print $count ." x sampling hits:\n";
34 print $translate ?
translate_stack($stack) : $stack."\n";
35 print str_repeat('-', 70)."\n";
38 print str_repeat('=', 70)."\n";
39 foreach ($times as $stack => $count) {
40 print (int)($count/1000000) ." seconds:\n";
41 print $translate ?
translate_stack($stack) : $stack."\n";
42 print str_repeat('-', 70)."\n";
45 function translate_stack($stack) {
47 return shell_exec("GET http://$server/translate?stack=$stack");