summaryrefslogtreecommitdiffstats
path: root/pts-core
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-10-09 14:26:21 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-10-09 14:26:21 -0400
commit7a0fa4ad29350dcef6bef7972e5724f0b45520d8 (patch)
treebffe5d28cab31aec1238e1eb11559f8afad427ad /pts-core
parentf62ec5fbb084d26220d928d7b54f51641ab1ab85 (diff)
downloadphoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.tar.gz
phoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.tar.xz
phoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.zip
pts-core: Keep a running average how long it takes to run a given test.
This is stored in the AverageRunTime tag within the pts-install.xml
Diffstat (limited to 'pts-core')
-rw-r--r--pts-core/functions/pts-functions-run.php7
-rw-r--r--pts-core/functions/pts-functions_tests.php15
-rw-r--r--pts-core/functions/pts-interfaces.php1
3 files changed, 20 insertions, 3 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
index 5f019a2..331eb94 100644
--- a/pts-core/functions/pts-functions-run.php
+++ b/pts-core/functions/pts-functions-run.php
@@ -469,6 +469,9 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri
$extra_runtime_variables = pts_run_additional_vars($test_identifier);
+ // Start
+
+ $time_test_start = time();
if(is_file(pts_location_test_resources($test_identifier) . "pre.sh"))
{
echo "\nRunning Pre-Test Scripts...\n";
@@ -552,6 +555,8 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri
}
// End
+ $time_test_end = time();
+
if(empty($result_scale) && is_file($test_directory . "pts-results-scale"))
$result_scale = trim(@file_get_contents($test_directory . "pts-results-scale"));
@@ -671,7 +676,7 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri
pts_process_remove($test_identifier);
pts_module_process("__post_test_run");
- pts_test_refresh_install_xml($test_identifier);
+ pts_test_refresh_install_xml($test_identifier, ($time_test_end - $time_test_start));
// 0 = main end result
return array($END_RESULT);
diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php
index 795f6e5..8152490 100644
--- a/pts-core/functions/pts-functions_tests.php
+++ b/pts-core/functions/pts-functions_tests.php
@@ -97,7 +97,7 @@ function pts_test_generate_install_xml($identifier)
file_put_contents(TEST_ENV_DIR . $identifier . "/pts-install.xml", $xml_writer->getXML());
}
-function pts_test_refresh_install_xml($identifier)
+function pts_test_refresh_install_xml($identifier, $this_test_duration = 0)
{
// Refresh the pts-install.xml for a test
if(is_file(TEST_ENV_DIR . $identifier . "/pts-install.xml"))
@@ -105,12 +105,23 @@ function pts_test_refresh_install_xml($identifier)
$xml_parser = new tandem_XmlReader(TEST_ENV_DIR . $identifier . "/pts-install.xml", FALSE);
$xml_writer = new tandem_XmlWriter();
+ $test_duration = $xml_parser->getXMLValue(P_INSTALL_TEST_AVG_RUNTIME);
+ if(!is_numeric($test_duration))
+ {
+ $test_duration = $this_test_duration;
+ }
+ if(is_numeric($this_test_duration) && $this_test_duration > 0)
+ {
+ $test_duration = ceil((($test_duration * $xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN)) + $this_test_duration) / ($xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1));
+ }
+
$xml_writer->addXmlObject(P_INSTALL_TEST_NAME, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_NAME));
$xml_writer->addXmlObject(P_INSTALL_TEST_VERSION, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_VERSION));
$xml_writer->addXmlObject(P_INSTALL_TEST_CHECKSUM, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_CHECKSUM));
$xml_writer->addXmlObject(P_INSTALL_TEST_INSTALLTIME, 2, $xml_parser->getXMLValue(P_INSTALL_TEST_INSTALLTIME));
$xml_writer->addXmlObject(P_INSTALL_TEST_LASTRUNTIME, 2, date("Y-m-d H:i:s"));
- $xml_writer->addXmlObject(P_INSTALL_TEST_TIMESRUN, 2, $xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1);
+ $xml_writer->addXmlObject(P_INSTALL_TEST_TIMESRUN, 2, ($xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1));
+ $xml_writer->addXmlObject(P_INSTALL_TEST_AVG_RUNTIME, 2, $test_duration, 2);
file_put_contents(TEST_ENV_DIR . $identifier . "/pts-install.xml", $xml_writer->getXML());
return TRUE;
diff --git a/pts-core/functions/pts-interfaces.php b/pts-core/functions/pts-interfaces.php
index 05767d6..6e6d883 100644
--- a/pts-core/functions/pts-interfaces.php
+++ b/pts-core/functions/pts-interfaces.php
@@ -217,6 +217,7 @@ define("P_INSTALL_TEST_CHECKSUM", "PhoronixTestSuite/TestInstallation/Environmen
define("P_INSTALL_TEST_INSTALLTIME", "PhoronixTestSuite/TestInstallation/History/InstallTime"); // Time of test install
define("P_INSTALL_TEST_LASTRUNTIME", "PhoronixTestSuite/TestInstallation/History/LastRunTime"); // Time the test last run
define("P_INSTALL_TEST_TIMESRUN", "PhoronixTestSuite/TestInstallation/History/TimesRun"); // Time the test last run
+define("P_INSTALL_TEST_AVG_RUNTIME", "PhoronixTestSuite/TestInstallation/History/AverageRunTime"); // The average time (in Seconds) it takes to run the test
//
// GRAPH CONFIGURATION SPECIFICATION