How to use component_id_to_component method of pts_ae_data class

Best Phoronix-test-suite code snippet using pts_ae_data.component_id_to_component

pts_ae_data.php

Source:pts_ae_data.php Github

copy

Full Screen

...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 FILE231 $json = array();232 $json['comparison_hash'] = $comparison_hash;233 $json['test_profile'] = $row['TestProfile'];234 $json['title'] = $row['Title'];235 $json['description'] = $row['ArgumentsDescription'];236 $json['hib'] = $row['HigherIsBetter'];237 $json['samples'] = count($results);238 $json['first_appeared'] = $first_appeared;239 $json['last_appeared'] = $last_appeared;240 $json['percentiles'] = $percentiles;241 $json['components'] = $component_data;242 $json['reference_results'] = $comparison_components;243 $json = json_encode($json);244 if(!empty($json))245 {246 $test_dir = base64_encode($row['TestProfile']);247 pts_file_io::mkdir($this->ae_dir . 'comparison-hashes/' . $test_dir . '/');248 file_put_contents($this->ae_dir . 'comparison-hashes/' . $test_dir . '/' . $comparison_hash . '.json', $json);249 }250 // EO JSON251 $stmt = $this->db->prepare('UPDATE composite SET SampleSize = :ss, Percentiles = :p, FirstAppeared = :fa, LastAppeared = :la WHERE ComparisonHash = :ch');252 $stmt->bindValue(':ss', count($results));253 $stmt->bindValue(':ch', $comparison_hash);254 $stmt->bindValue(':p', implode(',', $percentiles));255 $stmt->bindValue(':fa', $first_appeared);256 $stmt->bindValue(':la', $last_appeared);257 $stmt->execute();258 }259 }260 public function sort_array_by_size_of_array_in_value($a, $b)261 {262 return count($b) - count($a);263 }264 public function get_results_array_by_comparison_hash($ch, &$first_appeared, &$last_appeared, &$component_results, &$component_dates, &$system_types)265 {266 $stmt = $this->db->prepare('SELECT Result, DateTime, Component, RelatedComponent, SystemType, SystemLayer FROM analytics_results WHERE ComparisonHash = :ch');267 $stmt->bindValue(':ch', $ch);268 $result = $stmt ? $stmt->execute() : false;269 $results = array();270 $first_appeared = time();271 $last_appeared = 0;272 while($result && ($row = $result->fetchArray()))273 {274 if(!is_numeric($row['Result']))275 {276 continue;277 }278 $dt = $row['DateTime'];279 if($dt < $first_appeared)280 {281 $first_appeared = $dt;282 }283 else if($dt > $last_appeared || $last_appeared == 0)284 {285 $last_appeared = $dt;286 }287 $results[] = $row['Result'];288 if(!empty($row['SystemLayer']) || strlen($row['Component']) < 3)289 {290 continue;291 }292 $c = $this->component_id_to_component($row['Component']);293 $rc = $this->component_id_to_component($row['RelatedComponent']);294 if(!isset($component_results[$c][$rc]))295 {296 $component_results[$c][$rc] = array();297 }298 $component_results[$c][$rc][] = $row['Result'];299 if(!isset($component_dates[$c][$rc]))300 {301 $component_dates[$c][$rc] = array('first_appeared' => $dt, 'last_appeared' => $dt);302 }303 else304 {305 $component_dates[$c][$rc]['first_appeared'] = min($component_dates[$c][$rc]['first_appeared'], $dt);306 $component_dates[$c][$rc]['last_appeared'] = max($component_dates[$c][$rc]['last_appeared'], $dt);307 }...

Full Screen

Full Screen

component_id_to_component

Using AI Code Generation

copy

Full Screen

