From cdde0a752766707928750b7accc9b7ed15388535 Mon Sep 17 00:00:00 2001 From: Michael Larabel Date: Wed, 31 Dec 2008 10:43:04 -0500 Subject: system_monitor: When monitoring CPU usage, monitor the usage on each individual core (and still overall too) --- CHANGE-LOG | 1 + pts-core/modules/system_monitor.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CHANGE-LOG b/CHANGE-LOG index 75feb63..5d1f6cf 100644 --- a/CHANGE-LOG +++ b/CHANGE-LOG @@ -33,6 +33,7 @@ Phoronix Test Suite (Git) - bilde_renderer: Add experimental Adobe Flash / SWF renderer - bilde_renderer: Add a generic abstract GD library renderer and then have bilde_png_renderer extend that - bilde_renderer: Add a JPEG renderer using the GD library +- system_monitor: When monitoring CPU usage, monitor the usage on each individual core (and still overall too) Phoronix Test Suite 1.6.0 Beta 1 December 18, 2008 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")) { -- cgit