Re-analyze tracelets when IR translation fails
[hiphop-php.git] / bin / distcc_timer.php
blob9644a24722fd4438d33528f711aafe64aaf326b2
1 <?php
3 $file = isset($argv[1]) ? $argv[1] : '/tmp/distcc_timer.log';
4 $lines = array();
5 exec("cat $file", $lines);
6 $time = array();
7 $machines = array();
8 foreach ($lines as $line) {
9 preg_match('/([^ ]+) @ ([^ ]+)/', $line, $m);
10 $filename = $m[1];
11 $machine = $m[2];
12 if (!isset($machines[$machine])) $machines[$machine] = 0;
13 ++$machines[$machine];
14 preg_match('/pp start: +([0-9]+)/', $line, $m); $pp0 = $m[1];
15 preg_match('/pp end: +([0-9]+)/', $line, $m); $pp1 = $m[1];
16 preg_match('/remote start: +([0-9]+)/', $line, $m); $cc0 = $m[1];
17 preg_match('/remote end: +([0-9]+)/', $line, $m); $cc1 = $m[1];
18 $preprocessing = $pp1 - $pp0;
19 $compiling = $cc1 - $cc0;
20 if ($preprocessing >= 10) {
21 echo "preprocessing: $preprocessing, compiling: $compiling --> $filename\n";
23 $time[$filename] = $compiling;
26 function cmp($a, $b) {
27 if ($a === $b) return 0;
28 return ($a > $b) ? 1 : -1;
31 uasort($time, 'cmp');
32 foreach ($time as $filename => $compiling) {
33 echo "compiling: $compiling --> $filename\n";
35 var_dump($machines);