|
4 | 4 | <head> |
5 | 5 | <meta charset="UTF-8"> |
6 | 6 | <title>PHP Frameworks Bench</title> |
| 7 | +</head> |
| 8 | + |
| 9 | +<body style="max-width: 1200px; margin:0 auto; padding: 15px 30px"> |
| 10 | + <h1>PHP Frameworks Bench</h1> |
| 11 | + |
7 | 12 | <script> |
8 | 13 | <?php |
| 14 | + ini_set('display_errors', '1'); |
| 15 | + ini_set('display_startup_errors', '1'); |
| 16 | + error_reporting(E_ALL); |
| 17 | + |
| 18 | + $target = $_GET['t'] ?? null; |
| 19 | + |
9 | 20 | $dataLabels = []; |
10 | 21 | $dataRPS = []; |
11 | 22 | $dataMemory = []; |
12 | 23 | $dataTime = []; |
13 | 24 | $dataFile = []; |
14 | 25 |
|
| 26 | + $dataCompRPS = []; |
| 27 | + $dataCompMemory = []; |
| 28 | + |
| 29 | + $data = []; |
| 30 | + |
15 | 31 | $resultsDirs = glob("./output/*", GLOB_ONLYDIR); |
16 | 32 |
|
17 | 33 | rsort($resultsDirs); |
18 | | - |
19 | | - $resultsDir = @$resultsDirs[0].'/results.log'; |
| 34 | + |
| 35 | + $resultsDir = @$resultsDirs[0] ; |
| 36 | + |
| 37 | + if ($target!==null && file_exists('./output/' . $target)) { |
| 38 | + $resultsDir = './output/' . $target; |
| 39 | + } |
| 40 | + |
| 41 | + $resultsDatetime = ""; |
| 42 | + if (preg_match("/output\/(\S+)/", @$resultsDir, $match)) { |
| 43 | + $resultsDatetime = @$match[1]; |
| 44 | + } |
20 | 45 |
|
21 | 46 | if (file_exists($resultsDir)) { |
22 | 47 | Parse_Results: { |
23 | 48 | require __DIR__ . '/libs/parse_results.php'; |
24 | | - $results = parse_results($resultsDir); |
| 49 | + $results = parse_results($resultsDir . '/results.log'); |
25 | 50 | } |
26 | 51 |
|
27 | 52 | foreach ($results as $fw => $params) { |
|
30 | 55 | $dataMemory[] = $params['memory']; |
31 | 56 | $dataTime[] = $params['time']; |
32 | 57 | $dataFile[] = $params['file']; |
| 58 | + |
| 59 | + if (empty($resultsDirs[1])) |
| 60 | + continue; |
| 61 | + |
| 62 | + if (!empty($results2[$fw])) { |
| 63 | + $dataCompRPS[] = $results2[$fw]['rps']; |
| 64 | + $dataCompMemory[] = $results2[$fw]['memory']; |
| 65 | + } else { |
| 66 | + $dataCompRPS[] = 0; |
| 67 | + $dataCompMemory[] = 0; |
| 68 | + } |
33 | 69 | } |
34 | 70 | } |
35 | 71 |
|
|
39 | 75 | const dataMemory = [" . implode(",", $dataMemory) . "]; |
40 | 76 | const dataTime = [" . implode(",", $dataTime) . "]; |
41 | 77 | const dataFile = [" . implode(",", $dataFile) . "]; |
| 78 | +
|
| 79 | + const resultsDatetime = '$resultsDatetime'; |
42 | 80 | "; |
43 | 81 | ?> |
44 | 82 | </script> |
45 | | -</head> |
46 | | - |
47 | | -<body style="max-width: 1200px; margin:0 auto; padding: 15px 30px"> |
48 | | - <h1>PHP Frameworks Bench</h1> |
49 | 83 |
|
50 | 84 | <?php |
51 | 85 | if (!file_exists($resultsDir)) { |
|
58 | 92 | </ul> |
59 | 93 | <?php |
60 | 94 | } else { |
61 | | - if (preg_match("/output\/(\S+)\/results.log/", @$resultsDir, $match)) { |
62 | | - echo "<h4>" . @$match[1] . "</h4>"; |
| 95 | + echo "<h4>" . @$match[1] . "</h4>"; |
| 96 | + |
| 97 | + foreach ($resultsDirs as $res) { |
| 98 | + if (preg_match("/output\/(\S+)/", @$res, $match)) { |
| 99 | + echo "<a href='index.php?t=" . @$match[1] . "'>" . $match[1] . "</a> | "; |
| 100 | + } |
63 | 101 | } |
64 | 102 | ?> |
65 | 103 | <br> |
|
77 | 115 |
|
78 | 116 | <ul> |
79 | 117 | <?php |
80 | | - $urls = file(__DIR__ . '/output/urls.log'); |
| 118 | + $urls = file($resultsDir . '/urls.log'); |
81 | 119 | foreach ($urls as $url) { |
82 | 120 | $url_array = explode('/', $url); |
83 | 121 | // to make it shorter |
|
0 commit comments