You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
889 B
43 lines
889 B
<?php
|
|
|
|
require('common.php');
|
|
|
|
$results = [];
|
|
|
|
// Load all queries from all workers
|
|
for ($i=0; $i<WORKERS; $i++)
|
|
{
|
|
$fp = fopen('worker.'.$i.'.csv', 'r');
|
|
$header = fgetcsv($fp);
|
|
|
|
while ($line = fgetcsv($fp))
|
|
{
|
|
$results[] = [
|
|
'query' => $line[0],
|
|
'duration' => $line[1]
|
|
];
|
|
}
|
|
|
|
fclose($fp);
|
|
}
|
|
|
|
// Sort them by duration
|
|
usort($results, function($a, $b) {
|
|
if ($a['duration'] == $b['duration']) return 0;
|
|
if ($a['duration'] < $b['duration']) return -1;
|
|
if ($a['duration'] > $b['duration']) return 1;
|
|
});
|
|
|
|
// Output percentile times
|
|
$percentiles = [5, 25, 50, 75, 95, 99];
|
|
|
|
foreach ($percentiles as $percent)
|
|
{
|
|
$percent /= 100;
|
|
$idx = (int)(sizeof($results) * $percent);
|
|
echo str_pad($percent * 100, 3, ' ', STR_PAD_LEFT).' percentile: '.round($results[$idx]['duration'], 4).'s'.PHP_EOL;
|
|
}
|
|
|
|
// Output overall QPS
|
|
echo "QPS: ".round(sizeof($results) / DURATION, 2).PHP_EOL;
|
|
|
|
|