How to use pts_ae_data class

Best Phoronix-test-suite code snippet using pts_ae_data

pts_ae_data.php

Source:pts_ae_data.php Github

copy

Full Screen

...14 GNU General Public License for more details.15 You should have received a copy of the GNU General Public License16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class pts_ae_data19{20 private $db;21 private $ae_dir;22 public function __construct($output_dir)23 {24 if(!is_dir($output_dir))25 {26 echo 'valid directory needed!';27 return false;28 }29 $this->ae_dir = $output_dir . '/';30 $db_flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE;31 $this->db = new SQLite3($this->ae_dir . 'temp.db', $db_flags);32 $this->db->busyTimeout(10000);33 // TODO XXX make this a rootadmin option or something34 $this->db->exec('PRAGMA journal_mode = WAL');35 $this->db->exec('PRAGMA synchronous = OFF');36 pts_file_io::mkdir($this->ae_dir . 'comparison-hashes/');37 $result = $this->db->query('PRAGMA user_version;');38 $result = $result->fetchArray();39 $version = isset($result['user_version']) && is_numeric($result['user_version']) ? $result['user_version'] : 0;40 switch($version)41 {42 case 0:43 // Create44 $this->db->exec('CREATE TABLE `analytics_results` ( `ID` INTEGER PRIMARY KEY AUTOINCREMENT, `ResultReference` TEXT, `ComparisonHash` TEXT, `Component` INTEGER, `RelatedComponent` INTEGER, `DateTime` INTEGER, `SystemType` TEXT, `SystemLayer` TEXT, `Result` REAL NOT NULL);');45 $this->db->exec('CREATE INDEX `comp_hashes` ON `analytics_results` (`ComparisonHash`,`Result`);');46 $this->db->exec('CREATE INDEX `result_and_component_search` ON `analytics_results` (`ComparisonHash`,`Component`,`Result`);');47 $this->db->exec('CREATE TABLE `components` (`ComponentID` INTEGER PRIMARY KEY AUTOINCREMENT,`Component` TEXT UNIQUE,`Category` INTEGER,`TimesAppeared` INTEGER);');48 $this->db->exec('CREATE INDEX `quick` ON `components` ( `ComponentID`, `Component`);');49 $this->db->exec('CREATE INDEX `by_cat` ON `components` (`Component`,`Category`,`TimesAppeared`);');50 $this->db->exec('CREATE TABLE `component_categories` (`CategoryID` INTEGER PRIMARY KEY AUTOINCREMENT,`Category` TEXT UNIQUE);');51 $this->db->exec('CREATE INDEX `quick_cat` ON `component_categories` ( `CategoryID`, `Category`);');52 $this->db->exec('CREATE TABLE `composite` (`ComparisonHash` TEXT UNIQUE,`TestProfile` TEXT,`Title` TEXT,`ArgumentsDescription` TEXT,`HigherIsBetter` INTEGER,`SampleSize` INTEGER, Percentiles TEXT, FirstAppeared INTEGER, LastAppeared INTEGER, PRIMARY KEY(`ComparisonHash`));');53 $this->db->exec('CREATE INDEX `tp` ON `composite` (`TestProfile`);');54 $this->db->exec('CREATE UNIQUE INDEX `unq` ON `analytics_results` (`DateTime`,`Result`,`Component`,`RelatedComponent`,`ComparisonHash`);');55 //$this->db->exec('');56 //$this->db->exec('');57 //$this->db->exec('');58 $this->db->exec('PRAGMA user_version = 1');59 }60 return true;61 }62 public function insert_composite_hash_entry_by_result_object($comparison_hash, &$result_object)63 {64 $stmt = $this->db->prepare('INSERT OR IGNORE INTO composite (ComparisonHash, TestProfile, Title, ArgumentsDescription, HigherIsBetter) VALUES (:ch, :tp, :t, :ad, :hib)');65 $stmt->bindValue(':ch', $comparison_hash);66 $stmt->bindValue(':tp', $result_object->test_profile->get_identifier(false));67 $stmt->bindValue(':t', $result_object->test_profile->get_title());68 $stmt->bindValue(':ad', $result_object->get_arguments_description());69 $stmt->bindValue(':hib', ($result_object->test_profile->get_result_proportion() == 'HIB' ? 1 : 0));70 $result = $stmt->execute();71 }72 public function insert_result_into_analytic_results($comparison_hash, $result_reference, $component, $category, $related_component, $related_category, $result, $datetime, $system_type, $system_layer)73 {74 $stmt = $this->db->prepare('INSERT OR IGNORE INTO analytics_results (ComparisonHash, ResultReference, Component, RelatedComponent, Result, DateTime, SystemType, SystemLayer) VALUES (:ch, :rr, :c, :rc, :r, :dt, :st, :sl)');75 $stmt->bindValue(':ch', $comparison_hash);76 $stmt->bindValue(':rr', $result_reference);77 $stmt->bindValue(':c', $this->component_to_component_id($component, $category));78 $stmt->bindValue(':rc', $this->component_to_component_id($related_component, $related_category));79 $stmt->bindValue(':r', $result);80 $stmt->bindValue(':dt', $datetime);81 $stmt->bindValue(':st', $system_type);82 $stmt->bindValue(':sl', $system_layer);83 $result = $stmt->execute();84 }85 public function component_to_component_id($component, $category)86 {87 static $cache;88 if(isset($cache[$component][$category]))89 {90 return $cache[$component][$category];91 }92 $stmt = $this->db->prepare('SELECT ComponentID FROM components WHERE Component = :c LIMIT 1');93 $stmt->bindValue(':c', $component);94 $result = $stmt ? $stmt->execute() : false;95 if($result && ($row = $result->fetchArray()))96 {97 $cache[$component][$category] = $row['ComponentID'];98 return $row['ComponentID'];99 }100 $stmt = $this->db->prepare('INSERT OR IGNORE INTO components (Component, Category) VALUES (:component, :category)');101 $stmt->bindValue(':component', $component);102 $stmt->bindValue(':category', $this->category_to_category_id($category));103 $result = $stmt->execute();104 $cache[$component][$category] = $this->db->lastInsertRowid();105 return $cache[$component][$category];106 }107 public function component_id_to_component($component_id)108 {109 static $cache;110 if(isset($cache[$component_id]))111 {112 return $cache[$component_id];113 }114 $stmt = $this->db->prepare('SELECT Component FROM components WHERE ComponentID = :c LIMIT 1');115 $stmt->bindValue(':c', $component_id);116 $result = $stmt ? $stmt->execute() : false;117 if($result && ($row = $result->fetchArray()))118 {119 $cache[$component_id] = $row['Component'];120 return $cache[$component_id];121 }122 }123 public function category_to_category_id($category)124 {125 static $cache;126 if(isset($cache[$category]))127 {128 return $cache[$category];129 }130 $stmt = $this->db->prepare('SELECT CategoryID FROM component_categories WHERE Category = :c LIMIT 1');131 $stmt->bindValue(':c', $category);132 $result = $stmt ? $stmt->execute() : false;133 if($result && ($row = $result->fetchArray()))134 {135 $cache[$category] = $row['CategoryID'];136 return $row['CategoryID'];137 }138 $stmt = $this->db->prepare('INSERT OR IGNORE INTO component_categories (Category) VALUES (:category)');139 $stmt->bindValue(':category', $category);140 $result = $stmt->execute();141 $cache[$category] = $this->db->lastInsertRowid();142 return $cache[$category];143 }144 public function rebuild_composite_listing()145 {146 $stmt = $this->db->prepare('SELECT * FROM composite');147 $result = $stmt ? $stmt->execute() : false;148 while($result && ($row = $result->fetchArray()))149 {150 $comparison_hash = $row['ComparisonHash'];151 $first_appeared = 0;152 $last_appeared = 0;153 $component_results = array();154 $component_dates = array();155 $system_types = array();156 $results = $this->get_results_array_by_comparison_hash($comparison_hash, $first_appeared, $last_appeared, $component_results, $component_dates, $system_types);157 if(count($results) < 12)158 {159 continue;160 }161 $percentiles = array();162 for($i = 0; $i < 100; $i++)163 {164 $percentiles[$i] = pts_math::find_percentile($results, ($i * 0.01));165 }166 $peak = max($results);167 $component_data = array();168 $comparison_components = array();169 foreach($component_results as $component => $d)170 {171 if(stripos($component . ' ', 'device ') !== false || stripos($component, 'unknown') !== false || stripos($component, 'common ') !== false || is_numeric($component))172 {173 continue;174 }175 foreach($d as $related_component => $data)176 {177 if(!isset($comparison_components[$component]))178 {179 $comparison_components[$component] = array();180 }181 $comparison_components[$component] = array_merge($comparison_components[$component], $data);182 if(stripos($related_component . ' ', 'device ') !== false || stripos($related_component, 'unknown') !== false)183 {184 continue;185 }186 if($component_dates[$component][$related_component]['last_appeared'] < (time() - (31536000 * 3)))187 {188 // if no new results in 3 years, likely outdated...189 continue;190 }191 if(count($data) < 6)192 {193 continue;194 }195 $data = pts_math::remove_outliers($data);196 if(count($data) < 6)197 {198 continue;199 }200 $component_data[$component][$related_component]['avg'] = round(pts_math::arithmetic_mean($data), ($peak > 60 ? 0 : 2));201 $component_data[$component][$related_component]['samples'] = count($data);202 $component_data[$component][$related_component]['first_appeared'] = $component_dates[$component][$related_component]['first_appeared'];203 $component_data[$component][$related_component]['last_appeared'] = $component_dates[$component][$related_component]['last_appeared'];204 $component_data[$component][$related_component]['system_type'] = $system_types[$component][$related_component];205 }206 }207 foreach($comparison_components as $component => &$values)208 {209 $values = pts_math::remove_outliers($values);210 if(count($values) < 6)211 {212 unset($comparison_components[$component]);213 continue;214 }215 }216 uasort($comparison_components, array('pts_ae_data', 'sort_array_by_size_of_array_in_value'));217 $comparison_components = array_slice($comparison_components, 0, 60);218 foreach($comparison_components as $component => &$values)219 {220 $values = round(pts_math::arithmetic_mean($values), ($peak > 60 ? 0 : 2));221 }222 if($row['HigherIsBetter'] == '1')223 {224 arsort($comparison_components);225 }226 else227 {228 asort($comparison_components);229 }230 // JSON FILE...

Full Screen

Full Screen

pts_ae_data

Using AI Code Generation

copy

Full Screen

1require_once('pts_ae_data.php');2$pts_ae_data = new pts_ae_data();3$pts_ae_data->set_graph_title('My Graph');4$pts_ae_data->set_graph_subtitle('My Graph Subtitle');5$pts_ae_data->set_graph_type('line');6$pts_ae_data->set_graph_columns('Test Name', 'Result');7$pts_ae_data->set_graph_data('Test 1', 100);8$pts_ae_data->set_graph_data('Test 2', 200);9$pts_ae_data->set_graph_data('Test 3', 300);10$pts_ae_data->set_graph_data('Test 4', 400);11$pts_ae_data->set_graph_data('Test 5', 500);12$pts_ae_data->set_graph_data('Test 6', 600);13$pts_ae_data->set_graph_data('Test 7', 700);14$pts_ae_data->set_graph_data('Test 8', 800);15$pts_ae_data->set_graph_data('Test 9', 900);16$pts_ae_data->set_graph_data('Test 10', 1000);17$pts_ae_data->set_graph_data('Test 11', 1100);18$pts_ae_data->set_graph_data('Test 12', 1200);19$pts_ae_data->set_graph_data('Test 13', 1300);20$pts_ae_data->set_graph_data('Test 14', 1400);21$pts_ae_data->set_graph_data('Test 15', 1500);22$pts_ae_data->set_graph_data('Test 16', 1600);23$pts_ae_data->set_graph_data('Test 17', 1700);24$pts_ae_data->set_graph_data('Test 18', 1800);25$pts_ae_data->set_graph_data('Test 19', 1900);26$pts_ae_data->set_graph_data('Test 20', 2000);27$pts_ae_data->set_graph_data('Test 21', 2100);28$pts_ae_data->set_graph_data('Test 22', 2200);29$pts_ae_data->set_graph_data('Test 23', 2300);30$pts_ae_data->set_graph_data('Test 24', 2400

Full Screen

Full Screen

pts_ae_data

Using AI Code Generation

copy

Full Screen

1include_once('pts_ae_data.php');2$obj=new pts_ae_data();3$obj->get_data();4$obj->get_data_json();5include_once('pts_ae_data.php');6$obj=new pts_ae_data();7$obj->get_data();8$obj->get_data_json();9include_once('pts_ae_data.php');10$obj=new pts_ae_data();11$obj->get_data();12$obj->get_data_json();13include_once('pts_ae_data.php');14$obj=new pts_ae_data();15$obj->get_data();16$obj->get_data_json();17include_once('pts_ae_data.php');18$obj=new pts_ae_data();19$obj->get_data();20$obj->get_data_json();21include_once('pts_ae_data.php');22$obj=new pts_ae_data();

Full Screen

Full Screen

pts_ae_data

Using AI Code Generation

copy

Full Screen

1require_once('pts_ae_data.php');2$pts_ae_data = new pts_ae_data();3$pts_ae_data->set_title('Phoronix Test Suite - Advanced Edition');4$pts_ae_data->set_version('3.7.0');5$pts_ae_data->set_date('2018-03-10 00:00:00');6$pts_ae_data->set_suite('Phoronix Test Suite');7$pts_ae_data->set_suite_version('7.6.0');8$pts_ae_data->set_profile('system');9$pts_ae_data->set_profile_version('1.0.0');10$pts_ae_data->set_profile_description('This test profile is used to record system information.');11$pts_ae_data->set_profile_maintainer('Phoronix Media');12$pts_ae_data->set_profile_maintainer_email('

Full Screen

Full Screen

pts_ae_data

Using AI Code Generation

copy

Full Screen

1require_once('pts_ae_data.php');2$pts = new pts_ae_data();3$pts->set_test('pts/pts-1.0.0');4$pts->set_run('run-1');5$pts->set_user('user-1');6$pts->set_system('system-1');7$pts->set_result('result-1');8$pts->set_test_profile('test-profile-1');9$pts->set_result_profile('result-profile-1');10$pts->set_result_value('result-value-1');11$pts->set_result_date('result-date-1');12$pts->set_result_time('result-time

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful