summaryrefslogtreecommitdiffstats
path: root/pts-core
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-12-31 10:43:04 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-12-31 10:43:04 -0500
commitcdde0a752766707928750b7accc9b7ed15388535 (patch)
treebb25a9482c4957552c97b93759f0fd3aab48a5e8 /pts-core
parent37ec79012e0155da34eb8b3bbb1d9f195945c415 (diff)
downloadphoronix-test-suite-upstream-cdde0a752766707928750b7accc9b7ed15388535.tar.gz
phoronix-test-suite-upstream-cdde0a752766707928750b7accc9b7ed15388535.tar.xz
phoronix-test-suite-upstream-cdde0a752766707928750b7accc9b7ed15388535.zip
system_monitor: When monitoring CPU usage, monitor the usage on each
individual core (and still overall too)
Diffstat (limited to 'pts-core')
-rw-r--r--pts-core/modules/system_monitor.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/pts-core/modules/system_monitor.php b/pts-core/modules/system_monitor.php
index c26199e..f313d3b 100644
--- a/pts-core/modules/system_monitor.php
+++ b/pts-core/modules/system_monitor.php
@@ -123,6 +123,14 @@ class system_monitor extends pts_module_interface
{
pts_set_assignment("MONITOR_CPU_USAGE", 1);
pts_module::save_file(".s/CPU_USAGE");
+
+ if(($cpu_count = hw_cpu_core_count()) > 1)
+ {
+ for($i = 0; $i < $cpu_count; $i++)
+ {
+ pts_module::save_file(".s/CPU_USAGE_" . $i);
+ }
+ }
}
if(in_array("system.memory", $to_show) || $monitor_memory)
{
@@ -331,6 +339,20 @@ class system_monitor extends pts_module_interface
array_push($m_array, $this_array);
array_push($type_index["USAGE"], count($m_array) - 1);
}
+
+ for($i = 0; $i < hw_cpu_core_count() && pts_module::is_file(".s/CPU_USAGE_" . $i); $i++)
+ {
+ $this_array = self::parse_monitor_log(".s/CPU_USAGE_" . $i);
+
+ if(is_array($this_array) && !empty($this_array[0]))
+ {
+ array_push($device, "CPU " . ($i + 1));
+ array_push($type, "Usage");
+ array_push($unit, "Percent");
+ array_push($m_array, $this_array);
+ array_push($type_index["USAGE"], count($m_array) - 1);
+ }
+ }
}
if(pts_is_assignment("MONITOR_SYS_MEMORY"))
{
@@ -585,6 +607,14 @@ class system_monitor extends pts_module_interface
if($usage != -1)
pts_module::save_file(".s/CPU_USAGE", $usage, true);
+
+ for($i = 0; $i < hw_cpu_core_count() && pts_module::is_file(".s/CPU_USAGE_" . $i); $i++)
+ {
+ $usage = hw_cpu_usage($i);
+
+ if($usage != -1)
+ pts_module::save_file(".s/CPU_USAGE_" . $i, $usage, true);
+ }
}
if(pts_is_assignment("MONITOR_SYS_MEMORY"))
{