summaryrefslogtreecommitdiffstats
path: root/pts-core/objects
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-12 10:56:20 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-13 10:34:15 -0500
commit72f293390c761244fb439f8d245654790a7f6fa6 (patch)
tree08a9a7a6d91c7cd7a92706577be84b92400403eb /pts-core/objects
parent50c345b8d7288f5014dbce77d94226fce4a974d5 (diff)
downloadphoronix-test-suite-upstream-72f293390c761244fb439f8d245654790a7f6fa6.tar.gz
phoronix-test-suite-upstream-72f293390c761244fb439f8d245654790a7f6fa6.tar.xz
phoronix-test-suite-upstream-72f293390c761244fb439f8d245654790a7f6fa6.zip
pts-core: Add pts_test_usage_details class
Diffstat (limited to 'pts-core/objects')
-rw-r--r--pts-core/objects/pts-generic-classes.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/pts-core/objects/pts-generic-classes.php b/pts-core/objects/pts-generic-classes.php
index d6c3d68..e19e93c 100644
--- a/pts-core/objects/pts-generic-classes.php
+++ b/pts-core/objects/pts-generic-classes.php
@@ -212,6 +212,52 @@ class pts_installed_test_details
return $str;
}
}
+class pts_test_usage_details
+{
+ var $identifier;
+ var $install_time;
+ var $last_run_time;
+ var $installed_version;
+ var $average_run_time;
+ var $times_run;
+
+ public function __construct($identifier)
+ {
+ $xml_parser = new tandem_XmlReader(TEST_ENV_DIR . $identifier . "/pts-install.xml");
+ $this->identifier = $identifier;
+ $this->install_time = substr($xml_parser->getXMLValue(P_INSTALL_TEST_INSTALLTIME), 0, 10);
+ $this->last_run_time = substr($xml_parser->getXMLValue(P_INSTALL_TEST_LASTRUNTIME), 0, 10);
+ $this->installed_version = $xml_parser->getXMLValue(P_INSTALL_TEST_VERSION);
+ $this->average_run_time = pts_format_time_string($xml_parser->getXMLValue(P_INSTALL_TEST_AVG_RUNTIME), "SECONDS", false);
+ $this->times_run = $xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN);
+
+ if($this->last_run_time == "0000-00-00" || $this->install_time == $this->last_run_time)
+ {
+ $this->last_run_time = "NEVER";
+ $this->times_run = "";
+ }
+
+ if(empty($this->times_run))
+ {
+ $this->times_run = 0;
+ }
+ if(empty($this->average_run_time))
+ {
+ $this->average_run_time = "N/A";
+ }
+ }
+ public function __toString()
+ {
+ $str = "";
+
+ if(!empty($this->installed_version))
+ {
+ $str = sprintf("%-18ls - %-8ls %-13ls %-11ls %-13ls %-10ls\n", $this->identifier, $this->installed_version, $this->install_time, $this->last_run_time, $this->average_run_time, $this->times_run);
+ }
+
+ return $str;
+ }
+}
class pts_test_result
{
var $result;