summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-16 22:29:42 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-16 22:29:42 -0500
commit07c42ac2bf928678519d8a57f5007549372a26ad (patch)
tree36a729519dd8ac9f47298321a6547ef74f55ae8d
parent08b701ba71e3ac4861e51f575477e491ff8db88b (diff)
downloadphoronix-test-suite-upstream-07c42ac2bf928678519d8a57f5007549372a26ad.tar.gz
phoronix-test-suite-upstream-07c42ac2bf928678519d8a57f5007549372a26ad.tar.xz
phoronix-test-suite-upstream-07c42ac2bf928678519d8a57f5007549372a26ad.zip
pts-core: Use static variable for PTS type caching
-rw-r--r--TYDAL-CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions_types.php51
2 files changed, 23 insertions, 29 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG
index ae56577..a2675f2 100644
--- a/TYDAL-CHANGE-LOG
+++ b/TYDAL-CHANGE-LOG
@@ -31,4 +31,5 @@ Phoronix Test Suite (Git)
- pts-core: Fix for URL empty bug (reported by Stef Telford and Bene18)
- pts-core: Drop ArgumentName profile tag code that's been deprecated since PTS 1.4+ in favor of ArgumentPrefix
- pts-core: Add SearchMediaForCache option that's enabled by default in user-config.xml to automatically search for download caches on removable devices (mounted within /media/)
+- pts-core: Use static variable for PTS type caching
- tandem_XmlReader: Switch caching from using a GLOBALS variable to using a static variable within the XML reading class
diff --git a/pts-core/functions/pts-functions_types.php b/pts-core/functions/pts-functions_types.php
index 5c88dfa..30525da 100644
--- a/pts-core/functions/pts-functions_types.php
+++ b/pts-core/functions/pts-functions_types.php
@@ -46,11 +46,9 @@ function is_test($object)
function pts_test_type($identifier)
{
// Determine type of test based on identifier
- if(isset($GLOBALS["PTS_VAR_CACHE"]["TEST_TYPE"][$identifier]))
- {
- $test_type = $GLOBALS["PTS_VAR_CACHE"]["TEST_TYPE"][$identifier];
- }
- else
+ static $cache;
+
+ if(!isset($cache[$identifier]))
{
$test_type = false;
@@ -92,22 +90,21 @@ function pts_test_type($identifier)
{
$test_type = TYPE_BASE_TEST;
}
-
- $GLOBALS["PTS_VAR_CACHE"]["TEST_TYPE"][$identifier] = $test_type;
}
+
+ $cache[$identifier] = $test_type;
}
- return $test_type;
+ return $cache[$identifier];
}
function pts_location_suite($identifier)
{
- if(isset($GLOBALS["PTS_VAR_CACHE"]["SUITE_LOCATION"][$identifier]))
- {
- $location = $GLOBALS["PTS_VAR_CACHE"]["SUITE_LOCATION"][$identifier];
- }
- else
+ static $cache;
+
+ if(!isset($cache[$identifier]))
{
$location = false;
+
if(is_suite($identifier))
{
$type = pts_test_type($identifier);
@@ -122,18 +119,16 @@ function pts_location_suite($identifier)
}
}
- $GLOBALS["PTS_VAR_CACHE"]["SUITE_LOCATION"][$identifier] = $location;
+ $cache[$identifier] = $location;
}
- return $location;
+ return $cache[$identifier];
}
function pts_location_test($identifier)
{
- if(isset($GLOBALS["PTS_VAR_CACHE"]["TEST_LOCATION"][$identifier]))
- {
- $location = $GLOBALS["PTS_VAR_CACHE"]["TEST_LOCATION"][$identifier];
- }
- else
+ static $cache;
+
+ if(!isset($cache[$identifier]))
{
$location = false;
@@ -171,18 +166,16 @@ function pts_location_test($identifier)
}
}
- $GLOBALS["PTS_VAR_CACHE"]["TEST_LOCATION"][$identifier] = $location;
+ $cache[$identifier] = $location;
}
- return $location;
+ return $cache[$identifier];
}
function pts_location_test_resources($identifier)
{
- if(isset($GLOBALS["PTS_VAR_CACHE"]["TEST_RESOURCE_LOCATION"][$identifier]))
- {
- $location = $GLOBALS["PTS_VAR_CACHE"]["TEST_RESOURCE_LOCATION"][$identifier];
- }
- else
+ static $cache;
+
+ if(!isset($cache[$identifier]))
{
$location = false;
@@ -220,10 +213,10 @@ function pts_location_test_resources($identifier)
}
}
- $GLOBALS["PTS_VAR_CACHE"]["TEST_RESOURCE_LOCATION"][$identifier] = $location;
+ $cache[$identifier] = $location;
}
- return $location;
+ return $cache[$identifier];
}
function pts_test_extends_below($object)
{