|
5 | 5 |
|
6 | 6 | $results = parse_results(__DIR__ . '/output/results.hello_world.log'); |
7 | 7 |
|
8 | | -$barColors = array( |
9 | | - 'DarkBlue', 'DarkCyan', 'DarkGoldenRod', 'DarkGray', 'DarkGreen', |
10 | | - 'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'DarkOrange', 'DarkOrchid', |
11 | | - 'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray', |
12 | | - 'DarkBlue', 'DarkCyan', 'DarkGoldenRod', 'DarkGray', 'DarkGreen', |
13 | | - 'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'DarkOrange', 'DarkOrchid', |
14 | | - 'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray', |
15 | | -); |
16 | | - |
17 | | -$graphWidth = 1000; |
18 | | -$graphHeight = 400; |
19 | | - |
20 | | -// RPS Benchmark |
21 | | -$data[] = array('', 'rps', array('role' => 'style')); // header |
22 | | - |
23 | | -$colors = $barColors; |
24 | | -foreach ($results as $fw => $result) { |
25 | | - $data[] = array($fw, $result['rps'], array_shift($colors)); |
| 8 | +function makeGraph($id, $title, $hAxis_title) |
| 9 | +{ |
| 10 | + global $results; |
| 11 | + |
| 12 | + $barColors = array( |
| 13 | + 'DarkBlue', 'DarkCyan', 'DarkGoldenRod', 'DarkGray', 'DarkGreen', |
| 14 | + 'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'DarkOrange', 'DarkOrchid', |
| 15 | + 'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray', |
| 16 | + 'DarkBlue', 'DarkCyan', 'DarkGoldenRod', 'DarkGray', 'DarkGreen', |
| 17 | + 'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'DarkOrange', 'DarkOrchid', |
| 18 | + 'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray', |
| 19 | + ); |
| 20 | + $graphWidth = 1000; |
| 21 | + $graphHeight = 400; |
| 22 | + |
| 23 | + $data = array(); |
| 24 | + $data[] = array('', $id, array('role' => 'style')); // header |
| 25 | + |
| 26 | + $colors = $barColors; |
| 27 | + foreach ($results as $fw => $result) { |
| 28 | + $data[] = array($fw, $result[$id], array_shift($colors)); |
| 29 | + } |
| 30 | + //var_dump($data); exit; |
| 31 | + |
| 32 | + $options = array( |
| 33 | + 'title' => $title, |
| 34 | + 'titleTextStyle' => array('fontSize' => 16), |
| 35 | + 'hAxis' => array('title' => $hAxis_title, |
| 36 | + 'titleTextStyle' => array('bold' => true)), |
| 37 | + 'vAxis' => array('minValue' => 0, 'maxValue' => 0.01), |
| 38 | + 'width' => $graphWidth, |
| 39 | + 'height' => $graphHeight, |
| 40 | + 'bar' => array('groupWidth' => '90%'), |
| 41 | + 'legend' => array('position' => 'none') |
| 42 | + ); |
| 43 | + $type = 'ColumnChart'; |
| 44 | + return makeChartParts($data, $options, $type); |
26 | 45 | } |
27 | | -//var_dump($data); exit; |
28 | 46 |
|
29 | | -$options = array( |
30 | | - 'title' => 'Throughput', |
31 | | - 'titleTextStyle' => array('fontSize' => 16), |
32 | | - 'hAxis' => array('title' => 'requests per second', |
33 | | - 'titleTextStyle' => array('bold' => true)), |
34 | | - 'vAxis' => array('minValue' => 0, 'maxValue' => 0.01), |
35 | | - 'width' => $graphWidth, |
36 | | - 'height' => $graphHeight, |
37 | | - 'bar' => array('groupWidth' => '90%'), |
38 | | - 'legend' => array('position' => 'none') |
39 | | -); |
40 | | -$type = 'ColumnChart'; |
41 | | -list($chart_rpm, $div_rpm) = makeChartParts($data, $options, $type); |
| 47 | +// RPS Benchmark |
| 48 | +list($chart_rpm, $div_rpm) = makeGraph('rps', 'Throughput', 'requests per second'); |
42 | 49 |
|
43 | 50 | // Memory Benchmark |
44 | | -$data = array(); |
45 | | -$data[] = array('', 'memory', array('role' => 'style')); // header |
46 | | - |
47 | | -$colors = $barColors; |
48 | | -foreach ($results as $fw => $result) { |
49 | | - $data[] = array($fw, $result['memory'], array_shift($colors)); |
50 | | -} |
51 | | - |
52 | | -$options = array( |
53 | | - 'title' => 'Memory', |
54 | | - 'titleTextStyle' => array('fontSize' => 16), |
55 | | - 'hAxis' => array('title' => 'peak memory (MB)', |
56 | | - 'titleTextStyle' => array('bold' => true)), |
57 | | - 'vAxis' => array('minValue' => 0, 'maxValue' => 1), |
58 | | - 'width' => $graphWidth, |
59 | | - 'height' => $graphHeight, |
60 | | - 'bar' => array('groupWidth' => '90%'), |
61 | | - 'legend' => array('position' => 'none') |
62 | | -); |
63 | | -$type = 'ColumnChart'; |
64 | | -list($chart_mem, $div_mem) = makeChartParts($data, $options, $type); |
| 51 | +list($chart_mem, $div_mem) = makeGraph('memory', 'Memory', 'peak memory (MB)'); |
65 | 52 |
|
66 | 53 | // Exec Time Benchmark |
67 | | -$data = array(); |
68 | | -$data[] = array('', 'time', array('role' => 'style')); // header |
69 | | - |
70 | | -$colors = $barColors; |
71 | | -foreach ($results as $fw => $result) { |
72 | | - $data[] = array($fw, $result['time'], array_shift($colors)); |
73 | | -} |
| 54 | +list($chart_time, $div_time) = makeGraph('time', 'Exec Time', 'ms'); |
74 | 55 |
|
75 | | -$options = array( |
76 | | - 'title' => 'Exec Time', |
77 | | - 'titleTextStyle' => array('fontSize' => 16), |
78 | | - 'hAxis' => array('title' => 'ms', |
79 | | - 'titleTextStyle' => array('bold' => true)), |
80 | | - 'vAxis' => array('minValue' => 0, 'maxValue' => 1), |
81 | | - 'width' => $graphWidth, |
82 | | - 'height' => $graphHeight, |
83 | | - 'bar' => array('groupWidth' => '90%'), |
84 | | - 'legend' => array('position' => 'none') |
85 | | -); |
86 | | -$type = 'ColumnChart'; |
87 | | -list($chart_time, $div_time) = makeChartParts($data, $options, $type); |
| 56 | +// Included Files |
| 57 | +list($chart_file, $div_file) = makeGraph('file', 'Included Files', 'count'); |
88 | 58 | ?> |
89 | 59 | <!DOCTYPE html> |
90 | 60 | <html lang="en"> |
|
94 | 64 | <script src="https://www.google.com/jsapi"></script> |
95 | 65 | <script> |
96 | 66 | <?php |
97 | | -echo $chart_rpm, $chart_mem, $chart_time; |
| 67 | +echo $chart_rpm, $chart_mem, $chart_time, $chart_file; |
98 | 68 | ?> |
99 | 69 | </script> |
100 | 70 | </head> |
|
103 | 73 | <h2>Hello World Benchmark</h2> |
104 | 74 | <div> |
105 | 75 | <?php |
106 | | -echo $div_rpm, $div_mem, $div_time; |
| 76 | +echo $div_rpm, $div_mem, $div_time, $div_file; |
107 | 77 | ?> |
108 | 78 | </div> |
109 | 79 |
|
|
0 commit comments