forked from rusoft/php-simple-benchmark-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse.php
31 lines (23 loc) · 753 Bytes
/
parse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$filename = 'benchmark_results.txt'; // Replace with your actual filename
// Read the file
$content = file_get_contents($filename);
// Split the content into lines
$lines = explode("\n", $content);
// Remove the header line
array_shift($lines);
// Process each line
foreach ($lines as $line) {
// Skip empty lines and the TOTAL line
if (empty(trim($line)) || strpos($line, 'TOTAL:') === 0 || strpos($line, 'END:') === 0) {
continue;
}
// Split the line by comma
$parts = explode(',', $line);
// Extract the OP/SEC value (index 1 after splitting by comma)
$op_sec = isset($parts[1]) ? trim($parts[1]) : '';
// Output only the OP/SEC value
if ($op_sec !== '') {
echo "$op_sec\n";
}
}