Skip to content

Commit

Permalink
Working on output of stats (not yet working)
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Aug 17, 2018
1 parent 41658c6 commit ade2aa2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions info2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ switch($argv[1]) {
echo "Usage: nems-info phoronix [$usage]" . PHP_EOL;
exit();
}
if (is_array($loglist)) {
if (isset($loglist) && is_array($loglist)) {
foreach ($loglist as $file) {
$tmp = explode($logdir,$file);
$tmp = array_filter(explode($logfile,$tmp[1]));
$date = strtotime(str_replace('/','',$tmp[0]));
$logs[$date] = $file;
}
if (is_array($logs)) {
if (isset($logs) && is_array($logs)) {
ksort($logs); // sort to ensure oldest is first (so value overwrites)

function check_test($title,$tests) {
Expand All @@ -125,9 +125,12 @@ switch($argv[1]) {
}

foreach ($logs as $date => $log) {
$data = new SimpleXMLElement(file_get_contents($log));
$dataobj = new SimpleXMLElement(file_get_contents($log));

foreach ($dataobj as $data) {
if (check_test(strtolower($data->Result->Title),$tests)) {
if ($argv[2] == 'all') {
echo 'hi';
$count=0; foreach ($data->Result as $dataresult) { $count++; } // YES, I am being lazy.
foreach ($data->Result as $dataresult) {
if ($count > 1) { // use the one labeled "average"
Expand All @@ -146,21 +149,25 @@ switch($argv[1]) {
}
ksort($resulttmp);
$result = json_encode($resulttmp);
break;
} else {
if (check_test(strtolower($data->Result->Title),$argv[2])) {
$count=0; foreach ($data->Result as $dataresult) { $count++; } // YES, I am being lazy.
foreach ($data->Result as $dataresult) {
if ($count > 1) { // use the one labeled "average"
if (check_test(strtolower($dataresult->Description),'average')) {
$result = floatval($dataresult->Data->Entry->Value);
break;
}
} else {
$result = floatval($dataresult->Data->Entry->Value);
break;
}
}
}
}
}
}
}
if (isset($result)) {
echo $result;
Expand Down

0 comments on commit ade2aa2

Please sign in to comment.