Best Phoronix-test-suite code snippet using pts_result_file_analyzer.generate_geometric_mean_result
pts_result_file_analyzer.php
Source:pts_result_file_analyzer.php
...16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class pts_result_file_analyzer19{20 public static function generate_geometric_mean_result($result_file, $do_sort = false)21 {22 $results = array();23 $system_count = $result_file->get_system_count();24 foreach($result_file->get_result_objects() as $result)25 {26 if($result->test_profile->get_identifier() == null || $result->test_profile->get_display_format() != 'BAR_GRAPH' || $system_count > $result->test_result_buffer->get_count())27 {28 // Skip data where it's not a proper test, not a singular data value, or not all systems ran within the result file29 continue;30 }31 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)32 {33 $r = $buffer_item->get_result_value();34 if(!is_numeric($r) || $r == 0)35 {36 continue;37 }38 if($result->test_profile->get_result_proportion() == 'LIB')39 {40 // convert to HIB41 $r = (1 / $r) * 100;42 }43 $ri = $buffer_item->get_result_identifier();44 if(!isset($results[$ri]))45 {46 $results[$ri] = array();47 }48 $results[$ri][] = $r;49 }50 }51 foreach($results as $identifier => $values)52 {53 if(count($values) < 4)54 {55 // If small result file with not a lot of data, don't bother showing...56 unset($results[$identifier]);57 }58 }59 if(!empty($results))60 {61 $test_profile = new pts_test_profile();62 $test_result = new pts_test_result($test_profile);63 $test_result->test_profile->set_test_title('Geometric Mean Of All Test Results');64 $test_result->test_profile->set_identifier(null);65 $test_result->test_profile->set_version(null);66 $test_result->test_profile->set_result_proportion(null);67 $test_result->test_profile->set_display_format('BAR_GRAPH');68 $test_result->test_profile->set_result_scale('Geometric Mean');69 $test_result->test_profile->set_result_proportion('HIB');70 $test_result->set_used_arguments_description('Result Composite');71 $test_result->set_used_arguments('Geometric-Mean');72 $test_result->test_result_buffer = new pts_test_result_buffer();73 foreach($results as $identifier => $values)74 {75 $values = pts_math::geometric_mean($values);76 $test_result->test_result_buffer->add_test_result($identifier, pts_math::set_precision($values, 3));77 }78 if(!$result_file->is_multi_way_comparison() || $do_sort)79 {80 $test_result->sort_results_by_performance();81 $test_result->test_result_buffer->buffer_values_reverse();82 }83 return $test_result;84 }85 return false;86 }87 public static function generate_geometric_mean_result_per_test($result_file, $do_sort = false, $selector = null)88 {89 $geo_results = array();90 $results = array();91 $system_count = $result_file->get_system_count();92 foreach($result_file->get_result_objects() as $result)93 {94 if(($selector == null && $result->test_profile->get_identifier() == null) || $result->test_profile->get_display_format() != 'BAR_GRAPH' || $system_count > $result->test_result_buffer->get_count())95 {96 // Skip data where it's not a proper test, not a singular data value, or not all systems ran within the result file97 continue;98 }99 if($selector != null && strpos($result->get_arguments_description(), $selector) === false && strpos($result->test_profile->get_title(), $selector) === false && strpos($result->test_profile->get_result_scale(), $selector) === false)100 {101 continue;102 }103 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)104 {105 $r = $buffer_item->get_result_value();106 if(!is_numeric($r) || $r == 0)107 {108 continue;109 }110 if($result->test_profile->get_result_proportion() == 'LIB')111 {112 // convert to HIB113 $r = (1 / $r) * 100;114 }115 $ri = $buffer_item->get_result_identifier();116 if(!isset($results[$result->test_profile->get_title()]))117 {118 $results[$result->test_profile->get_title()] = array();119 }120 if(!isset($results[$result->test_profile->get_title()][$ri]))121 {122 $results[$result->test_profile->get_title()][$ri] = array();123 }124 $results[$result->test_profile->get_title()][$ri][] = $r;125 }126 }127 if(count($results) < 3)128 {129 return array();130 }131 foreach($results as $test => $test_results)132 {133 foreach($test_results as $identifier => $values)134 {135 if(false && count($values) < 4)136 {137 // If small result file with not a lot of data, don't bother showing...138 unset($results[$test][$identifier]);139 }140 }141 if(empty($results[$test]))142 {143 unset($results[$test]);144 }145 }146 foreach($results as $test_title => $test_results)147 {148 $test_profile = new pts_test_profile();149 $test_result = new pts_test_result($test_profile);150 $test_result->test_profile->set_test_title($test_title);151 $test_result->test_profile->set_identifier(null);152 $test_result->test_profile->set_version(null);153 $test_result->test_profile->set_result_proportion(null);154 $test_result->test_profile->set_display_format('BAR_GRAPH');155 $test_result->test_profile->set_result_scale('Geometric Mean');156 $test_result->test_profile->set_result_proportion('HIB');157 $test_result->set_used_arguments_description(($selector ? $selector . ' ' : null) . 'Geometric Mean');158 $test_result->set_used_arguments('Geometric-Mean');159 $test_result->test_result_buffer = new pts_test_result_buffer();160 foreach($test_results as $identifier => $values)161 {162 $values = pts_math::geometric_mean($values);163 $test_result->test_result_buffer->add_test_result($identifier, pts_math::set_precision($values, 3));164 }165 if(!$result_file->is_multi_way_comparison() || $do_sort)166 {167 $test_result->sort_results_by_performance();168 $test_result->test_result_buffer->buffer_values_reverse();169 }170 $geo_results[] = $test_result;171 }172 return $geo_results;173 }174 public static function generate_harmonic_mean_result($result_file, $do_sort = false)175 {176 $results = array();177 $system_count = $result_file->get_system_count();178 foreach($result_file->get_result_objects() as $result)179 {180 if($result->test_profile->get_identifier() == null || $result->test_profile->get_display_format() != 'BAR_GRAPH' || $result->test_profile->get_result_proportion() == 'LIB' || $system_count > $result->test_result_buffer->get_count())181 {182 // Skip data where it's not a proper test, not a singular data value, or not all systems ran within the result file, or lower is better for results183 continue;184 }185 $rs = $result->test_profile->get_result_scale();186 if(strpos($rs, '/') === false && stripos($rs, ' per ') === false && stripos($rs, 'FPS') === false && stripos($rs, 'bps') === false && stripos($rs, 'iops') === false)187 {188 // Harmonic mean is relevant for tests of rates, MB/s, FPS, ns/day, etc.189 continue;190 }191 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)192 {193 $ri = $buffer_item->get_result_identifier();194 if(!isset($results[$rs][$ri]))195 {196 $results[$rs][$ri] = array();197 }198 $results[$rs][$ri][] = $buffer_item->get_result_value();199 }200 }201 foreach($results as $result_scale => $group)202 {203 foreach($group as $identifier => $values)204 {205 if(count($values) < 4)206 {207 // If small result file with not a lot of data, don't bother showing...208 unset($results[$result_scale][$identifier]);209 }210 }211 }212 if(!empty($results))213 {214 $test_results = array();215 foreach($results as $result_scale => $group)216 {217 $parsed = array();218 foreach($group as $identifier => $values)219 {220 $parsed[$identifier] = pts_math::harmonic_mean($values);221 }222 if(empty($parsed) || count($parsed) < 2)223 {224 continue;225 }226 $test_profile = new pts_test_profile();227 $test_result = new pts_test_result($test_profile);228 $test_result->test_profile->set_test_title('Harmonic Mean Of ' . $result_scale . ' Test Results');229 $test_result->test_profile->set_identifier(null);230 $test_result->test_profile->set_version(null);231 $test_result->test_profile->set_result_proportion(null);232 $test_result->test_profile->set_display_format('BAR_GRAPH');233 $test_result->test_profile->set_result_scale($result_scale);234 $test_result->test_profile->set_result_proportion('HIB');235 $test_result->set_used_arguments_description('Harmonic Mean');236 $test_result->set_used_arguments('Harmonic-Mean - ' . $result_scale);237 $test_result->test_result_buffer = new pts_test_result_buffer();238 foreach($parsed as $identifier => $values)239 {240 $test_result->test_result_buffer->add_test_result($identifier, pts_math::set_precision($values, 3));241 }242 if(!$result_file->is_multi_way_comparison() || $do_sort)243 {244 $test_result->sort_results_by_performance();245 $test_result->test_result_buffer->buffer_values_reverse();246 }247 $test_results[] = $test_result;248 }249 return $test_results;250 }251 return array();252 }253 public static function display_result_file_stats_pythagorean_means($result_file, $highlight_identifier = null)254 {255 $ret = null;256 foreach(pts_result_file_analyzer::generate_harmonic_mean_result($result_file, true) as $harmonic_mean_result)257 {258 $ret .= pts_result_file_output::test_result_to_text($harmonic_mean_result, pts_client::terminal_width(), true, $highlight_identifier, true) . PHP_EOL;259 }260 $geometric_mean = pts_result_file_analyzer::generate_geometric_mean_result($result_file, true);261 if($geometric_mean)262 {263 $ret .= pts_result_file_output::test_result_to_text($geometric_mean, pts_client::terminal_width(), true, $highlight_identifier, true);264 }265 if($ret != null)266 {267 $ret .= PHP_EOL;268 }269 return $ret;270 }271 public static function display_results_wins_losses($result_file, $highlight_result_identifier = null, $prepend_lines = ' ')272 {273 $output = null;274 $result_file_identifiers_count = $result_file->get_system_count();...
generate_geometric_mean_result
Using AI Code Generation
1$analyzer = new pts_result_file_analyzer();2$analyzer->generate_geometric_mean_result($result_file);3$analyzer = new pts_result_file_analyzer();4$analyzer->generate_geometric_mean_result($result_file);5$analyzer = new pts_result_file_analyzer();6$analyzer->generate_geometric_mean_result($result_file);7$analyzer = new pts_result_file_analyzer();8$analyzer->generate_geometric_mean_result($result_file);9$analyzer = new pts_result_file_analyzer();10$analyzer->generate_geometric_mean_result($result_file);11$analyzer = new pts_result_file_analyzer();12$analyzer->generate_geometric_mean_result($result_file);13$analyzer = new pts_result_file_analyzer();14$analyzer->generate_geometric_mean_result($result_file);15$analyzer = new pts_result_file_analyzer();16$analyzer->generate_geometric_mean_result($result_file);17$analyzer = new pts_result_file_analyzer();18$analyzer->generate_geometric_mean_result($result_file);19$analyzer = new pts_result_file_analyzer();20$analyzer->generate_geometric_mean_result($result_file);
generate_geometric_mean_result
Using AI Code Generation
1require_once('pts_result_file_analyzer.php');2$analyzer = new pts_result_file_analyzer();3$analyzer->generate_geometric_mean_result('result_file.xml');4require_once('pts_result_file_analyzer.php');5$analyzer = new pts_result_file_analyzer();6$analyzer->generate_geometric_mean_result('result_file.xml');7require_once('pts_result_file_analyzer.php');8$analyzer = new pts_result_file_analyzer();9$analyzer->generate_geometric_mean_result('result_file.xml');10require_once('pts_result_file_analyzer.php');11$analyzer = new pts_result_file_analyzer();12$analyzer->generate_geometric_mean_result('result_file.xml');13require_once('pts_result_file_analyzer.php');14$analyzer = new pts_result_file_analyzer();15$analyzer->generate_geometric_mean_result('result_file.xml');16require_once('pts_result_file_analyzer.php');17$analyzer = new pts_result_file_analyzer();18$analyzer->generate_geometric_mean_result('result_file.xml');19require_once('pts_result_file_analyzer.php');20$analyzer = new pts_result_file_analyzer();21$analyzer->generate_geometric_mean_result('result_file.xml');22require_once('pts_result_file_analyzer.php');23$analyzer = new pts_result_file_analyzer();24$analyzer->generate_geometric_mean_result('result_file.xml');25require_once('pts_result_file_analyzer.php');
generate_geometric_mean_result
Using AI Code Generation
1require_once('pts_result_file_analyzer.php');2$analyzer = new pts_result_file_analyzer();3$analyzer->generate_geometric_mean_result('2.xml', '2.php');4require_once('pts_result_file_analyzer.php');5$analyzer = new pts_result_file_analyzer();6$analyzer->generate_geometric_mean_result('3.xml', '3.php');7require_once('pts_result_file_analyzer.php');8$analyzer = new pts_result_file_analyzer();9$analyzer->generate_geometric_mean_result('4.xml', '4.php');10require_once('pts_result_file_analyzer.php');11$analyzer = new pts_result_file_analyzer();12$analyzer->generate_geometric_mean_result('5.xml', '5.php');13require_once('pts_result_file_analyzer.php');14$analyzer = new pts_result_file_analyzer();15$analyzer->generate_geometric_mean_result('6.xml', '6.php');16require_once('pts_result_file_analyzer.php');17$analyzer = new pts_result_file_analyzer();18$analyzer->generate_geometric_mean_result('7.xml', '7.php');19require_once('pts_result_file_analyzer.php');20$analyzer = new pts_result_file_analyzer();21$analyzer->generate_geometric_mean_result('8.xml', '8.php');22require_once('pts_result_file_analyzer.php');23$analyzer = new pts_result_file_analyzer();24$analyzer->generate_geometric_mean_result('9.xml', '9.php');
generate_geometric_mean_result
Using AI Code Generation
1require_once('pts_result_file_analyzer.php');2$pf = new pts_result_file_analyzer('2.xml');3$pf->generate_geometric_mean_result();4$pf->save_to_file('2.php');5require_once('pts_result_file_analyzer.php');6$pf = new pts_result_file_analyzer('3.xml');7$pf->generate_geometric_mean_result();8$pf->save_to_file('3.php');9require_once('pts_result_file_analyzer.php');10$pf = new pts_result_file_analyzer('4.xml');11$pf->generate_geometric_mean_result();12$pf->save_to_file('4.php');13require_once('pts_result_file_analyzer.php');14$pf = new pts_result_file_analyzer('5.xml');15$pf->generate_geometric_mean_result();16$pf->save_to_file('5.php');17require_once('pts_result_file_analyzer.php');18$pf = new pts_result_file_analyzer('6.xml');19$pf->generate_geometric_mean_result();20$pf->save_to_file('6.php');21require_once('pts_result_file_analyzer.php');22$pf = new pts_result_file_analyzer('7.xml');23$pf->generate_geometric_mean_result();24$pf->save_to_file('7.php');25require_once('pts_result_file_analyzer.php');26$pf = new pts_result_file_analyzer('8.xml');27$pf->generate_geometric_mean_result();28$pf->save_to_file('8.php');
generate_geometric_mean_result
Using AI Code Generation
1require_once('pts-core.php');2require_once('pts-results.php');3$pts_result_file_analyzer = new pts_result_file_analyzer();4$pts_result_file_analyzer->generate_geometric_mean_result('result-file-1.xml', 'result-file-2.xml', 'result-file-3.xml', 'result-file-4.xml');5require_once('pts-core.php');6require_once('pts-results.php');7$pts_result_file_analyzer = new pts_result_file_analyzer();8$pts_result_file_analyzer->generate_geometric_mean_result('result-file-1.xml', 'result-file-2.xml', 'result-file-3.xml', 'result-file-4.xml', 'result-file-5.xml');9require_once('pts-core.php');10require_once('pts-results.php');11$pts_result_file_analyzer = new pts_result_file_analyzer();12$pts_result_file_analyzer->generate_geometric_mean_result('result-file-1.xml', 'result-file-2.xml', 'result-file-3.xml', 'result-file-4.xml', 'result-file-5.xml', 'result-file-6.xml');13require_once('pts-core.php');14require_once('pts-results.php');15$pts_result_file_analyzer = new pts_result_file_analyzer();16$pts_result_file_analyzer->generate_geometric_mean_result('result-file-1.xml', 'result-file-2.xml', 'result-file-3.xml', 'result-file-4.xml', 'result-file-5.xml', 'result-file-6.xml', 'result-file-7.xml');17require_once('pts-core.php');18require_once('pts-results.php');19$pts_result_file_analyzer = new pts_result_file_analyzer();20$pts_result_file_analyzer->generate_geometric_mean_result('result-file-1.xml', 'result-file-2.xml', 'result-file-3.xml', 'result-file-4.xml', 'result-file-5.xml', 'result-file-6.xml', 'result
generate_geometric_mean_result
Using AI Code Generation
1require_once('pts-core/objects/pts_result_file_analyzer.php');2$rf = new pts_result_file_analyzer('result_file.xml');3require_once('pts-core/objects/pts_result_file_analyzer.php');4$rf = new pts_result_file_analyzer('result_file.xml');5require_once('pts-core/objects/pts_result_file_analyzer.php');6$rf = new pts_result_file_analyzer('result_file.xml');7require_once('pts-core/objects/pts_result_file_analyzer.php');8$rf = new pts_result_file_analyzer('result_file.xml');9require_once('pts-core/objects/pts_result_file_analyzer.php');10$rf = new pts_result_file_analyzer('result_file.xml');11require_once('pts-core/objects/pts_result_file_analyzer.php');12$rf = new pts_result_file_analyzer('result_file.xml');13require_once('pts-core/objects/pts_result_file_analyzer.php');14$rf = new pts_result_file_analyzer('result_file.xml');
generate_geometric_mean_result
Using AI Code Generation
1require_once 'pts_result_file_analyzer.php';2$analyzer = new pts_result_file_analyzer();3$analyzer->generate_geometric_mean_result('result_file.xml', 'geometric_mean_result.xml');4require_once 'pts_result_file_analyzer.php';5$analyzer = new pts_result_file_analyzer();6$analyzer->generate_geometric_mean_result('result_file.xml', 'geometric_mean_result.xml');7require_once 'pts_result_file_analyzer.php';8$analyzer = new pts_result_file_analyzer();9$analyzer->generate_geometric_mean_result('result_file.xml', 'geometric_mean_result.xml');
generate_geometric_mean_result
Using AI Code Generation
1require_once 'pts_result_file_analyzer.php';2$pts_result_file_analyzer = new pts_result_file_analyzer('2.xml');3$pts_result_file_analyzer->generate_geometric_mean_result('2.xml');4require_once 'pts_result_file_analyzer.php';5$pts_result_file_analyzer = new pts_result_file_analyzer('3.xml');6$pts_result_file_analyzer->generate_geometric_mean_result('3.xml');7require_once 'pts_result_file_analyzer.php';8$pts_result_file_analyzer = new pts_result_file_analyzer('4.xml');9$pts_result_file_analyzer->generate_geometric_mean_result('4.xml');10require_once 'pts_result_file_analyzer.php';11$pts_result_file_analyzer = new pts_result_file_analyzer('5.xml');12$pts_result_file_analyzer->generate_geometric_mean_result('5.xml');13require_once 'pts_result_file_analyzer.php';14$pts_result_file_analyzer = new pts_result_file_analyzer('6.xml');15$pts_result_file_analyzer->generate_geometric_mean_result('6.xml');16require_once 'pts_result_file_analyzer.php';17$pts_result_file_analyzer = new pts_result_file_analyzer('7.xml
generate_geometric_mean_result
Using AI Code Generation
1$pts_result_file_analyzer = new pts_result_file_analyzer();2$pts_result_file_analyzer->read_result_file('/home/username/test_results.xml');3$pts_result_file_analyzer->generate_geometric_mean_result();4$pts_result_file_analyzer->write_result_file('/home/username/test_results.xml');5$pts_result_file_analyzer->write_result_file('/home/username/test_results_new.xml');6$pts_result_file_analyzer->write_result_file('/home/username/test_results_new.xml', 'New Title');7$pts_result_file_analyzer->write_result_file('/home/username/test_results_new.xml', 'New Title', 'New Description');8$pts_result_file_analyzer->write_result_file('/home/username/test_results_new.xml', 'New Title', 'New Description', 'New System Identifier');9$pts_result_file_analyzer->write_result_file('/home/username/test_results_new.xml', 'New Title', 'New Description', 'New System Identifier', 'New System Version');
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 generate_geometric_mean_result 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!!