|
1 | 1 | <?php |
2 | 2 |
|
3 | | -require __DIR__ . '/libs/php-recipe-2nd/make_chart_parts.php'; |
4 | 3 | require __DIR__ . '/libs/parse_results.php'; |
| 4 | +require __DIR__ . '/libs/make_graph.php'; |
5 | 5 |
|
6 | 6 | $results = parse_results(__DIR__ . '/output/results.hello_world.log'); |
7 | 7 |
|
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); |
45 | | -} |
46 | | - |
47 | 8 | // RPS Benchmark |
48 | | -list($chart_rpm, $div_rpm) = makeGraph('rps', 'Throughput', 'requests per second'); |
| 9 | +list($chart_rpm, $div_rpm) = make_graph('rps', 'Throughput', 'requests per second'); |
49 | 10 |
|
50 | 11 | // Memory Benchmark |
51 | | -list($chart_mem, $div_mem) = makeGraph('memory', 'Memory', 'peak memory (MB)'); |
| 12 | +list($chart_mem, $div_mem) = make_graph('memory', 'Memory', 'peak memory (MB)'); |
52 | 13 |
|
53 | 14 | // Exec Time Benchmark |
54 | | -list($chart_time, $div_time) = makeGraph('time', 'Exec Time', 'ms'); |
| 15 | +list($chart_time, $div_time) = make_graph('time', 'Exec Time', 'ms'); |
55 | 16 |
|
56 | 17 | // Included Files |
57 | | -list($chart_file, $div_file) = makeGraph('file', 'Included Files', 'count'); |
| 18 | +list($chart_file, $div_file) = make_graph('file', 'Included Files', 'count'); |
58 | 19 | ?> |
59 | 20 | <!DOCTYPE html> |
60 | 21 | <html lang="en"> |
|
0 commit comments