1require_once('pts_ae_data.php');2$pts_ae_data = new pts_ae_data();3$component_id = 1;4$component = $pts_ae_data->component_id_to_component($component_id);5echo $component;6require_once('pts_ae_data.php');7$pts_ae_data = new pts_ae_data();8$component_id = 2;9$component = $pts_ae_data->component_id_to_component($component_id);10echo $component;11require_once('pts_ae_data.php');12$pts_ae_data = new pts_ae_data();13$component_id = 3;14$component = $pts_ae_data->component_id_to_component($component_id);15echo $component;16require_once('pts_ae_data.php');17$pts_ae_data = new pts_ae_data();18$component_id = 4;19$component = $pts_ae_data->component_id_to_component($component_id);20echo $component;21require_once('pts_ae_data.php');22$pts_ae_data = new pts_ae_data();23$component_id = 5;24$component = $pts_ae_data->component_id_to_component($component_id);25echo $component;26require_once('pts_ae_data.php');27$pts_ae_data = new pts_ae_data();28$component_id = 6;29$component = $pts_ae_data->component_id_to_component($component_id);30echo $component;31require_once('pts_ae_data.php');32$pts_ae_data = new pts_ae_data();33$component_id = 7;34$component = $pts_ae_data->component_id_to_component($component_id);35echo $component;

Full Screen

Full Screen

component_id_to_component

Using AI Code Generation

copy

Full Screen

1include_once "pts_ae_data.php";2$pts_ae_data = new pts_ae_data();3$component_id = 1;4$component = $pts_ae_data->component_id_to_component($component_id);5echo "Component name for component id $component_id is $component";6include_once "pts_ae_data.php";7$pts_ae_data = new pts_ae_data();8$component = "component 1";9$component_id = $pts_ae_data->component_to_component_id($component);10echo "Component id for component $component is $component_id";11include_once "pts_ae_data.php";12$pts_ae_data = new pts_ae_data();13$component_id = 1;14$component_description = $pts_ae_data->component_id_to_component_description($component_id);15echo "Component description for component id $component_id is $component_description";16include_once "pts_ae_data.php";17$pts_ae_data = new pts_ae_data();18$component_id = 1;19$component_version = $pts_ae_data->component_id_to_component_version($component_id);20echo "Component version for component id $component_id is $component_version";

Full Screen

Full Screen

component_id_to_component

Using AI Code Generation

copy

Full Screen

1$component_id = $ae_data->component_id_to_component($component_name);2$component_id = $ae_data->component_id_to_component($component_name);3$component_id = $ae_data->component_id_to_component($component_name);4$component_id = $ae_data->component_id_to_component($component_name);5$component_id = $ae_data->component_id_to_component($component_name);6$component_id = $ae_data->component_id_to_component($component_name);7$component_id = $ae_data->component_id_to_component($component_name);

Full Screen

Full Screen

component_id_to_component

Using AI Code Generation

copy

Full Screen

1require_once("pts_ae_data.php");2$pts_ae_data = new pts_ae_data();3$component_name = $pts_ae_data->component_id_to_component("1");4echo $component_name;5$component_name = $pts_ae_data->component_id_to_component("2");6echo $component_name;7$component_name = $pts_ae_data->component_id_to_component("3");8echo $component_name;9$component_name = $pts_ae_data->component_id_to_component("4");10echo $component_name;11$component_name = $pts_ae_data->component_id_to_component("5");12echo $component_name;13$component_name = $pts_ae_data->component_id_to_component("6");14echo $component_name;15$component_name = $pts_ae_data->component_id_to_component("7");16echo $component_name;17$component_name = $pts_ae_data->component_id_to_component("8");18echo $component_name;19$component_name = $pts_ae_data->component_id_to_component("9");20echo $component_name;21$component_name = $pts_ae_data->component_id_to_component("10");22echo $component_name;23$component_name = $pts_ae_data->component_id_to_component("11");24echo $component_name;25$component_name = $pts_ae_data->component_id_to_component("12");26echo $component_name;27$component_name = $pts_ae_data->component_id_to_component("13");28echo $component_name;

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.

Trigger component_id_to_component code on LambdaTest Cloud Grid

Execute automation tests with component_id_to_component on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

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