diff options
-rw-r--r-- | CHANGE-LOG | 7 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_cpu.php | 20 |
2 files changed, 19 insertions, 8 deletions
@@ -14,6 +14,7 @@ Phoronix Test Suite (Git) - pts-core: Add install-all-dependencies option to install all available external dependencies for that distribution - pts-core: When installing or running a test, only print to standard output if under 10KB - pts-core: Rewrite pts_remove() function +- pts-core: Allow reading CPU usage percent from individual cores - pts: Add UXA acceleration check to GtkPerf test note reporting - pts: Add 2d-test base profile that reports 2D acceleration mode using Cascading Test Profiles - pts: Add build-mysql test profile for timed build of MySQL 5.1 @@ -211,7 +212,7 @@ November 8, 2008 - pts: Add gcc-g++ to external dependencies support for Cent OS and Fedora (reported by pjwelsh) - pts: Report 2D EXA/XAA acceleration mode in the test notes when running gtkperf test -Phoronix Test Suite 1.4.0 +Phoronix Test Suite 1.4.0 "Orkdal" November 3, 2008 - pts-core: Improve RAM model/speed/type identification @@ -498,7 +499,7 @@ September 12, 2008 - pts: Have the fio test profile remove the dead iometer.1.0 file after testing - documentation: Fix typo in Debian APT sources file -Phoronix Test Suite 1.2.0 +Phoronix Test Suite 1.2.0 "Malvik" September 3, 2008 - pts-core: Fix for DEBUG_FILE not being detected @@ -807,7 +808,7 @@ June 28, 2008 - Add OpenSuSE External Dependencies support - Support PTS External Dependencies on non-LSB distributions -Phoronix Test Suite 1.0.1 +Phoronix Test Suite 1.0.1 "Trondheim" June 19, 2008 - Add encoding meta suite for all *-encoding suites diff --git a/pts-core/functions/pts-functions_system_cpu.php b/pts-core/functions/pts-functions_system_cpu.php index 7c72550..e099a34 100644 --- a/pts-core/functions/pts-functions_system_cpu.php +++ b/pts-core/functions/pts-functions_system_cpu.php @@ -302,11 +302,21 @@ function hw_cpu_current_frequency($cpu_core = 0) return $info; } -function hw_cpu_load_array() +function hw_cpu_load_array($read_core = -1) { // CPU load array $stat = @file_get_contents("/proc/stat"); - $stat = substr($stat, 0, strpos($stat, "\n")); + + if($read_core > -1 && ($l = strpos($stat, "cpu" . $read_core)) !== false) + { + $start_line = $l; + } + else + { + $start_line = 0; + } + + $stat = substr($stat, $start_line, strpos($stat, "\n")); $stat_break = explode(" ", $stat); $load = array(); @@ -317,12 +327,12 @@ function hw_cpu_load_array() return $load; } -function hw_cpu_usage() +function hw_cpu_usage($core = -1) { // Determine current percentage for processor usage - $start_load = hw_cpu_load_array(); + $start_load = hw_cpu_load_array($core); sleep(1); - $end_load = hw_cpu_load_array(); + $end_load = hw_cpu_load_array($core); for($i = 0; $i < count($end_load); $i++) { |