summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGE-LOG1
-rwxr-xr-xphoronix-test-suite6
-rw-r--r--pts-core/functions/pts-functions_monitor.php139
-rw-r--r--pts-core/pts-run-cmd.php3
4 files changed, 86 insertions, 63 deletions
diff --git a/CHANGE-LOG b/CHANGE-LOG
index ffee8a1..d2ad720 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -22,6 +22,7 @@ Phoronix Test Suite
- Clean-up information string parsing a bit
- When attempting to install a suite, just check if a unique benchmark is installed once, if the test is referenced multiple times
- Various code clean-ups and miscellaneous fixes
+- Add sensors option to report current sensor readings
Phoronix Test Suite 0.5.1
May 5, 2008
diff --git a/phoronix-test-suite b/phoronix-test-suite
index d646a0b..188f350 100755
--- a/phoronix-test-suite
+++ b/phoronix-test-suite
@@ -106,7 +106,11 @@ case "$1" in
"system-info" | "system-information")
$PHP_BIN pts-core/pts-run-cmd.php SYS_INFO
;;
-"sensors" | "sensor-options")
+"sensors")
+ export MONITOR=all
+ $PHP_BIN pts-core/pts-run-cmd.php SENSORS
+ ;;
+"sensor-options")
$PHP_BIN pts-core/pts-run-cmd.php SENSOR_OPTIONS
;;
"diagnostics")
diff --git a/pts-core/functions/pts-functions_monitor.php b/pts-core/functions/pts-functions_monitor.php
index fdc9cd3..6624e27 100644
--- a/pts-core/functions/pts-functions_monitor.php
+++ b/pts-core/functions/pts-functions_monitor.php
@@ -143,90 +143,105 @@ function pts_monitor_statistics()
}
$info_report = "";
- for($i = 0; $i < count($m_array); $i++)
- {
- // Calculate statistics
-
- if($i > 0)
- $info_report .= "\n\n";
-
- $low = 0;
- $high = 0;
- $total = 0;
- foreach($m_array[$i] as $temp)
+ if(count($m_array[0]) == 1)
+ {
+ $info_report .= "Current Sensor Readings:\n\n";
+ for($i = 0; $i < count($m_array); $i++)
{
- if($temp < $low || $low == 0)
- $low = $temp;
- else if($temp > $high)
- $high = $temp;
+ $info_report .= $device[$i] . " " . $type[$i] . " Monitor: " . $m_array[$i][0] . " " . $unit[$i];
- $total += $temp;
+ if($i < (count($m_array) - 1))
+ $info_report .= "\n";
}
- $avg = $total / count($m_array[$i]);
-
- $info_report .= $device[$i] . " " . $type[$i] . " Statistics:\n\nLow: " . pts_trim_double($low) . ' ' . $unit[$i] . "\nHigh: " . pts_trim_double($high) . ' ' . $unit[$i] . "\nAverage: " . pts_trim_double($avg) . ' ' . $unit[$i];
}
-
- if(trim($info_report) != "")
+ else
{
- if(pts_gd_available())
+ for($i = 0; $i < count($m_array); $i++)
{
- $url = "";
- pts_save_user_file();
- pts_save_user_file(null, null, "/pts-monitor-viewer/");
- pts_copy(RESULTS_VIEWER_DIR . "pts-monitor-viewer.html", PTS_MONITOR_DIR . "pts-monitor-viewer.html");
- pts_copy(RESULTS_VIEWER_DIR . "pts.js", PTS_MONITOR_DIR . "pts-monitor-viewer/pts.js");
- pts_copy(RESULTS_VIEWER_DIR . "pts-viewer.css", PTS_MONITOR_DIR . "pts-monitor-viewer/pts-viewer.css");
-
- $image_count = 0;
- foreach($type_index as $key => $sub_array)
+ // Calculate statistics
+
+ if($i > 0)
+ $info_report .= "\n\n";
+
+ $low = 0;
+ $high = 0;
+ $total = 0;
+
+ foreach($m_array[$i] as $temp)
{
- if(count($sub_array) > 0)
- {
- $graph_title = $type[$sub_array[0]] . " Monitor";
- $graph_unit = $unit[$sub_array[0]];
- $graph_unit = str_replace("°C", "Degrees Celsius", $graph_unit);
- $sub_title = date("F j, Y") . " - ";
+ if($temp < $low || $low == 0)
+ $low = $temp;
+ else if($temp > $high)
+ $high = $temp;
- if(isset($GLOBALS["TO_RUN"]))
- $sub_title .= $GLOBALS["TO_RUN"];
- else
- $sub_title .= date("g:i A");
+ $total += $temp;
+ }
+ $avg = $total / count($m_array[$i]);
- $t = new pts_LineGraph($graph_title, $sub_title, $graph_unit);
+ $info_report .= $device[$i] . " " . $type[$i] . " Statistics:\n\nLow: " . pts_trim_double($low) . ' ' . $unit[$i] . "\nHigh: " . pts_trim_double($high) . ' ' . $unit[$i] . "\nAverage: " . pts_trim_double($avg) . ' ' . $unit[$i];
+ }
- $first_run = true;
- foreach($sub_array as $id_point)
+ if(trim($info_report) != "")
+ {
+ if(pts_gd_available())
+ {
+ $url = "";
+ pts_save_user_file();
+ pts_save_user_file(null, null, "/pts-monitor-viewer/");
+ pts_copy(RESULTS_VIEWER_DIR . "pts-monitor-viewer.html", PTS_MONITOR_DIR . "pts-monitor-viewer.html");
+ pts_copy(RESULTS_VIEWER_DIR . "pts.js", PTS_MONITOR_DIR . "pts-monitor-viewer/pts.js");
+ pts_copy(RESULTS_VIEWER_DIR . "pts-viewer.css", PTS_MONITOR_DIR . "pts-monitor-viewer/pts-viewer.css");
+
+ $image_count = 0;
+ foreach($type_index as $key => $sub_array)
+ {
+ if(count($sub_array) > 0)
{
- $t->loadGraphValues($m_array[$id_point], $device[$id_point]);
+ $graph_title = $type[$sub_array[0]] . " Monitor";
+ $graph_unit = $unit[$sub_array[0]];
+ $graph_unit = str_replace("°C", "Degrees Celsius", $graph_unit);
+ $sub_title = date("F j, Y") . " - ";
- if($first_run)
+ if(isset($GLOBALS["TO_RUN"]))
+ $sub_title .= $GLOBALS["TO_RUN"];
+ else
+ $sub_title .= date("g:i A");
+
+ $t = new pts_LineGraph($graph_title, $sub_title, $graph_unit);
+
+ $first_run = true;
+ foreach($sub_array as $id_point)
{
- $t->loadGraphIdentifiers($m_array[$id_point]);
- $t->hideGraphIdentifiers();
- $first_run = false;
+ $t->loadGraphValues($m_array[$id_point], $device[$id_point]);
+
+ if($first_run)
+ {
+ $t->loadGraphIdentifiers($m_array[$id_point]);
+ $t->hideGraphIdentifiers();
+ $first_run = false;
+ }
}
- }
- $t->loadGraphVersion(PTS_VERSION);
- $t->save_graph(PTS_MONITOR_DIR . THIS_RUN_TIME . '-' . $image_count . ".png");
- $t->renderGraph();
- $url .= THIS_RUN_TIME . '-' . $image_count . ".png,";
- $image_count++;
+ $t->loadGraphVersion(PTS_VERSION);
+ $t->save_graph(PTS_MONITOR_DIR . THIS_RUN_TIME . '-' . $image_count . ".png");
+ $t->renderGraph();
+ $url .= THIS_RUN_TIME . '-' . $image_count . ".png,";
+ $image_count++;
+ }
}
}
}
+ }
- // terminal output
- echo pts_string_header($info_report);
+ // terminal output
+ echo pts_string_header($info_report);
- if(!empty($url))
- {
- file_put_contents(PTS_MONITOR_DIR . "link-latest.html", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><title>Phoronix Test Suite</title><meta http-equiv=\"REFRESH\" content=\"0;url=pts-monitor-viewer.html#$url\"></HEAD><BODY></BODY></HTML>
+ if(count($m_array[0]) > 1 && !empty($url))
+ {
+ file_put_contents(PTS_MONITOR_DIR . "link-latest.html", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><title>Phoronix Test Suite</title><meta http-equiv=\"REFRESH\" content=\"0;url=pts-monitor-viewer.html#$url\"></HEAD><BODY></BODY></HTML>
");
- display_web_browser(PTS_MONITOR_DIR . "link-latest.html");
- }
+ display_web_browser(PTS_MONITOR_DIR . "link-latest.html");
}
}
diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php
index efa5fd5..7a945a3 100644
--- a/pts-core/pts-run-cmd.php
+++ b/pts-core/pts-run-cmd.php
@@ -361,6 +361,9 @@ switch($COMMAND)
else
echo "\nPTS Global Account Not Found.\n";
break;
+ case "SENSORS":
+ pts_monitor_update();
+ break;
case "SENSOR_OPTIONS":
echo "\nThe Phoronix Test Suite supports monitoring various system hardware sensors through the LM_Sensors and ACPI interfaces. The Phoronix Test Suite will automatically monitor the selected sensors while each test is running and at the end will then provide the low and high thresholds for each sensor as well as the average. In addition, the sensor results are then plotted on line graphs and can be viewed through the PTS Results Viewer.\n";
echo "\nMonitoring these sensors are as easy as running your normal Phoronix Test Suite commands but at the beginning of the command add: MONITOR=<selected sensors> (example: MONITOR=cpu.temp,cpu.voltage phoronix-test-suite benchmark universe). Below are all of the sensors supported by this version of the Phoronix Test Suite.\n\n";