summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-functions_system_parsing.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-19 20:55:20 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-19 20:55:20 -0500
commit9ca322fe212ee1323ccb96727392f339e6f387f1 (patch)
tree1a0e001419b1f2e2585c2dc1efb342487376398a /pts-core/functions/pts-functions_system_parsing.php
parentbbe8de3303639275ace58eb615678100629e1b70 (diff)
downloadphoronix-test-suite-upstream-9ca322fe212ee1323ccb96727392f339e6f387f1.tar.gz
phoronix-test-suite-upstream-9ca322fe212ee1323ccb96727392f339e6f387f1.tar.xz
phoronix-test-suite-upstream-9ca322fe212ee1323ccb96727392f339e6f387f1.zip
pts-core: Add internal caching support for lspci and lsb_release
information
Diffstat (limited to 'pts-core/functions/pts-functions_system_parsing.php')
-rw-r--r--pts-core/functions/pts-functions_system_parsing.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php
index edaad5a..0484022 100644
--- a/pts-core/functions/pts-functions_system_parsing.php
+++ b/pts-core/functions/pts-functions_system_parsing.php
@@ -144,9 +144,13 @@ function read_sensors($attributes)
function read_pci($desc, $clean_string = true)
{
// Read PCI bus information
- $pci_info = shell_exec("lspci 2>&1");
+ static $pci_info = null;
$info = "Unknown";
+ if(empty($pci_info))
+ {
+ $pci_info = shell_exec("lspci 2>&1");
+ }
if(!is_array($desc))
{
$desc = array($desc);
@@ -199,17 +203,22 @@ function read_pci($desc, $clean_string = true)
function read_lsb($desc)
{
// Read LSB Release information, Linux Standards Base
- $info = shell_exec("lsb_release -a 2>&1");
+ static $output = null;
- if(($pos = strrpos($info, $desc . ':')) === false)
+ if(empty($output))
{
- $info = "Unknown";
+ $output = shell_exec("lsb_release -a 2>&1");
}
- else
+
+ if(($pos = strrpos($output, $desc . ":")) !== false)
{
- $info = substr($info, $pos + strlen($desc) + 1);
+ $info = substr($output, $pos + strlen($desc) + 1);
$info = trim(substr($info, 0, strpos($info, "\n")));
}
+ else
+ {
+ $info = "Unknown";
+ }
return $info;
}