Best Phoronix-test-suite code snippet using pts_test_result_buffer.get_count
pts_result_file_analyzer.php
Source:pts_result_file_analyzer.php
...86 $test_result->set_used_arguments_description($comparing . ' Comparison' . ($tc ? ' (' . $tc . ')' : null));87 $test_result->test_profile->set_test_title($ro->test_profile->get_title());88 $test_result->test_profile->set_result_proportion($ro->test_profile->get_result_proportion());89 $test_result->test_profile->set_version($ro->test_profile->get_app_version());90 if($test_result->test_result_buffer->get_count() > 1)91 {92 $test_result->dynamically_generated = true;93 $new_result_objects[] = $test_result;94 $global_results_to_drop = array_merge($global_results_to_drop, $results_to_drop);95 }96 }97 }98 }99 if(count($new_result_objects) > 0)100 {101 $result_file->remove_result_object_by_id($global_results_to_drop);102 foreach($new_result_objects as $new_ro)103 {104 $result_file->add_result($new_ro);105 }106 }107 }108 }109 public static function condense_result_file_by_multi_version_tests(&$result_file)110 {111 $pmap = array();112 $do_proceed = false;113 foreach($result_file->get_result_objects() as $index => $ro)114 {115 if($ro->test_profile->get_identifier() == null || $ro->test_profile->get_display_format() != 'BAR_GRAPH')116 {117 continue;118 }119 $args = $ro->get_arguments_description();120 $scale = $ro->test_profile->get_result_scale();121 $test_identifier_no_version = $ro->test_profile->get_identifier(false);122 if(!isset($pmap[$test_identifier_no_version][$args]))123 {124 $pmap[$test_identifier_no_version][$args] = array();125 }126 if(!isset($pmap[$test_identifier_no_version][$args][$scale]))127 {128 $pmap[$test_identifier_no_version][$args][$scale] = array();129 }130 $pmap[$test_identifier_no_version][$args][$scale][$ro->test_profile->get_app_version()] = $index;131 if(!$do_proceed && count($pmap[$test_identifier_no_version][$args][$scale]) > 1)132 {133 $do_proceed = true;134 }135 }136 if($do_proceed)137 {138 $system_count = $result_file->get_system_count();139 $new_result_objects = array();140 $global_results_to_drop = array();141 foreach(array_keys($pmap) as $distinct_test)142 {143 foreach(array_keys($pmap[$distinct_test]) as $test_combo)144 {145 foreach(array_keys($pmap[$distinct_test][$test_combo]) as $scale)146 {147 $test_profile = new pts_test_profile($distinct_test);148 $test_result = new pts_test_result($test_profile);149 $test_result->test_profile->set_identifier(null);150 $test_result->test_profile->set_display_format('BAR_GRAPH');151 $test_result->test_profile->set_result_scale($scale);152 $test_result->set_used_arguments($test_combo);153 $test_result->test_result_buffer = new pts_test_result_buffer();154 $comparing = null;155 $results_to_drop = array();156 foreach($pmap[$distinct_test][$test_combo][$scale] as $version => $ro_index)157 {158 if(($ro = $result_file->get_result_object_by_hash($ro_index)))159 {160 foreach($ro->test_result_buffer->get_buffer_items() as $old_bi)161 {162 $test_result->test_result_buffer->add_test_result(($system_count > 1 ? $old_bi->get_result_identifier() . ': ' : null) . $version, $old_bi->get_result_value(), $old_bi->get_result_raw(), $old_bi->get_result_json_raw(), $old_bi->get_min_result_value(), $old_bi->get_max_result_value());163 }164 $results_to_drop[] = $ro_index;165 }166 }167 $tc = trim(trim(trim($test_combo), '-'));168 $test_result->set_used_arguments_description('Version Comparison' . ($tc ? ' (' . $tc . ')' : null));169 $test_result->test_profile->set_test_title($ro->test_profile->get_title());170 $test_result->test_profile->set_result_proportion($ro->test_profile->get_result_proportion());171 $test_result->test_profile->set_version('');172 if($test_result->test_result_buffer->get_count() > 1)173 {174 $test_result->dynamically_generated = true;175 $new_result_objects[] = $test_result;176 $global_results_to_drop = array_merge($global_results_to_drop, $results_to_drop);177 }178 }179 }180 }181 if(count($new_result_objects) > 0)182 {183 $result_file->remove_result_object_by_id($global_results_to_drop);184 foreach($new_result_objects as $new_ro)185 {186 $result_file->add_result($new_ro);187 }188 }189 }190 }191 public static function get_result_object_custom(&$result_file, $result_object, $identifier_mapping, $title_prepend = '', $unit = '')192 {193 if($result_object->test_profile->get_identifier() != null && $result_object->test_profile->get_display_format() == 'BAR_GRAPH')194 {195 $added_count = 0;196 $test_result = clone $result_object;197 $test_result->test_profile->set_identifier(null);198 $test_result->set_used_arguments_description($title_prepend . ($test_result->get_arguments_description() != null ? ' - ' . $test_result->get_arguments_description() : ''));199 $test_result->set_used_arguments($title_prepend . ' ' . $test_result->get_arguments());200 $test_result->test_result_buffer = new pts_test_result_buffer();201 foreach($identifier_mapping as $identifier => $value)202 {203 $result = $result_object->test_result_buffer->get_value_from_identifier($identifier);204 if($result_object->test_profile->get_result_proportion() == 'HIB')205 {206 $result = $result / $value;207 $result = round($result, ($result < 1 ? 4 : 2));208 $scale = $result_object->test_profile->get_result_scale() . ' Per ' . $unit;209 }210 else if($result_object->test_profile->get_result_proportion() == 'LIB')211 {212 $result = round($result * $value, 3);213 $scale = $result_object->test_profile->get_result_scale() . ' x ' . $unit;214 }215 if($result != 0)216 {217 if($title_prepend == 'Performance Per Clock')218 {219 $d = 'GHz base clock speed (use PTS sensors for real-time frequency/sensor reporting)';220 }221 else222 {223 $d = strtolower($unit);224 }225 $test_result->test_result_buffer->add_test_result($identifier, $result, null, array('install-footnote' => 'Detected ' . $d . ' count of ' . $value));226 $added_count++;227 }228 }229 if($added_count > 1)230 {231 $test_result->test_profile->set_result_scale($scale);232 return $test_result;233 }234 }235 return false;236 }237 public static function generate_perf_per_dollar(&$input, $generate, $unit = 'Dollar', $yield_on_unqualified_ros = false)238 {239 if($input instanceof pts_result_file)240 {241 $result_file = &$input;242 $ros = $input->get_result_objects();243 }244 else if($input instanceof pts_test_result)245 {246 $result_file = false;247 $ros = array($input);248 }249 foreach($ros as &$result_object)250 {251 if((!$yield_on_unqualified_ros && $result_object->test_profile->get_identifier() == null) || $result_object->test_profile->get_display_format() != 'BAR_GRAPH')252 {253 continue;254 }255 $computed = array();256 $footnotes = array();257 foreach($generate as $identifier => $value)258 {259 $result = $result_object->test_result_buffer->get_value_from_identifier($identifier);260 if(is_numeric($result) && $result > 0)261 {262 if($result_object->test_profile->get_result_proportion() == 'HIB')263 {264 $result = $result / $value;265 $result = pts_math::set_precision($result, ($result > 0.1 ? 3 : 8));266 $scale = $result_object->test_profile->get_result_scale() . ' Per ' . $unit;267 }268 else if($result_object->test_profile->get_result_proportion() == 'LIB')269 {270 $result = pts_math::set_precision($result * $value, 3);271 $scale = $result_object->test_profile->get_result_scale() . ' x ' . $unit;272 }273 else274 {275 continue;276 }277 if($result != 0)278 {279 $computed[$identifier] = $result;280 $footnotes[$identifier] = '$' . $value . ' reported cost.';281 }282 }283 }284 if(!empty($computed))285 {286 $ret = pts_result_file_analyzer::add_perf_per_graph($result_file, $result_object, $computed, $scale, $footnotes);287 if($result_file == false && $ret)288 {289 return $ret;290 }291 }292 }293 }294 public static function add_perf_per_graph(&$result_file, $test_result, $results, $scale, $footnote = null)295 {296 if(empty($results))297 {298 return false;299 }300 // This copy isn't needed but it's shorter and from port from system_monitor where there can be multiple items tracked301 $original_parent_hash = $test_result->get_comparison_hash(true, false);302 $test_result = clone $test_result;303 $test_result->test_profile->set_identifier(null);304 $test_result->set_used_arguments_description('Performance / Cost' . ($test_result->get_arguments_description() != null ? ' - ' . $test_result->get_arguments_description() : ''));305 $test_result->set_used_arguments('dollar comparison ' . $test_result->get_arguments());306 $test_result->test_profile->set_result_scale($scale);307 $test_result->test_result_buffer = new pts_test_result_buffer();308 foreach($results as $result_identifier => $result)309 {310 $test_result->test_result_buffer->add_test_result($result_identifier, $result, null, array('install-footnote' => (isset($footnote[$result_identifier]) ? $footnote[$result_identifier] : null)));311 }312 $test_result->set_parent_hash($original_parent_hash);313 if($result_file)314 {315 $result_file->add_result($test_result);316 }317 else318 {319 return $test_result;320 }321 }322 public static function generate_executive_summary($result_file, $selected_result = null, &$error = null, $separator = PHP_EOL, $do_html = false)323 {324 $summary = array();325 if($result_file->get_test_count() < 6)326 {327 $error = 'Not enough tests to analyze...';328 return $summary;329 }330 if($result_file->get_system_count() < 2)331 {332 $error = 'Not enough results to analyze...';333 return $summary;334 }335 $wins_result = pts_result_file_analyzer::generate_wins_losses_results($result_file, true);336 $first_place_buffer = $wins_result->test_result_buffer->get_max_value(2);337 if($selected_result && ($sw = $wins_result->test_result_buffer->find_buffer_item($selected_result)))338 {339 if($do_html)340 {341 $selected_result = '<strong>' . $selected_result . '</strong>';342 }343 $summary[] = $selected_result . ' came in first place for ' . floor($sw->get_result_value() / $wins_result->test_result_buffer->get_total_value_sum() * 100) . '% of the tests.';344 }345 else if($first_place_buffer->get_result_identifier() != $selected_result)346 {347 // Most wins348 $selected_result = $first_place_buffer->get_result_identifier();349 if($do_html)350 {351 $selected_result = '<strong>' . $selected_result . '</strong>';352 }353 $summary[] = $first_place_buffer->get_result_identifier() . ' had the most wins, coming in first place for ' . floor($first_place_buffer->get_result_value() / $wins_result->test_result_buffer->get_total_value_sum() * 100) . '% of the tests.';354 }355 $geo_mean_result = pts_result_file_analyzer::generate_geometric_mean_result($result_file, true);356 if($geo_mean_result)357 {358 $first_place_buffer = $geo_mean_result->test_result_buffer->get_max_value(2);359 $last_place_buffer = $geo_mean_result->test_result_buffer->get_min_value(2);360 $geo_bits = array();361 if($result_file->get_system_count() >= 3)362 {363 $prev_buffer = null;364 foreach($geo_mean_result->test_result_buffer->get_buffer_items() as $bi)365 {366 if($prev_buffer == null)367 {368 $prev_buffer = $bi;369 continue;370 }371 $rounded = round($bi->get_result_value() / $prev_buffer->get_result_value(), 3) . 'x';372 if($rounded === '1.000x')373 {374 continue;375 }376 $geo_bits[] = $bi->get_result_identifier() . ' was ' . $rounded . ' the speed of ' . $prev_buffer->get_result_identifier();377 $prev_buffer = $bi;378 }379 }380 switch(count($geo_bits))381 {382 case 0:383 $geo_bits = null;384 break;385 case 1:386 $geo_bits = array_pop($geo_bits) . '.';387 break;388 case 2:389 $geo_bits = implode(' and ', $geo_bits) . '.';390 break;391 default:392 if(count($geo_bits) > 10)393 {394 $geo_bits = null;395 break;396 }397 $geo_bits = implode(', ', $geo_bits) . '.';398 break;399 }400 $summary[] = trim('Based on the geometric mean of all complete results, the fastest (' . $first_place_buffer->get_result_identifier() . ') was ' . round($first_place_buffer->get_result_value() / $last_place_buffer->get_result_value(), 3) . 'x the speed of the slowest (' . $last_place_buffer->get_result_identifier() . '). ' . $geo_bits);401 }402 if($result_file->get_test_count() > 16)403 {404 $results = $result_file->get_result_objects();405 $spreads = array();406 foreach($results as $i => &$result_object)407 {408 $spreads[$i] = $result_object->get_spread();409 }410 arsort($spreads);411 $spreads = array_slice($spreads, 0, 10, true);412 if(!empty($spreads))413 {414 $spread_text = array();415 foreach($spreads as $result_key => $spread)416 {417 $ro = $result_file->get_result_objects($result_key);418 if(!is_object($ro[0]))419 {420 continue;421 }422 if($do_html)423 {424 $spread_text[] = '<strong>' . $ro[0]->test_profile->get_title() . '</strong>' . ($ro[0]->get_arguments_description() != null ? ' (<em>' . $ro[0]->get_arguments_description() . '</em>)' : null) . ' at ' . round($spread, 3) . 'x';425 }426 else427 {428 $spread_text[] = $ro[0]->test_profile->get_title() . ($ro[0]->get_arguments_description() != null ? ' (' . $ro[0]->get_arguments_description() . ')' : null) . ' at ' . round($spread, 3) . 'x';429 }430 }431 if(!empty($spread_text))432 {433 $summary[] = 'The results with the greatest spread from best to worst included: ' . PHP_EOL . PHP_EOL . implode($separator, $spread_text) . '.';434 }435 }436 }437 return $summary;438 }439 public static function generate_wins_losses_results($result_file, $only_wins = false)440 {441 $results = null;442 $result_file_identifiers_count = $result_file->get_system_count();443 $wins = array();444 $losses = array();445 $tests_counted = 0;446 $possible_evaluate_result_count = 0;447 foreach($result_file->get_result_objects() as $result)448 {449 if($result->test_profile->get_identifier() == null)450 {451 continue;452 }453 $possible_evaluate_result_count++;454 if($result->test_result_buffer->get_count() < 2 || $result->test_result_buffer->get_count() < floor($result_file_identifiers_count / 2))455 {456 continue;457 }458 $tests_counted++;459 $winner = $result->get_result_first();460 $loser = $result->get_result_last();461 if(!isset($wins[$winner]))462 {463 $wins[$winner] = 1;464 }465 else466 {467 $wins[$winner]++;468 }469 if(!isset($losses[$loser]))470 {471 $losses[$loser] = 1;472 }473 else474 {475 $losses[$loser]++;476 }477 }478 if(empty($wins) || empty($losses))479 {480 return;481 }482 arsort($wins);483 arsort($losses);484 $test_profile = new pts_test_profile();485 $test_result = new pts_test_result($test_profile);486 $test_result->test_profile->set_test_title('Number Of First Place Finishes');487 $test_result->test_profile->set_identifier(null);488 $test_result->test_profile->set_version(null);489 $test_result->test_profile->set_result_proportion(null);490 $test_result->test_profile->set_display_format('PIE_CHART');491 $test_result->test_profile->set_result_scale('Wins');492 ///$test_result->test_profile->set_result_proportion('HIB');493 $test_result->set_used_arguments_description('Wins - ' . $tests_counted . ' Tests');494 //$test_result->set_used_arguments('Geometric-Mean');495 $test_result->test_result_buffer = new pts_test_result_buffer();496 $test_result->dynamically_generated = true;497 foreach($wins as $identifier => $count)498 {499 $test_result->test_result_buffer->add_test_result($identifier, $count);500 }501 if($only_wins)502 {503 return count($wins) > 1 ? $test_result : null;504 }505 if(count($wins) > 1)506 {507 $results[] = $test_result;508 }509 $test_profile = new pts_test_profile();510 $test_result = new pts_test_result($test_profile);511 $test_result->test_profile->set_test_title('Number Of Last Place Finishes');512 $test_result->test_profile->set_identifier(null);513 $test_result->test_profile->set_version(null);514 $test_result->test_profile->set_result_proportion(null);515 $test_result->test_profile->set_display_format('PIE_CHART');516 $test_result->test_profile->set_result_scale('Losses');517 ///$test_result->test_profile->set_result_proportion('HIB');518 $test_result->set_used_arguments_description('Losses - ' . $tests_counted . ' Tests');519 //$test_result->set_used_arguments('Geometric-Mean');520 $test_result->test_result_buffer = new pts_test_result_buffer();521 $test_result->dynamically_generated = true;522 foreach($losses as $identifier => $count)523 {524 $test_result->test_result_buffer->add_test_result($identifier, $count);525 }526 if(count($losses) > 1)527 {528 $results[] = $test_result;529 }530 return $results;531 }532 public static function generate_geometric_mean_result_for_suites_in_result_file(&$result_file, $allow_partial = true, $upper_limit = 0)533 {534 if($result_file->get_system_count() < 2)535 {536 return array();537 }538 $geo_mean_results = array();539 $suites_in_result_file = pts_test_suites::suites_in_result_file($result_file, $allow_partial, $upper_limit);540 if(empty($suites_in_result_file))541 {542 return array();543 }544 ksort($suites_in_result_file);545 foreach($suites_in_result_file as $suite_identifier => &$s)546 {547 list($suite, $contained_tests) = $s;548 $geo_mean = pts_result_file_analyzer::generate_geometric_mean_result($result_file, true, $contained_tests);549 if($geo_mean)550 {551 $geo_mean->test_profile->set_test_title('Geometric Mean Of ' . $suite->get_title() . (stripos($suite->get_title(), 'Test') === false ? ' Tests' : null));552 $geo_mean->normalize_buffer_values();553 $geo_mean->set_annotation('Geometric mean based upon tests: ' . pts_arrays::implode_list($contained_tests));554 $geo_mean_results[] = $geo_mean;555 }556 }557 return $geo_mean_results;558 }559 public static function generate_geometric_mean_result($result_file, $do_sort = false, $limit_to = false, $best_is_last = false)560 {561 $results = array();562 $system_count = $result_file->get_system_count();563 foreach($result_file->get_result_objects() as $result)564 {565 if($result->test_profile->get_identifier() == null || $result->test_profile->get_display_format() != 'BAR_GRAPH' || $system_count > $result->test_result_buffer->get_count())566 {567 // Skip data where it's not a proper test, not a singular data value, or not all systems ran within the result file568 continue;569 }570 if($limit_to)571 {572 if(is_array($limit_to))573 {574 if(!in_array($result->test_profile->get_identifier(), $limit_to) && !in_array($result->test_profile->get_identifier(false), $limit_to))575 {576 continue;577 }578 }579 else580 {581 if($limit_to != $result->test_profile->get_identifier())582 {583 continue;584 }585 }586 }587 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)588 {589 $r = $buffer_item->get_result_value();590 if(!is_numeric($r) || $r == 0)591 {592 continue;593 }594 if($result->test_profile->get_result_proportion() == 'LIB')595 {596 // convert to HIB597 $r = (1 / $r) * 100;598 }599 $ri = $buffer_item->get_result_identifier();600 if(!isset($results[$ri]))601 {602 $results[$ri] = array();603 }604 $results[$ri][] = $r;605 }606 }607 foreach($results as $identifier => $values)608 {609 if(count($values) < 2)610 {611 // If small result file with not a lot of data, don't bother showing...612 unset($results[$identifier]);613 }614 }615 if(!empty($results))616 {617 $test_profile = new pts_test_profile();618 $test_result = new pts_test_result($test_profile);619 $test_result->test_profile->set_test_title('Geometric Mean Of ' . ($limit_to && !is_array($limit_to) ? $limit_to : 'All Test Results'));620 $test_result->test_profile->set_identifier(null);621 $test_result->test_profile->set_version(null);622 $test_result->test_profile->set_result_proportion(null);623 $test_result->test_profile->set_display_format('BAR_GRAPH');624 $test_result->test_profile->set_result_scale('Geometric Mean');625 $test_result->test_profile->set_result_proportion('HIB');626 $test_result->set_used_arguments_description('Result Composite');627 $test_result->set_used_arguments('Geometric-Mean');628 $test_result->test_result_buffer = new pts_test_result_buffer();629 foreach($results as $identifier => $values)630 {631 if(count($values) < 2)632 {633 return false;634 }635 $values = pts_math::geometric_mean($values);636 $test_result->test_result_buffer->add_test_result($identifier, pts_math::set_precision($values, 3));637 }638 if(!$result_file->is_multi_way_comparison() && $do_sort)639 {640 $test_result->sort_results_by_performance();641 if($best_is_last)642 {643 $test_result->test_result_buffer->buffer_values_reverse();644 }645 }646 $test_result->dynamically_generated = true;647 return $test_result;648 }649 return false;650 }651 public static function generate_geometric_mean_result_per_test($result_file, $do_sort = false, $selector = null, $best_is_last = false)652 {653 $geo_results = array();654 $results = array();655 $system_count = $result_file->get_system_count();656 foreach($result_file->get_result_objects() as $result)657 {658 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())659 {660 // Skip data where it's not a proper test, not a singular data value, or not all systems ran within the result file661 continue;662 }663 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)664 {665 continue;666 }667 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)668 {669 $r = $buffer_item->get_result_value();670 if(!is_numeric($r) || $r == 0)671 {672 continue;673 }674 if($result->test_profile->get_result_proportion() == 'LIB')675 {676 // convert to HIB677 $r = (1 / $r) * 100;678 }679 $ri = $buffer_item->get_result_identifier();680 if(!isset($results[$result->test_profile->get_title()]))681 {682 $results[$result->test_profile->get_title()] = array();683 }684 if(!isset($results[$result->test_profile->get_title()][$ri]))685 {686 $results[$result->test_profile->get_title()][$ri] = array();687 }688 $results[$result->test_profile->get_title()][$ri][] = $r;689 }690 }691 if(count($results) < 2)692 {693 return array();694 }695 foreach($results as $test => $test_results)696 {697 foreach($test_results as $identifier => $values)698 {699 if(false && count($values) < 4)700 {701 // If small result file with not a lot of data, don't bother showing...702 unset($results[$test][$identifier]);703 }704 }705 if(empty($results[$test]))706 {707 unset($results[$test]);708 }709 }710 foreach($results as $test_title => $test_results)711 {712 $test_profile = new pts_test_profile();713 $test_result = new pts_test_result($test_profile);714 $test_result->test_profile->set_test_title($test_title);715 $test_result->test_profile->set_identifier(null);716 $test_result->test_profile->set_version(null);717 $test_result->test_profile->set_result_proportion(null);718 $test_result->test_profile->set_display_format('BAR_GRAPH');719 $test_result->test_profile->set_result_scale('Geometric Mean');720 $test_result->test_profile->set_result_proportion('HIB');721 $test_result->set_used_arguments_description(($selector ? $selector . ' ' : null) . 'Geometric Mean');722 $test_result->set_used_arguments('Geometric-Mean');723 $test_result->test_result_buffer = new pts_test_result_buffer();724 foreach($test_results as $identifier => $values)725 {726 $values = pts_math::geometric_mean($values);727 $precised = pts_math::set_precision($values, 3);728 if($values != 0 && $precised == 0)729 {730 // Don't use precision if it ends up rounding result too small in certain situations731 $precised = $values;732 }733 $test_result->test_result_buffer->add_test_result($identifier, $precised);734 }735 if(!$result_file->is_multi_way_comparison() || $do_sort)736 {737 $test_result->sort_results_by_performance();738 if($best_is_last)739 {740 $test_result->test_result_buffer->buffer_values_reverse();741 }742 }743 $test_result->dynamically_generated = true;744 $geo_results[] = $test_result;745 }746 return $geo_results;747 }748 public static function generate_harmonic_mean_result($result_file, $do_sort = false, $best_is_last = false)749 {750 $results = array();751 $system_count = $result_file->get_system_count();752 foreach($result_file->get_result_objects() as $result)753 {754 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())755 {756 // 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 results757 continue;758 }759 $rs = $result->test_profile->get_result_scale();760 if(strpos($rs, '/') === false && stripos($rs, ' per ') === false && stripos($rs, 'FPS') === false && stripos($rs, 'bps') === false && stripos($rs, 'iops') === false)761 {762 // Harmonic mean is relevant for tests of rates, MB/s, FPS, ns/day, etc.763 continue;764 }765 foreach($result->test_result_buffer->get_buffer_items() as $buffer_item)766 {767 $ri = $buffer_item->get_result_identifier();768 if(!isset($results[$rs][$ri]))769 {770 $results[$rs][$ri] = array();771 }772 $results[$rs][$ri][] = $buffer_item->get_result_value();773 }774 }775 foreach($results as $result_scale => $group)776 {777 foreach($group as $identifier => $values)778 {779 if(count($values) < 4)780 {781 // If small result file with not a lot of data, don't bother showing...782 unset($results[$result_scale][$identifier]);783 }784 }785 }786 if(!empty($results))787 {788 $test_results = array();789 foreach($results as $result_scale => $group)790 {791 $parsed = array();792 foreach($group as $identifier => $values)793 {794 $parsed[$identifier] = pts_math::harmonic_mean($values);795 }796 if(empty($parsed) || count($parsed) < 2)797 {798 continue;799 }800 $test_profile = new pts_test_profile();801 $test_result = new pts_test_result($test_profile);802 $test_result->test_profile->set_test_title('Harmonic Mean Of ' . $result_scale . ' Test Results');803 $test_result->test_profile->set_identifier(null);804 $test_result->test_profile->set_version(null);805 $test_result->test_profile->set_result_proportion(null);806 $test_result->test_profile->set_display_format('BAR_GRAPH');807 $test_result->test_profile->set_result_scale($result_scale);808 $test_result->test_profile->set_result_proportion('HIB');809 $test_result->set_used_arguments_description('Harmonic Mean');810 $test_result->set_used_arguments('Harmonic-Mean - ' . $result_scale);811 $test_result->test_result_buffer = new pts_test_result_buffer();812 foreach($parsed as $identifier => $values)813 {814 $test_result->test_result_buffer->add_test_result($identifier, pts_math::set_precision($values, 3));815 }816 if(!$result_file->is_multi_way_comparison() || $do_sort)817 {818 $test_result->sort_results_by_performance();819 if($best_is_last)820 {821 $test_result->test_result_buffer->buffer_values_reverse();822 }823 }824 $test_result->dynamically_generated = true;825 $test_results[] = $test_result;826 }827 return $test_results;828 }829 return array();830 }831 public static function display_result_file_stats_pythagorean_means($result_file, $highlight_identifier = null)832 {833 $ret = null;834 foreach(pts_result_file_analyzer::generate_harmonic_mean_result($result_file, true, true) as $harmonic_mean_result)835 {836 $ret .= pts_result_file_output::test_result_to_text($harmonic_mean_result, pts_client::terminal_width(), true, $highlight_identifier, true) . PHP_EOL;837 }838 $geometric_mean = pts_result_file_analyzer::generate_geometric_mean_result($result_file, true, false, true);839 if($geometric_mean)840 {841 $ret .= pts_result_file_output::test_result_to_text($geometric_mean, pts_client::terminal_width(), true, $highlight_identifier, true);842 }843 if($ret != null)844 {845 $ret .= PHP_EOL;846 }847 return $ret;848 }849 public static function display_results_wins_losses($result_file, $highlight_result_identifier = null, $prepend_lines = ' ')850 {851 $output = null;852 $result_file_identifiers_count = $result_file->get_system_count();853 $wins = array();854 $losses = array();855 $tests_counted = 0;856 $possible_evaluate_result_count = 0;857 foreach($result_file->get_result_objects() as $result)858 {859 if($result->test_profile->get_identifier() == null)860 {861 continue;862 }863 $possible_evaluate_result_count++;864 if($result->test_result_buffer->get_count() < 2 || $result->test_result_buffer->get_count() < floor($result_file_identifiers_count / 2))865 {866 continue;867 }868 $tests_counted++;869 $winner = $result->get_result_first();870 $loser = $result->get_result_last();871 if(!isset($wins[$winner]))872 {873 $wins[$winner] = 1;874 }875 else876 {877 $wins[$winner]++;878 }...
get_count
Using AI Code Generation
1require_once('pts-test-result-buffer.php');2$buffer = new pts_test_result_buffer();3$buffer->load_from_file('1.php');4echo $buffer->get_count();5require_once('pts-test-result-buffer.php');6$buffer = new pts_test_result_buffer();7$buffer->load_from_file('1.php');8print_r($buffer->get_result(1));9require_once('pts-test-result-buffer.php');10$buffer = new pts_test_result_buffer();11$buffer->load_from_file('1.php');12print_r($buffer->get_result(0));13require_once('pts-test-result-buffer.php');14$buffer = new pts_test_result_buffer();15$buffer->load_from_file('1.php');16print_r($buffer->get_result(2));17require_once('pts-test-result-buffer.php');18$buffer = new pts_test_result_buffer();19$buffer->load_from_file('1.php');20print_r($buffer->get_result(3));21require_once('pts-test-result-buffer.php');22$buffer = new pts_test_result_buffer();23$buffer->load_from_file('1.php');24print_r($buffer->get_result(4));25require_once('pts-test-result-buffer.php');26$buffer = new pts_test_result_buffer();27$buffer->load_from_file('1.php');28print_r($buffer->get_result(5));29require_once('pts-test-result-buffer.php');30$buffer = new pts_test_result_buffer();31$buffer->load_from_file('1.php');32print_r($buffer->get_result(6));33require_once('pts-test-result-buffer.php');34$buffer = new pts_test_result_buffer();35$buffer->load_from_file('1.php');
get_count
Using AI Code Generation
1require_once('pts-test-result-buffer.php');2$buffer = new pts_test_result_buffer();3$buffer->load_from_file('1.php');4echo $buffer->get_count();5require_once('pts-test-result-buffer.php');6$buffer = new pts_test_result_buffer();7$buffer->load_from_file('1.php');8print_r($buffer->get_result(1));9require_once('pts-test-result-buffer.php');10$buffer = new pts_test_result_buffer();11$buffer->load_from_file('1.php');12print_r($buffer->get_result(0));13require_once('pts-test-result-buffer.php');14$buffer = new pts_test_result_buffer();15$buffer->load_from_file('1.php');16print_r($buffer->get_result(2));17require_once('pts-test-result-buffer.php');18$buffer = new pts_test_result_buffer();19$buffer->load_from_file('1.php');20print_r($buffer->get_result(3));21require_once('pts-test-result-buffer.php');22$buffer = new pts_test_result_buffer();23$buffer->load_from_file('1.php');24print_r($buffer->get_result(4));25require_once('pts-test-result-buffer.php');26$buffer = new pts_test_result_buffer();27$buffer->load_from_file('1.php');28print_r($buffer->get_result(5));29require_once('pts-teresults
get_count
Using AI Code Generation
1include_once('pts_test_result_buffer.php');2$buffer = new pts_test_result_buffer();3echo $buffer->get_count();4How to get the test result by name and test profile and index and date and result identifier and result scale and result value in PHP How to get the test st-resu by name in PHPlt-buffer.php');5$buffer = new pts_test_result_buffer();6$buffer->load_from_file('1.php');7print_r($buffer->get_result(6));8require_once('pts-test-result-buffer.php');9$buffer = new pts_test_result_buffer();10$buffer->load_from_file('1.php');
get_count
Using AI Code Generation
1$buffer = new pts_test_result_buffer();2$buffer->load_results('test_results.xml');3$buffer->get_count();4$buffer = new pts_test_result_buffer();5$buffer->load_results('test_results.xml');6$buffer->get_result(0);7$buffer = new pts_test_result_buffer();8$buffer->load_results('test_results.xml');9$buffer->get_result_object(0);10$buffer = ew pts_test_result_buffer();11$buffer->load_results('test_results.xml');12$buffer->get_result_objects();13$buffer = new pts_test_result_buffer();14$buffer->load_results('test_results.xml');15$buffer->get_result_objects_fltered('test_name');16$buffer = new pts_test_result_buffer();17$buffer->load_results('test_results.xml');18$buffer->get_result_objects_subset(0);19$buffer = new pts_test_result_buffer();20$buffer->load_results('test_results.xml');21$buffer->get_result_objects_subset_count(0);22$buffer = new pts_test_result_buffer();23$buffer->load_results('test_results.xml');24$buffer->get_result_objects_subset_count(0);25$buffer = new pts_test_result_buffer();26$buffer->load_results('test_results.xml');27$buffer->get_result_objects_subset_count(0);28$buffer = new pts_test_result_buffer();29$buffer->load_results('test_results.xml');30$buffer->get_result_objects_subset_count(0);
get_count
Using AI Code Generation
1$test_results = new pts_test_result_buffer();2$test_results->load_results_file('test_results.xml');3echo $test_results->get_count() . PHP_EOL;4$test_results = new pts_test_result_buffer();5$test_results->load_results_file('test_results.xml');6echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;7$test_results = new pts_test_result_buffer();8$test_results->load_results_file('test_results.xml');9echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;10$test_results = new pts_test_result_buffer();11$test_results->load_results_file('test_results.xml');12echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;13$test_results = new pts_test_result_buffer();14$test_results->load_results_file('test_results.xml');15echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;16$test_results = new pts_test_result_buffer();17$test_results->load_results_file('test_results.xml');18echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;19$test_results = new pts_test_result_buffer();20$test_results->load_results_file('test_results.xml');21echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;22$test_results = new pts_test_result_buffer();23$test_results->load_results_file('test_results.xml');24echo $test_results->get_result(0)->get_arguments_description() . PHP_EOL;25$test_results = new pts_test_result_buffer();
get_count
Using AI Code Generation
1$test_result_buffer = new pts_test_result_buffer();2$test_result_buffer->load_from_file('resultfile.xml');3$test_result_buffer->get_count();4$test_result_buffer = new pts_test_result_buffer();5$test_result_buffer->load_from_file('resultfile.xml');6$test_result_buffer->get_result(0);7$test_result_buffer = new pts_test_result_buffer();8$test_result_buffer->load_from_file('resultfile.xml');9$test_result_buffer->get_test_result(0,0);10$test_result_buffer = new pts_test_result_buffer();11$test_result_buffer->load_from_file('resultfile.xml');12$test_result_buffer->get_test_result_object(0,0);13$test_result_buffer = new pts_test_result_buffer();14$test_result_buffer->load_from_file('resultfile.xml');15$test_result_buffer->get_result_identifier(0);16$test_result_buffer = new pts_test_result_buffer();17$test_result_buffer->load_from_file('resultfile.xml');18$test_result_buffer->get_result_identifier(0);19$test_result_buffer = new pts_test_result_buffer();20$test_result_buffer->load_from_file('resultfile.xml');21$test_result_buffer->get_result_identifier(0);22$test_result_buffer = new pts_test_result_buffer();23$test_result_buffer->load_from_file('resultfile.xml');24$test_result_buffer->get_result_identifier(0);
get_count
Using AI Code Generation
1require_once('pts-test-result-buffer.php');2$buffer = new pts_test_result_buffer('test-results.xml');3$count = $buffer->get_count();4echo "count = $count";5require_once('pts-test-result-buffer.php');6$buffer = new pts_test_result_buffer('test-results.xml');7$result = $buffer->get_result();8echo "result = $result";9require_once('pts-test-result-buffer.php');10$buffer = new pts_test_result_buffer('test-results.xml');11$results = $buffer->get_results();12echo "results = $results";13require_once('pts-test-result-buffer.php');14$buffer = new pts_test_result_buffer('test-results.xml');15$result_object = $buffer->get_result_object();16echo "result_object = $result_object";17require_once('pts-test-result-buffer.php');18$buffer = new pts_test_result_buffer('test-results.xml');19$result_objects = $buffer->get_result_objects();20echo "result_objects = $result_objects";21require_once('pts-test-result-buffer.php');22$buffer = new pts_test_result_buffer('test-results.xml');23$result_identifier = $buffer->get_result_identifier();24echo "result_identifier = $result_identifier";
get_count
Using AI Code Generation
1require_once('pts-test-result-buffer.php');2$buffer = new pts_test_result_buffer('test-results.xml');3$count = $buffer->get_count();4echo "count = $count";5require_once('pts-test-result-buffer.php');6$buffer = new pts_test_result_buffer('test-results.xml');7$result = $buffer->get_result();8echo "result = $result";9require_once('pts-test-result-buffer.php');10$buffer = new pts_test_result_buffer('test-results.xml');11$results = $buffer->get_results();12echo "results = $results";13require_once('pts-test-result-buffer.php');14$buffer = new pts_test_result_buffer('test-results.xml');15$result_object = $buffer->get_result_object();16echo "result_object = $result_object";17require_once('pts-test-result-buffer.php');18$buffer = new pts_test_result_buffer('test-results.xml');19$result_objects = $buffer->get_result_objects();20echo "result_objects = $result_objects";21require_once('pts-test-result-buffer.php');22$buffer = new pts_test_result_buffer('test-results.xml');23$result_identifier = $buffer->get_result_identifier();24echo "result_identifier = $result_identifier";
get_count
Using AI Code Generation
1require_once 'pts_test_result_buffer.php';2$test_result_buffer = new pts_test_result_buffer();3$test_result_buffer->load_test_result_buffer('test_result_buffer.xml');4echo $test_result_buffer->get_count();5require_once 'pts_test_result_buffer.php';6$test_result_buffer = new pts_test_result_buffer();7$test_result_buffer->load_test_result_buffer('test_result_buffer.xml');8print_r($test_result_buffer->get_test_result(1));9require_once 'pts_test_result_buffer.php';10$test_result_buffer = new pts_test_result_buffer();11$test_result_buffer->load_test_result_buffer('test_result_buffer.xml');12print_r($test_result_buffer->get_test_result(0));13require_once 'pts_test_result_buffer.php';14$test_result_buffer = new pts_test_result_buffer();15$test_result_buffer->load_test_result_buffer('test_result_buffer.xml');16print_r($test_result_buffer->get_test_result(1));17require_once 'pts_test_result_buffer.php';18$test_result_buffer = new pts_test_result_buffer();19$test_result_buffer->load_test_result_buffer('test_result_buffer.xml');20print_r($test_result_buffer->get_test_result(2));
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 get_count 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!!