diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-10-02 15:59:24 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-10-02 15:59:24 -0400 |
commit | 068aec3e0a19280fd87de1769ad59f3fc7766ca5 (patch) | |
tree | 9f46d8b3eefb06855ffe7c92d476c9bc1501bdbe /pts-core/functions/pts-functions_system_cpu.php | |
parent | 7595c419551ca9b9632a84c1de40ff806b0066bf (diff) | |
download | phoronix-test-suite-upstream-068aec3e0a19280fd87de1769ad59f3fc7766ca5.tar.gz phoronix-test-suite-upstream-068aec3e0a19280fd87de1769ad59f3fc7766ca5.tar.xz phoronix-test-suite-upstream-068aec3e0a19280fd87de1769ad59f3fc7766ca5.zip |
pts-core: Add support for reading software and hardware information on
Mac OS X
Diffstat (limited to 'pts-core/functions/pts-functions_system_cpu.php')
-rw-r--r-- | pts-core/functions/pts-functions_system_cpu.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pts-core/functions/pts-functions_system_cpu.php b/pts-core/functions/pts-functions_system_cpu.php index bf8cf48..eea6f02 100644 --- a/pts-core/functions/pts-functions_system_cpu.php +++ b/pts-core/functions/pts-functions_system_cpu.php @@ -39,9 +39,13 @@ function cpu_core_count() { $info = read_sysctl("hw.ncpu"); } + else if(IS_MACOSX) + { + $info = read_osx_system_profiler("SPHardwareDataType", "TotalNumberOfCores"); + } else { - $processors = 1; + $info = 1; } return $info; @@ -115,6 +119,12 @@ function processor_string() $info = read_sysctl("hw.model"); $info = append_processor_frequency(pts_clean_information_string($info), 0); } + else if(IS_MACOSX) + { + $info = read_osx_system_profiler("SPHardwareDataType", "ProcessorName"); + $info = append_processor_frequency(pts_clean_information_string($info), 0); + + } else $info = "Unknown"; } @@ -232,6 +242,15 @@ function current_processor_frequency($cpu_core = 0) $info = read_sysctl("dev.cpu.0.freq"); $info = pts_trim_double(intval($info) / 1000, 2); } + else if(IS_MACOSX) + { + $info = read_osx_system_profiler("SPHardwareDataType", "ProcessorSpeed"); + + if(($cut_point = strpos($info, " ")) > 0) + $info = substr($info, 0, $cut_point); + + $info = pts_trim_double($info, 2); + } else $info = 0; |