summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-functions_system_cpu.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-20 17:50:34 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-20 17:50:34 -0500
commit17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc (patch)
tree8ef926c100cd06b30feecc4a5a111786e3f73f97 /pts-core/functions/pts-functions_system_cpu.php
parent82fbbacb2bee2874f120d1562976d7dd5339310e (diff)
downloadphoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.tar.gz
phoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.tar.xz
phoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.zip
pts-core: Return false on failure from read_sysctl() instead of
"Unknown" string
Diffstat (limited to 'pts-core/functions/pts-functions_system_cpu.php')
-rw-r--r--pts-core/functions/pts-functions_system_cpu.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/pts-core/functions/pts-functions_system_cpu.php b/pts-core/functions/pts-functions_system_cpu.php
index 1244155..e26538b 100644
--- a/pts-core/functions/pts-functions_system_cpu.php
+++ b/pts-core/functions/pts-functions_system_cpu.php
@@ -24,6 +24,8 @@
function hw_cpu_core_count()
{
// Returns number of cores present on the system
+ $info = null;
+
if(IS_LINUX)
{
$processors = read_cpuinfo("processor");
@@ -43,7 +45,8 @@ function hw_cpu_core_count()
{
$info = read_osx_system_profiler("SPHardwareDataType", "TotalNumberOfCores");
}
- else
+
+ if(empty($info))
{
$info = 1;
}
@@ -125,6 +128,11 @@ function hw_cpu_string()
else if(IS_BSD)
{
$info = read_sysctl("hw.model");
+
+ if(empty($info))
+ {
+ $info = "Unknown";
+ }
}
else if(IS_MACOSX)
{