Best Phoronix-test-suite code snippet using pts_result_file_analyzer.compact_result_table_data
pts_result_file_analyzer.php
Source:pts_result_file_analyzer.php
...58 // The software is being maintained, but the hardware is being flipped out59 $rows = array();60 $data = array();61 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $hw);62 pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);63 $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(64 array('Processor', 'Motherboard', 'Chipset', 'Audio', 'Network'), // Processor comparison65 array('Processor', 'Motherboard', 'Chipset', 'Network'), // Processor comparison66 array('Processor', 'Chipset', 'Graphics'),67 array('Processor', 'Graphics'),68 array('Processor', 'Chipset'), // Processor comparison - Sandy/Ivy Bridge for Intel will change CPU/chipset reporting when still using same mobo69 array('Motherboard', 'Chipset'), // Motherboard comparison70 array('Motherboard', 'Chipset', 'Audio', 'Network'), // Also a potential motherboard comparison71 array('Graphics', 'Audio'), // GPU comparison72 ), $return_all_changed_indexes);73 }74 else if(count($hw_unique) == 1)75 {76 // The hardware is being maintained, but the software is being flipped out77 $rows = array();78 $data = array();79 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $sw);80 pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);81 $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(82 array('Display Driver', 'OpenGL'), array('OpenGL'), array('Display Driver') // Graphics driver comparisons83 ), $return_all_changed_indexes);84 }85 else86 {87 // Both software and hardware are being flipped out88 $rows = array();89 $data = array();90 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $hw);91 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $sw);92 pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);93 $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(94 array('Memory', 'Graphics', 'Display Driver', 'OpenGL'),95 array('Graphics', 'Display Driver', 'OpenGL', 'Vulkan'), array('Graphics', 'Display Driver', 'OpenGL', 'OpenCL', 'Vulkan'), array('Graphics', 'Monitor', 'Kernel', 'Display Driver', 'OpenGL'), array('Graphics', 'Monitor', 'Display Driver', 'OpenGL'), array('Graphics', 'Kernel', 'Display Driver', 'OpenGL'), array('Graphics', 'Display Driver', 'OpenGL'), array('Graphics', 'OpenGL'), array('Graphics', 'Kernel'), array('Graphics', 'Display Driver') // All potential graphics comparisons96 ), $return_all_changed_indexes);97 }98 if($desc)99 {100 if($flagged_results === -1)101 {102 return $desc;103 }104 else105 {106 $mark_results = self::locate_interesting_results($result_file, $flagged_results);107 return array($desc[0], $desc[1], $mark_results);108 }109 }110 return false;111 }112 public static function locate_interesting_results(&$result_file, &$flagged_results = null)113 {114 $result_objects = array();115 if(!is_array($flagged_results))116 {117 $flagged_results = array();118 $system_id_keys = null;119 $result_object_index = -1;120 pts_ResultFileTable::result_file_to_result_table($result_file, $system_id_keys, $result_object_index, $flagged_results);121 }122 if(count($flagged_results) > 0)123 {124 asort($flagged_results);125 $flagged_results = array_slice(array_keys($flagged_results), -6);126 $flag_delta_objects = $result_file->get_result_objects($flagged_results);127 for($i = 0; $i < count($flagged_results); $i++)128 {129 $result_objects[$flagged_results[$i]] = $flag_delta_objects[$i];130 unset($flag_delta_objects[$i]);131 }132 }133 return $result_objects;134 }135 public static function analyze_system_component_changes($data, $rows, $supported_combos = array(), $return_all_changed_indexes = false)136 {137 $max_combo_count = 2;138 foreach($supported_combos as $combo)139 {140 if(($c = count($combo)) > $max_combo_count)141 {142 $max_combo_count = $c;143 }144 }145 $total_width = count($data);146 $first_objects = array_shift($data);147 $comparison_good = true;148 $comparison_objects = array();149 foreach($first_objects as $i => $o)150 {151 if($o->get_attribute('spans_col') == $total_width)152 {153 unset($first_objects[$i]);154 }155 }156 if(count($first_objects) <= $max_combo_count && count($first_objects) > 0)157 {158 $changed_indexes = array_keys($first_objects);159 $comparison_objects[] = ($return_all_changed_indexes ? array_map('strval', $first_objects) : implode('/', $first_objects));160 if(count($changed_indexes) <= $max_combo_count)161 {162 while($comparison_good && ($this_identifier = array_shift($data)) !== null)163 {164 if(empty($this_identifier))165 {166 continue;167 }168 $this_keys = array_keys($this_identifier);169 $do_push = false;170 if($this_keys != $changed_indexes)171 {172 foreach($this_keys as &$change)173 {174 $change = $rows[$change];175 }176 if(!in_array($this_keys, $supported_combos) && (count($this_keys) > 1 || array_search($this_keys[0], $supported_combos[0]) === false))177 {178 $comparison_good = false;179 }180 else181 {182 $do_push = true;183 }184 }185 else186 {187 $do_push = true;188 }189 if($do_push)190 {191 $comparison_objects[] = ($return_all_changed_indexes ? array_map('strval', $this_identifier) : implode('/', $this_identifier));192 }193 }194 }195 else196 {197 $comparison_good = false;198 }199 if($comparison_good)200 {201 $new_index = array();202 foreach($changed_indexes as &$change)203 {204 $new_index[$change] = $rows[$change];205 }206 $changed_indexes = $new_index;207 if(count($changed_indexes) == 1 || in_array(array_values($changed_indexes), $supported_combos))208 {209 if($return_all_changed_indexes == false)210 {211 $comparison_objects = implode(', ', $comparison_objects);212 }213 return array(($return_all_changed_indexes ? $changed_indexes : array_shift($changed_indexes)), $comparison_objects);214 }215 }216 }217 return false;218 }219 public static function system_components_to_table(&$table_data, &$columns, &$rows, $add_components)220 {221 $col_pos = 0;222 foreach($add_components as $info_string)223 {224 if(isset($columns[$col_pos]))225 {226 if(!isset($table_data[$columns[$col_pos]]))227 {228 $table_data[$columns[$col_pos]] = array();229 }230 foreach(explode(', ', $info_string) as $component)231 {232 $c_pos = strpos($component, ': ');233 if($c_pos !== false)234 {235 $index = substr($component, 0, $c_pos);236 $value = substr($component, ($c_pos + 2));237 if(($r_i = array_search($index, $rows)) === false)238 {239 $rows[] = $index;240 $r_i = count($rows) - 1;241 }242 $table_data[$columns[$col_pos]][$r_i] = self::system_value_to_ir_value($value, $index);243 }244 }245 }246 $col_pos++;247 }248 }249 public static function system_component_string_to_array($components, $do_check = false)250 {251 $component_r = array();252 $components = explode(', ', $components);253 foreach($components as &$component)254 {255 $component = explode(': ', $component);256 if(count($component) >= 2 && ($do_check == false || in_array($component[0], $do_check)))257 {258 $component_r[$component[0]] = $component[1];259 }260 }261 return $component_r;262 }263 public static function system_component_string_to_html($components)264 {265 $components = self::system_component_string_to_array($components);266 foreach($components as $type => &$component)267 {268 $component = self::system_value_to_ir_value($component, $type);269 $type = '<strong>' . $type . '</strong>';270 if(($href = $component->get_attribute('href')) != false)271 {272 $component = '<a href="' . $href . '">' . $component->get_value() . '</a>';273 }274 else275 {276 $component = $component->get_value();277 }278 $component = $type . ': ' . $component;279 }280 return implode(', ', $components);281 }282 public static function system_value_to_ir_value($value, $index)283 {284 // TODO XXX: Move this logic off to OpenBenchmarking.org script285 /*286 !in_array($index, array('Memory', 'System Memory', 'Desktop', 'Screen Resolution', 'System Layer')) &&287 $search_break_characters = array('@', '(', '/', '+', '[', '<', '*', '"');288 for($i = 0, $x = strlen($value); $i < $x; $i++)289 {290 if(in_array($value[$i], $search_break_characters))291 {292 $value = substr($value, 0, $i);293 break;294 }295 }296 */297 $ir = new pts_graph_ir_value($value);298 if($value != 'Unknown' && $value != null)299 {300 $ir->set_attribute('href', 'http://openbenchmarking.org/s/' . $value);301 }302 return $ir;303 }304 public static function compact_result_table_data(&$table_data, &$columns, $unset_emptied_values = false)305 {306 // Let's try to compact the data307 $c_count = count($table_data);308 $c_index = 0;309 foreach(array_keys($table_data) as $c)310 {311 foreach(array_keys($table_data[$c]) as $r)312 {313 // Find next-to duplicates314 $match_to = &$table_data[$c][$r];315 if(($match_to instanceof pts_graph_ir_value) == false)316 {317 if($unset_emptied_values)318 {...
compact_result_table_data
Using AI Code Generation
1require_once('pts-core.php');2$rf = new pts_result_file('/home/xyz/xyz.xml');3$rf->compact_result_table_data();4$rf->save_to_file('/home/xyz/xyz.xml');5require_once('pts-core.php');6$rf = new pts_result_file('/home/xyz/xyz.xml');7$rf->compact_result_table_data();8$rf->save_to_file('/home/xyz/xyz.xml');9find /home/xyz/ -type f -name "*.xml" -exec php /home/xyz/xyz.php {} \;10find /home/xyz/ -type f -name "*.xml" -exec php /home/xyz/xyz.php {} \;11find /home/xyz/ -type f -name "*.xml" -exec php /home/xyz/xyz.php {} \;12find /home/xyz/ -type f -name "*.xml" -exec php /home/xyz/xyz.php {} \;13find /home/xyz/ -type f -name "*.xml" -exec php /home/xyz/xyz.php {} \;
compact_result_table_data
Using AI Code Generation
1require_once('pts-core.php');2$rf = new pts_result_file('result_file.xml');3$rf->compact_result_table_data();4$rf->save_to_file('result_file_compact.xml');5require_once('pts-core.php');6$rf = new pts_result_file('result_file_compact.xml');7$rf->merge_result_files('result_file.xml');8$rf->save_to_file('result_file_merged.xml');
compact_result_table_data
Using AI Code Generation
1require_once('pts_result_file_analyzer.php');2$rf = new pts_result_file_analyzer();3$rf = new pts_result_file_analyzer('result.xml');4$rf->compact_result_table_data();5require_once('pts_result_file_analyzer.php');6$rf = new pts_result_file_analyzer();7$rf = new pts_result_file_analyzer('result.xml');8$rf->get_result_table_data();9require_once('pts_result_file_analyzer.php');10$rf = new pts_result_file_analyzer();11$rf = new pts_result_file_analyzer('result.xml');12$rf->get_result_table_data();13require_once('pts_result_file_analyzer.php');14$rf = new pts_result_file_analyzer();15$rf = new pts_result_file_analyzer('result.xml');16$rf->get_result_table_data();17require_once('pts_result_file_analyzer.php');18$rf = new pts_result_file_analyzer();
compact_result_table_data
Using AI Code Generation
1include_once('pts-core.php');2if($argc != 3)3{4";5 exit(1);6}7$result_file = new pts_result_file($argv[1]);8$analyzer = new pts_result_file_analyzer($result_file);9$analyzer->compact_result_table_data($argv[2]);10$result_file->save_to_file($argv[1]);11include_once('pts-core.php');12if($argc != 3)13{14";15 exit(1);16}17$result_file = new pts_result_file($argv[1]);18$analyzer = new pts_result_file_analyzer($result_file);19$analyzer->compact($argv[2]);20$result_file->save_to_file($argv[1]);
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with compact_result_table_data on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!