How to use check_request_for_var method of pts_result_viewer_embed class

Best Phoronix-test-suite code snippet using pts_result_viewer_embed.check_request_for_var

pts_result_viewer_embed.php

Source:pts_result_viewer_embed.php Github

copy

Full Screen

...180 }181 //$PAGE .= '<a id="table"></a>';182 if(!$result_file->is_multi_way_comparison() && $this->show_html_table_when_relevant)183 {184 $PAGE .= '<div class="pts_result_table">' . pts_result_file_output::result_file_to_detailed_html_table($result_file, 'grid', $extra_attributes, self::check_request_for_var($_REQUEST, 'sdt')) . '</div>';185 }186 else if($result_file->get_test_count() > 3)187 {188 $intent = null;189 $table = new pts_ResultFileTable($result_file, $intent);190 $rendered = pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes);191 $PAGE .= '<p style="text-align: center; overflow: auto;" class="result_object">' . $rendered . '</p>';192 $PAGE .= $this->graph_export_handler($rendered);193 }194 $PAGE .= '</div>';195 $PAGE .= '<a id="table"></a><div id="results">';196 $prev_title = null;197 $identifier_mapping_to_cores = array();198 $identifier_mapping_to_threads = array();199 $identifier_mapping_to_cpu_clock = array();200 $identifier_mapping_to_ram_channels = array();201 if($result_file->get_system_count() > 1 && !$result_file->is_multi_way_comparison())202 {203 $sppt = self::check_request_for_var($_REQUEST, 'sppt');204 $sppc = self::check_request_for_var($_REQUEST, 'sppc');205 $sppm = self::check_request_for_var($_REQUEST, 'sppm');206 if($sppt || $sppc || $sppm)207 {208 foreach($result_file->get_systems() as $system)209 {210 if($sppt)211 {212 $t = $system->get_cpu_core_count();213 if($t > 0)214 {215 $identifier_mapping_to_cores[$system->get_identifier()] = $t;216 }217 $t = $system->get_cpu_thread_count();218 if($t > 0)219 {220 $identifier_mapping_to_threads[$system->get_identifier()] = $t;221 }222 }223 if($sppc)224 {225 $t = $system->get_cpu_clock();226 if($t > 0)227 {228 $identifier_mapping_to_cpu_clock[$system->get_identifier()] = $t;229 }230 }231 if($sppm)232 {233 $t = $system->get_memory_channels();234 if($t > 0)235 {236 $identifier_mapping_to_ram_channels[$system->get_identifier()] = $t;237 }238 }239 }240 if(count(array_unique($identifier_mapping_to_cores)) < 2)241 {242 $identifier_mapping_to_cores = array();243 }244 if(count(array_unique($identifier_mapping_to_threads)) < 2)245 {246 $identifier_mapping_to_threads = array();247 }248 if(count(array_unique($identifier_mapping_to_cpu_clock)) < 2)249 {250 $identifier_mapping_to_cpu_clock = array();251 }252 if(count(array_unique($identifier_mapping_to_ram_channels)) < 2)253 {254 $identifier_mapping_to_ram_channels = array();255 }256 }257 }258 //259 // SHOW THE RESULTS260 //261 $skip_ros = array();262 foreach($result_file->get_result_objects() as $i => $result_object)263 {264 //265 // RENDER TEST AND ANCHOR266 //267 if(in_array($i, $skip_ros))268 {269 continue;270 }271 $ro = clone $result_object;272 $res_desc_shortened = $result_object->get_arguments_description_shortened(false);273 $res = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);274 $PAGE .= '<a id="r-' . $i . '"></a><div style="text-align: center;" id="result-' . $i . '">';275 //276 // DISPLAY TEST PORIFLE METADATA HELPER277 //278 if($this->show_test_metadata_helper && $result_object->test_profile->get_title() != $prev_title)279 {280 $PAGE .= '<h2>' . $result_object->test_profile->get_title() . '</h2>';281 if(is_file(PTS_INTERNAL_OB_CACHE . 'test-profiles/' . $result_object->test_profile->get_identifier() . '/test-definition.xml'))282 {283 $tp = new pts_test_profile(PTS_INTERNAL_OB_CACHE . 'test-profiles/' . $result_object->test_profile->get_identifier() . '/test-definition.xml');284 $PAGE .= '<p class="mini">' . $tp->get_description() . ' <a href="https://openbenchmarking.org/test/' . $result_object->test_profile->get_identifier(false) . '"><em class="hide_on_print">Learn more via the OpenBenchmarking.org test page</em></a>.</p>';285 /* $suites_containing_test = pts_test_suites::suites_containing_test_profile($result_object->test_profile);286 if(!empty($suites_containing_test))287 {288 foreach($suites_containing_test as $suite)289 {290 $PAGE .= $suite->get_title() . ' ' . $suite->get_identifier();291 }292 } */293 }294 $prev_title = $result_object->test_profile->get_title();295 }296 if($res != false)297 {298 //299 // DISPLAY GRAPH300 //301 // Run variability302 $res_per_core = false;303 $res_per_thread = false;304 $res_per_clock = false;305 $res_per_ram = false;306 $res_variability = false;307 if(!in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH', 'BOX_PLOT')) && $result_object->test_result_buffer->detected_multi_sample_result() && $result_object->test_result_buffer->get_count() > 1)308 {309 $extra_attributes['graph_render_type'] = 'HORIZONTAL_BOX_PLOT';310 $ro = clone $result_object;311 $res_variability = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);312 unset($extra_attributes['graph_render_type']);313 }314 if(in_array($result_object->test_profile->get_test_hardware_type(), array('System', 'Processor', 'OS')))315 {316 if(!empty($identifier_mapping_to_cores))317 {318 $ro = pts_result_file_analyzer::get_result_object_custom($result_file, $result_object, $identifier_mapping_to_cores, 'Performance Per Core', 'Core');319 if($ro)320 {321 $res_per_core = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);322 }323 }324 if(!empty($identifier_mapping_to_threads) && $identifier_mapping_to_cores != $identifier_mapping_to_threads)325 {326 $ro = pts_result_file_analyzer::get_result_object_custom($result_file, $result_object, $identifier_mapping_to_threads, 'Performance Per Thread', 'Thread');327 if($ro)328 {329 $res_per_thread = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);330 }331 }332 if(!empty($identifier_mapping_to_cpu_clock))333 {334 $ro = pts_result_file_analyzer::get_result_object_custom($result_file, $result_object, $identifier_mapping_to_cpu_clock, 'Performance Per Clock', 'GHz');335 if($ro)336 {337 $res_per_clock = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);338 }339 }340 }341 if(!empty($identifier_mapping_to_ram_channels) && in_array($result_object->test_profile->get_test_hardware_type(), array('System', 'Processor', 'Memory')))342 {343 $ro = pts_result_file_analyzer::get_result_object_custom($result_file, $result_object, $identifier_mapping_to_ram_channels, 'Performance Per Memory Channel', 'Channel');344 if($ro)345 {346 $res_per_ram = pts_render::render_graph_inline_embed($ro, $result_file, $extra_attributes);347 }348 }349 $tabs = array(350 'Result' => $res351 );352 $show_on_print = array();353 foreach($result_file->get_relation_map($i) as $child_ro)354 {355 $c_ro = $result_file->get_result($child_ro);356 if($c_ro)357 {358 $desc = str_replace(array(' Monitor', $res_desc_shortened ,'()' ,')', ' - '), '', $c_ro->get_arguments_description_shortened(false));359 $dindex = $desc == $res_desc_shortened || empty($desc) ? $c_ro->test_profile->get_result_scale() : $desc;360 $tabs[$dindex] = pts_render::render_graph_inline_embed($c_ro, $result_file, $extra_attributes);361 $show_on_print[] = $dindex;362 $result_file->remove_result_object_by_id($child_ro);363 $skip_ros[] = $child_ro;364 }365 }366 $tabs['Perf Per Core'] = $res_per_core;367 $tabs['Perf Per Thread'] = $res_per_thread;368 $tabs['Perf Per Clock'] = $res_per_clock;369 $tabs['Perf Per RAM Channel'] = $res_per_ram;370 $tabs['Result Confidence'] = $res_variability;371 foreach($tabs as $title => &$graph)372 {373 if(empty($graph))374 {375 unset($tabs[$title]);376 }377 }378 switch(count($tabs))379 {380 case 0:381 continue 2;382 case 1:383 $PAGE .= $res . '<br />';384 $PAGE .= $this->graph_export_handler($res);385 break;386 default:387 $PAGE .= '<div class="tabs">';388 foreach($tabs as $title => &$rendered)389 {390 $tab_id = strtolower(str_replace(' ', '_', $title)) . '_' . $i;391 $PAGE .= '<input type="radio" name="tabs_' . $i . '" id="' . $tab_id . '"' . ($title == 'Result' ? ' checked="checked"' : '') . '>392 <label for="' . $tab_id . '">' . $title . '</label>393 <div class="tab' . (in_array($title, $show_on_print) ? ' print_notes' : '') . '">394 ' . $rendered . $this->graph_export_handler($rendered) . '395 </div>';396 }397 $PAGE .= '</div>';398 }399 }400 //401 // DISPLAY LOGS402 //403 $PAGE .= $this->result_object_to_error_report($result_file, $result_object, $i);404 $button_area = null;405 if($result_file->get_test_run_log_for_result($result_object, -2))406 {407 $button_area .= ' <button onclick="javascript:display_test_logs_for_result_object(\'' . $this->result_public_id . '\', \'' . $i . '\'); return false;">View Test Run Logs</button> ';408 }409 if($result_file->get_install_log_for_test($result_object->test_profile, -2))410 {411 $button_area .= ' <button onclick="javascript:display_install_logs_for_result_object(\'' . $this->result_public_id . '\', \'' . $i . '\'); return false;">View Test Installation Logs</button> ';412 }413 //414 // EDITING / DELETE OPTIONS415 //416 if($this->can_delete_results && !$result_object->dynamically_generated)417 {418 $button_area .= ' <button onclick="javascript:delete_result_from_result_file(\'' . $this->result_public_id . '\', \'' . $i . '\'); return false;">Delete Result</button> ';419 }420 else if($result_object->dynamically_generated)421 {422 $button_area .= ' <button onclick="javascript:hide_result_in_result_file(\'' . $this->result_public_id . '\', \'' . $i . '\'); return false;">Hide Result</button> ';423 }424 if($this->can_modify_results && !$result_object->dynamically_generated)425 {426 if($result_object->get_annotation() == null)427 {428 $button_area .= ' <button onclick="javascript:display_add_annotation_for_result_object(\'' . $this->result_public_id . '\', \'' . $i . '\', this); return false;">Add Annotation</button> ';429 $PAGE .= ' <div id="annotation_area_' . $i . '" style="display: none;"> <form action="#" onsubmit="javascript:add_annotation_for_result_object(\'' . $this->result_public_id . '\', \'' . $i . '\', this); return false;"><textarea rows="4" cols="50" placeholder="Add Annotation..." name="annotation"></textarea><br /><input type="submit" value="Add Annotation"></form></div>';430 }431 else432 {433 $PAGE .= '<div id="update_annotation_' . $i . '" contentEditable="true">' . pts_strings::sanitize($result_object->get_annotation()) . '</div> <input type="submit" value="Update Annotation" onclick="javascript:update_annotation_for_result_object(\'' . $this->result_public_id . '\', \'' . $i . '\'); return false;">';434 }435 }436 else437 {438 $PAGE .= '<p class="mini">' . pts_strings::sanitize($result_object->get_annotation()) . '</p>';439 }440 if($button_area != null)441 {442 $PAGE .= '<p>' . $button_area . '</p>';443 }444 $PAGE .= '</div>';445 unset($result_object);446 }447 if($this->include_page_print_only_helpers)448 {449 $PAGE .= '<div class="print_notes mini" style="font-size: 10px !important;">' . pts_result_file_output::result_file_to_system_html($result_file, true) . '</div>';450 }451 $PAGE .= '</div>';452 return $PAGE;453 }454 public static function html_template_log_viewer($html_to_show, &$result_file)455 {456 return '<!doctype html>457 <html lang="en">458 <head><title>' . ($result_file ? $result_file->get_title() . ' ' : '') . 'Log Viewer</title>459 ' . (defined('CSS_RESULT_VIEWER_PATH') ? '<link rel="stylesheet" href="' . CSS_RESULT_VIEWER_PATH . '">' : '') . '</head>460 <body>' . (empty($html_to_show) ? '<p>No logs available.</p>' : $html_to_show) . '</body></html>';461 }462 public static function display_log_html_or_download(&$log_contents, &$list_of_log_files, $log_selected, &$append_to_html, $title, $identifiers_with_logs = false)463 {464 $append_to_html .= '<h2 align="center">' . $title . ' Logs</h2>';465 if(empty($list_of_log_files) && $identifiers_with_logs && !empty($identifiers_with_logs))466 {467 $append_to_html = '[DEBUG] No log files were found for this system identifier (' . $title . '), but logs were found for: ' . implode(', ', $identifiers_with_logs);468 }469 $append_to_html .= '<div style="text-align: center;"><form action="' . str_replace('&log_select=' . $log_selected, '', str_replace('&download', '', $_SERVER['REQUEST_URI'])) . '" method="post">';470 $append_to_html .= '<input type="hidden" name="modify" value="0" /><select name="log_select" id="log_select" onchange="this.form.submit()">';471 foreach($list_of_log_files as $log_file)472 {473 $append_to_html .= '<option value="' . $log_file . '"' . (isset($_REQUEST['log_select']) && $log_file == $_REQUEST['log_select'] ? 'selected="selected"' : '') . '>' . $log_file . '</option>';474 }475 $append_to_html .= '</select> &nbsp; <input type="submit" value="Show Log"></form></div><br /><hr />';476 $append_to_html .= '<p style="font-size: 12px; margin: 5px; text-align: right"><form action="' . $_SERVER['REQUEST_URI'] . '" method="post"><input type="hidden" name="download" value="download" /><input type="hidden" name="log_select" value="' . $log_selected . '" /><input type="submit" value="Download Log File" style="float: right;"> </form></p>';477 if($log_contents == null)478 {479 $append_to_html .= '<p>No log file available.</p>';480 }481 else if(pts_strings::is_text_string($log_contents) && !isset($_REQUEST['download']))482 {483 $log_contents = phodevi_vfs::cleanse_file($log_contents);484 $log_contents = htmlentities($log_contents);485 $log_contents = str_replace(PHP_EOL, '<br />', $log_contents);486 $append_to_html .= '<br /><pre style="font-family: monospace;">' . $log_contents . '</pre>';487 }488 else if(isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined') // to avoid blocking the popup window in first place if it wasn't explicitly selected489 {490 if(class_exists('finfo'))491 {492 $finfo = new finfo(FILEINFO_MIME);493 header('Content-type: '. $finfo->buffer($log_contents));494 }495 //header('Content-Type: application/octet-stream');496 header('Content-Length: ' . strlen($log_contents));497 header('Content-Disposition: attachment; filename="' . str_ireplace(array('/', '\\', '.'), '', $title) . ' - ' . $log_selected . '"');498 echo $log_contents;499 exit;500 }501 else502 {503 $append_to_html .= '<p>Download log file to view.</p>';504 }505 }506 public static function get_html_sort_bar(&$result_file, &$request)507 {508 $analyze_options = null;509 $drop_down_menus = array('Export Benchmark Data' => array(510 'export=pdf' => 'Result File To PDF',511 'export=txt' => 'Result File To Text',512 'export=html' => 'Result File To HTML',513 'export=json' => 'Result File To JSON',514 // 'export=xml' => 'Result File To XML',515 'export=xml-suite' => 'Result File To Test Suite (XML)',516 'export=csv' => 'Result File To CSV/Excel',517 'export=csv-all' => 'Individual Run Data To CSV/Excel',518 ),519 );520 if(count($result_file->get_system_identifiers()) > 1)521 {522 $drop_down_menus['Sort Result Order'] = array(523 'sro&rro' => 'By Identifier (DESC)',524 'sro' => 'By Identifier (ASC)',525 'sor' => 'By Performance (DESC)',526 'sor&rro' => 'By Performance (ASC)',527 'rdt&rro' => 'By Run Date/Time (DESC)',528 'rdt' => 'By Run Date/Time (ASC)',529 );530 }531 if($result_file->get_test_count() > 1)532 {533 $drop_down_menus['Sort Graph Order'] = array(534 'grs' => 'By Result Spread',535 'gru' => 'By Result Unit',536 'grt' => 'By Test Title',537 'grr' => 'By Test Length/Time'538 );539 }540 $analyze_options .= '<div style="float: right;"><ul>';541 foreach(array_reverse($drop_down_menus, true) as $menu => $sub_menu)542 {543 $analyze_options .= '<li><a href="#">' . $menu . '</a><ul>';544 foreach($sub_menu as $option => $txt)545 {546 $uri = $_SERVER['REQUEST_URI'];547 foreach(array_reverse(array_keys($sub_menu)) as $rem)548 {549 $uri = str_replace('&' . $rem, '', $uri);550 }551 $uri = str_replace('&rro', '', $uri);552 $analyze_options .= '<li><a href="' . $uri . '&' . $option . '">' . $txt . '</a></li>';553 }554 $analyze_options .= '</ul></li>';555 }556 $analyze_options .= '</ul></div>';557 return $analyze_options;558 }559 public static function get_html_options_markup(&$result_file, &$request, $public_id = null, $can_delete_results = false)560 {561 if($public_id == null && defined('RESULTS_VIEWING_ID'))562 {563 $public_id = RESULTS_VIEWING_ID;564 }565 $analyze_options = null;566 // CHECKS FOR DETERMINING OPTIONS TO DISPLAY567 $has_identifier_with_color_brand = false;568 $has_box_plot = false;569 $has_line_graph = false;570 $is_multi_way = $result_file->is_multi_way_comparison();571 $system_count = $result_file->get_system_count();572 foreach($result_file->get_system_identifiers() as $sys)573 {574 if(pts_render::identifier_to_brand_color($sys, null) != null)575 {576 $has_identifier_with_color_brand = true;577 break;578 }579 }580 $multi_test_run_options_tracking = array();581 $tests_with_multiple_versions = array();582 $has_test_with_multiple_options = false;583 $has_test_with_multiple_versions = false;584 foreach($result_file->get_result_objects() as $i => $result_object)585 {586 if(!$has_box_plot && $result_object->test_profile->get_display_format() == 'HORIZONTAL_BOX_PLOT')587 {588 $has_box_plot = true;589 }590 if(!$has_line_graph && $result_object->test_profile->get_display_format() == 'LINE_GRAPH')591 {592 $has_line_graph = true;593 }594 if(!$is_multi_way && !$has_test_with_multiple_options)595 {596 if(!isset($multi_test_run_options_tracking[$result_object->test_profile->get_identifier()]))597 {598 $multi_test_run_options_tracking[$result_object->test_profile->get_identifier()] = array();599 }600 $multi_test_run_options_tracking[$result_object->test_profile->get_identifier()][] = $result_object->get_arguments_description();601 if(count($multi_test_run_options_tracking[$result_object->test_profile->get_identifier()]) > 1)602 {603 $has_test_with_multiple_options = true;604 unset($multi_test_run_options_tracking);605 }606 }607 if(!$is_multi_way && !$has_test_with_multiple_versions)608 {609 $ti_no_version = $result_object->test_profile->get_identifier(false);610 if(!isset($tests_with_multiple_versions[$ti_no_version]))611 {612 $tests_with_multiple_versions[$ti_no_version] = array();613 }614 pts_arrays::unique_push($tests_with_multiple_versions[$ti_no_version], $result_object->test_profile->get_app_version());615 if(count($tests_with_multiple_versions[$ti_no_version]) > 1)616 {617 $has_test_with_multiple_versions = true;618 unset($tests_with_multiple_versions);619 }620 }621 // (optimization) if it has everything, break622 if($has_line_graph && $has_box_plot && $has_test_with_multiple_options && $has_test_with_multiple_versions)623 {624 break;625 }626 }627 $suites_in_result_file = $system_count > 1 ? pts_test_suites::suites_in_result_file($result_file, true, 0) : array();628 // END OF CHECKS629 $analyze_options .= '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">';630 $analyze_checkboxes = array(631 'View' => array(),632 'Statistics' => array(),633 'Sorting' => array(),634 'Graph Settings' => array(),635 'Additional Graphs' => array(),636 'Multi-Way Comparison' => array(),637 );638 if($system_count > 1)639 {640 $analyze_checkboxes['Statistics'][] = array('shm', 'Show Overall Harmonic Mean(s)');641 $analyze_checkboxes['Statistics'][] = array('sgm', 'Show Overall Geometric Mean');642 if(count($suites_in_result_file) > 1)643 {644 $analyze_checkboxes['Statistics'][] = array('sts', 'Show Geometric Means Per-Suite/Category');645 }646 $analyze_checkboxes['Statistics'][] = array('swl', 'Show Wins / Losses Counts (Pie Chart)');647 $analyze_checkboxes['Statistics'][] = array('nor', 'Normalize Results');648 $analyze_checkboxes['Graph Settings'][] = array('ftr', 'Force Line Graphs Where Applicable');649 $analyze_checkboxes['Graph Settings'][] = array('scalar', 'Convert To Scalar Where Applicable');650 $analyze_checkboxes['View'][] = array('hnr', 'Do Not Show Noisy Results');651 $analyze_checkboxes['View'][] = array('hni', 'Do Not Show Results With Incomplete Data');652 $analyze_checkboxes['View'][] = array('hlc', 'Do Not Show Results With Little Change/Spread');653 $analyze_checkboxes['View'][] = array('spr', 'List Notable Results');654 if($has_identifier_with_color_brand)655 {656 $analyze_checkboxes['Graph Settings'][] = array('ncb', 'Disable Color Branding');657 }658 // Additional Graphs659 if(!$result_file->is_multi_way_comparison())660 {661 $identifier_mapping_to_cores = array();662 $identifier_mapping_to_threads = array();663 $identifier_mapping_to_cpu_clock = array();664 $identifier_mapping_to_ram_channels = array();665 foreach($result_file->get_systems() as $system)666 {667 $t = $system->get_cpu_core_count();668 if($t > 0)669 {670 $identifier_mapping_to_cores[$system->get_identifier()] = $t;671 }672 $t = $system->get_cpu_thread_count();673 if($t > 0)674 {675 $identifier_mapping_to_threads[$system->get_identifier()] = $t;676 }677 $t = $system->get_cpu_clock();678 if($t > 0)679 {680 $identifier_mapping_to_cpu_clock[$system->get_identifier()] = $t;681 }682 $t = $system->get_memory_channels();683 if($t > 0)684 {685 $identifier_mapping_to_ram_channels[$system->get_identifier()] = $t;686 }687 }688 if(count(array_unique($identifier_mapping_to_cores)) > 1 || count(array_unique($identifier_mapping_to_threads)) > 1)689 {690 $analyze_checkboxes['Additional Graphs'][] = array('sppt', 'Show Perf Per Core/Thread Calculation Graphs Where Applicable');691 }692 if(count(array_unique($identifier_mapping_to_cpu_clock)) > 1)693 {694 $analyze_checkboxes['Additional Graphs'][] = array('sppc', 'Show Perf Per Clock Calculation Graphs Where Applicable');695 }696 if(count(array_unique($identifier_mapping_to_ram_channels)) > 1)697 {698 $analyze_checkboxes['Additional Graphs'][] = array('sppm', 'Show Perf Per RAM Channel Calculation Graphs Where Applicable');699 }700 }701 }702 if(count($suites_in_result_file) > 1)703 {704 $suite_limit = '<h3>Limit displaying results to tests within:</h3>';705 $stis = self::check_request_for_var($request, 'stis');706 if(!is_array($stis))707 {708 $stis = explode(',', $stis);709 }710 ksort($suites_in_result_file);711 $suite_limit .= '<div style="max-height: 250px; overflow: scroll;">';712 foreach($suites_in_result_file as $suite_identifier => $s)713 {714 list($suite, $contained_tests) = $s;715 $id = rtrim(base64_encode($suite_identifier), '=');716 $suite_limit .= '<input type="checkbox" name="stis[]" value="' . $id . '"' . (is_array($stis) && in_array($id, $stis) ? ' checked="checked"' : null) . ' /> ' . $suite->get_title() . ' <sup><em>' . count($contained_tests) . ' Tests</em></sup><br />';717 }718 $suite_limit .= '</div>';719 $analyze_checkboxes['View'][] = array('', $suite_limit);720 }721 $analyze_checkboxes['Graph Settings'][] = array('vb', 'Prefer Vertical Bar Graphs');722 $analyze_checkboxes['Statistics'][] = array('rol', 'Remove Outliers Before Calculating Averages');723 //$analyze_checkboxes['Statistics'][] = array('gtb', 'Graph Values Of All Runs (Box Plot)');724 //$analyze_checkboxes['Statistics'][] = array('gtl', 'Graph Values Of All Runs (Line Graph)');725 if($has_box_plot || $has_line_graph)726 {727 $analyze_checkboxes['Graph Settings'][] = array('nbp', 'No Box Plots');728 }729 if($is_multi_way && $system_count > 1)730 {731 $analyze_checkboxes['Multi-Way Comparison'][] = array('cmw', 'Condense Comparison');732 }733 if(($is_multi_way && $system_count > 1) || self::check_request_for_var($request, 'cmv') || self::check_request_for_var($request, 'cts'))734 {735 $analyze_checkboxes['Multi-Way Comparison'][] = array('imw', 'Transpose Comparison');736 }737 if((!$is_multi_way && $has_test_with_multiple_options && !self::check_request_for_var($request, 'cmv')) || self::check_request_for_var($request, 'cts'))738 {739 $analyze_checkboxes['Multi-Way Comparison'][] = array('cts', 'Condense Multi-Option Tests Into Single Result Graphs');740 }741 if((!$is_multi_way && $has_test_with_multiple_versions && !self::check_request_for_var($request, 'cts')) || self::check_request_for_var($request, 'cmv'))742 {743 $analyze_checkboxes['Multi-Way Comparison'][] = array('cmv', 'Condense Test Profiles With Multiple Version Results Into Single Result Graphs');744 }745 $analyze_checkboxes['Table'][] = array('sdt', 'Show Detailed System Result Table');746 $t = null;747 foreach($analyze_checkboxes as $title => $group)748 {749 if(empty($group))750 {751 continue;752 }753 $t .= '<div class="pts_result_viewer_settings_box">';754 $t .= '<h2>' . $title . '</h2>';755 foreach($group as $key)756 {757 if($key[0] == null)758 {759 $t .= $key[1] . '<br />';760 }761 else762 {763 $t .= '<input type="checkbox" name="' . $key[0] . '" value="1"' . (self::check_request_for_var($request, $key[0]) ? ' checked="checked"' : null) . ' /> ' . $key[1] . '<br />';764 }765 }766 $t .= '</div>';767 }768 if($system_count > 0)769 {770 $has_system_logs = $result_file->system_logs_available();771 $t .= '<div style="clear: both;"><h2>Run Management</h2>772 <div class="div_table">773 <div class="div_table_body">774 <div class="div_table_first_row">';775 if($system_count > 1)776 {777 $t .= '<div class="div_table_cell">Highlight<br />Result</div>778 <div class="div_table_cell">Hide<br />Result</div>';779 }780 $t .= '<div class="div_table_cell">Result<br />Identifier</div>';781 if($has_system_logs)782 {783 $t .= '<div class="div_table_cell">View Logs</div>';784 }785 $t .= '<div class="div_table_cell">Performance Per<br />Dollar</div>786 <div class="div_table_cell">Date<br />Run</div>787 <div class="div_table_cell"> &nbsp; Test<br /> &nbsp; Duration</div>788 <div class="div_table_cell"> </div>789 </div>790 ';791 $hgv = self::check_request_for_var($request, 'hgv');792 if(!is_array($hgv))793 {794 $hgv = explode(',', $hgv);795 }796 $rmm = self::check_request_for_var($request, 'rmm');797 if(!is_array($rmm))798 {799 $rmm = explode(',', $rmm);800 }801 $start_of_year = strtotime(date('Y-01-01'));802 $test_run_times = $result_file->get_test_run_times();803 foreach($result_file->get_systems() as $sys)804 {805 $si = $sys->get_identifier();806 $ppdx = rtrim(base64_encode($si), '=');807 $ppd = self::check_request_for_var($request, 'ppd_' . $ppdx);808 $t .= '809 <div id="table-line-' . $ppdx . '" class="div_table_row">';810 if($system_count > 1)811 {812 $t .= '<div class="div_table_cell"><input type="checkbox" name="hgv[]" value="' . $si . '"' . (is_array($hgv) && in_array($si, $hgv) ? ' checked="checked"' : null) . ' /></div>813 <div class="div_table_cell"><input type="checkbox" name="rmm[]" value="' . $si . '"' . (is_array($rmm) && in_array($si, $rmm) ? ' checked="checked"' : null) . ' /></div>';814 }815 $t .= '<div class="div_table_cell"><strong>' . $si . '</strong></div>';816 if($has_system_logs)817 {818 $t .= '<div class="div_table_cell">' . ($system_count == 1 || $sys->has_log_files() ? '<button type="button" onclick="javascript:display_system_logs_for_result(\'' . $public_id . '\', \'' . $sys->get_original_identifier() . '\'); return false;">View System Logs</button>' : ' ') . '</div>';819 }820 $stime = strtotime($sys->get_timestamp());821 $t .= '<div class="div_table_cell"><input type="number" min="0" step="0.001" name="ppd_' . $ppdx . '" value="' . ($ppd && $ppd !== true ? strip_tags($ppd) : '0') . '" /></div>822 <div class="div_table_cell">' . date(($stime > $start_of_year ? 'F d' : 'F d Y'), $stime) . '</div>823 <div class="div_table_cell"> &nbsp; ' . (isset($test_run_times[$si]) && $test_run_times[$si] > 0 ? pts_strings::format_time($test_run_times[$si], 'SECONDS', true, 60) : ' ') . '</div>';824 if($can_delete_results && !empty($public_id))825 {826 $t .= '<div class="div_table_cell">';827 if($system_count > 1)828 {829 $t .= '<button type="button" onclick="javascript:delete_run_from_result_file(\'' . $public_id . '\', \'' . $si . '\', \'' . $ppdx . '\'); return false;">Delete Run</button> ';830 }831 $t .= '<button type="button" onclick="javascript:rename_run_in_result_file(\'' . $public_id . '\', \'' . $si . '\'); return false;">Rename Run</button></div>';832 }833 $t .= '</div>';834 }835 if($system_count > 1)836 {837 $t .= '838 <div class="div_table_row">839 <div class="div_table_cell"> </div>840 <div class="div_table_cell"><input type="checkbox" onclick="javascript:invert_hide_all_results_checkboxes();" /></div>841 <div class="div_table_cell"><em>Invert Hiding All Results Option</em></div>';842 if($has_system_logs)843 {844 $t .= '<div class="div_table_cell"> </div>';845 }846 $t .= '<div class="div_table_cell">' . self::html_select_menu('ppt', 'ppt', null, array('D' => 'Dollar', 'DPH' => 'Dollar / Hour'), true) . '</div>847 <div class="div_table_cell"> </div>848 <div class="div_table_cell"> &nbsp; <em>' . pts_strings::format_time(array_sum($test_run_times) / count($test_run_times), 'SECONDS', true, 60) . '</em></div>849 <div class="div_table_cell">';850 if($can_delete_results)851 {852 $t .= '<button type="button" onclick="javascript:reorder_result_file(\'' . $public_id . '\'); return false;">Sort / Reorder Runs</button>';853 }854 $t .= '</div></div>';855 }856 $t .= '857 </div>858 </div></div>';859 }860 $analyze_options .= $t;861 if($system_count > 2)862 {863 $analyze_options .= '<br /><div>Only show results where ' . self::html_select_menu('ftt', 'ftt', null, array_merge(array(null), $result_file->get_system_identifiers()), false) . ' is faster than ' . self::html_select_menu('ftb', 'ftb', null, array_merge(array(null), $result_file->get_system_identifiers()), false) . '</div>';864 }865 if($result_file->get_test_count() > 1)866 {867 $analyze_options .= '<div>Only show results matching title/arguments (delimit multiple options with a comma): ' . self::html_input_field('oss', 'oss') . '</div>';868 }869 $analyze_options .= '<br /><input style="clear: both;" name="submit" value="Refresh Results" type="submit" /></form>';870 return $analyze_options;871 }872 public static function process_result_export_pre_render(&$request, &$result_file, &$extra_attributes, $can_modify_results = false, $can_delete_results = false)873 {874 if(self::check_request_for_var($request, 'rdt'))875 {876 $result_file->reorder_runs($result_file->get_system_identifiers_by_date());877 }878 // Result export?879 $result_title = (isset($_GET['result']) ? $_GET['result'] : 'result');880 switch(isset($_REQUEST['export']) ? $_REQUEST['export'] : '')881 {882 case '':883 break;884 case 'pdf':885 header('Content-Type: application/pdf');886 $pdf_output = pts_result_file_output::result_file_to_pdf($result_file, $result_title . '.pdf', 'D', $extra_attributes);887 exit;888 case 'html':889 $referral_url = '';890 if(defined('OPENBENCHMARKING_BUILD'))891 {892 $referral_url = 'https://openbenchmarking.org' . str_replace('&export=html', '', $_SERVER['REQUEST_URI']);893 }894 echo pts_result_file_output::result_file_to_html($result_file, $extra_attributes, $referral_url);895 exit;896 case 'json':897 header('Content-Type: application/json');898 echo pts_result_file_output::result_file_to_json($result_file);899 exit;900 case 'csv':901 $result_csv = pts_result_file_output::result_file_to_csv($result_file, ',', $extra_attributes);902 header('Content-Description: File Transfer');903 header('Content-Type: application/csv');904 header('Content-Disposition: attachment; filename=' . $result_title . '.csv');905 header('Expires: 0');906 header('Cache-Control: must-revalidate');907 header('Pragma: public');908 header('Content-Length: ' . strlen($result_csv));909 echo $result_csv;910 exit;911 case 'csv-all':912 $result_csv = pts_result_file_output::result_file_raw_to_csv($result_file);913 header('Content-Description: File Transfer');914 header('Content-Type: application/csv');915 header('Content-Disposition: attachment; filename=' . $result_title . '.csv');916 header('Expires: 0');917 header('Cache-Control: must-revalidate');918 header('Pragma: public');919 header('Content-Length: ' . strlen($result_csv));920 echo $result_csv;921 exit;922 case 'txt':923 $result_txt = pts_result_file_output::result_file_to_text($result_file);924 header('Content-Description: File Transfer');925 header('Content-Type: text/plain');926 header('Content-Disposition: attachment; filename=' . $result_title . '.txt');927 header('Expires: 0');928 header('Cache-Control: must-revalidate');929 header('Pragma: public');930 header('Content-Length: ' . strlen($result_txt));931 echo $result_txt;932 exit;933 case 'xml-suite':934 $suite_xml = pts_result_file_output::result_file_to_suite_xml($result_file);935 header('Content-Description: File Transfer');936 header('Content-Type: text/xml');937 header('Content-Disposition: attachment; filename=' . $result_title . '-suite.xml');938 header('Expires: 0');939 header('Cache-Control: must-revalidate');940 header('Pragma: public');941 header('Content-Length: ' . strlen($suite_xml));942 echo $suite_xml;943 exit;944 case 'xml':945 $result_xml = $result_file->get_xml(null, true);946 header('Content-Description: File Transfer');947 header('Content-Type: text/xml');948 header('Content-Disposition: attachment; filename=' . $result_title . '.xml');949 header('Expires: 0');950 header('Cache-Control: must-revalidate');951 header('Pragma: public');952 header('Content-Length: ' . strlen($result_xml));953 echo $result_xml;954 exit;955 case 'view_system_logs':956 $html_viewer = '';957 foreach($result_file->get_systems() as $system)958 {959 $sid = base64_decode($_REQUEST['system_id']);960 if($system->get_original_identifier() == $sid || $system->get_identifier() == $sid)961 {962 $system_logs = $system->log_files();963 $identifiers_with_logs = empty($system_logs) ? $result_file->identifiers_with_system_logs() : array();964 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' && $_REQUEST['log_select'] != null ? $_REQUEST['log_select'] : (isset($system_logs[0]) ? $system_logs[0] : '');965 $log_contents = $system->log_files($show_log, false);966 pts_result_viewer_embed::display_log_html_or_download($log_contents, $system_logs, $show_log, $html_viewer, $sid, $identifiers_with_logs);967 break;968 }969 }970 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);971 exit;972 case 'view_install_logs':973 $html_viewer = '';974 if(isset($_REQUEST['result_object']))975 {976 if(($result_object = $result_file->get_result_object_by_hash($_REQUEST['result_object'])))977 {978 $install_logs = $result_file->get_install_log_for_test($result_object->test_profile, false);979 if(count($install_logs) > 0)980 {981 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' ? $_REQUEST['log_select'] : (isset($install_logs[0]) ? $install_logs[0] : '');982 $log_contents = $result_file->get_install_log_for_test($result_object->test_profile, $show_log, false);983 pts_result_viewer_embed::display_log_html_or_download($log_contents, $install_logs, $show_log, $html_viewer, $result_object->test_profile->get_title() . ' Installation');984 }985 }986 }987 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);988 exit;989 case 'view_test_logs':990 $html_viewer = '';991 if(isset($_REQUEST['result_object']))992 {993 if(($result_object = $result_file->get_result_object_by_hash($_REQUEST['result_object'])))994 {995 if(($test_logs = $result_file->get_test_run_log_for_result($result_object, false)))996 {997 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' ? $_REQUEST['log_select'] : (isset($test_logs[0]) ? $test_logs[0] : '');998 $log_contents = $result_file->get_test_run_log_for_result($result_object, $show_log, false);999 pts_result_viewer_embed::display_log_html_or_download($log_contents, $test_logs, $show_log, $html_viewer, trim($result_object->test_profile->get_title() . ' ' . $result_object->get_arguments_description()));1000 }1001 }1002 }1003 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);1004 exit;1005 }1006 }1007 public static function process_result_modify_pre_render(&$result_file, $can_modify_results = false, $can_delete_results = false)1008 {1009 if(!isset($_REQUEST['modify']) || ($can_modify_results == false && $can_delete_results == false))1010 {1011 return;1012 }1013 switch($_REQUEST['modify'])1014 {1015 case 'update-result-file-meta':1016 if($can_modify_results && isset($_REQUEST['result_title']) && isset($_REQUEST['result_desc']))1017 {1018 $result_file->set_title($_REQUEST['result_title']);1019 $result_file->set_description($_REQUEST['result_desc']);1020 $result_file->save();1021 }1022 exit;1023 case 'remove-result-object':1024 if($can_delete_results && isset($_REQUEST['result_object']))1025 {1026 if($result_file->remove_result_object_by_id($_REQUEST['result_object']))1027 {1028 $result_file->save();1029 }1030 }1031 exit;1032 case 'remove-result-run':1033 if($can_delete_results && isset($_REQUEST['result_run']))1034 {1035 if($result_file->remove_run($_REQUEST['result_run']))1036 {1037 $result_file->save();1038 }1039 }1040 exit;1041 case 'rename-result-run':1042 if(VIEWER_CAN_MODIFY_RESULTS && isset($_REQUEST['result_run']) && isset($_REQUEST['new_result_run']))1043 {1044 if($result_file->rename_run($_REQUEST['result_run'], $_REQUEST['new_result_run']))1045 {1046 $result_file->save();1047 }1048 }1049 exit;1050 case 'add-annotation-to-result-object':1051 if($can_modify_results && isset($_REQUEST['result_object']) && isset($_REQUEST['annotation']))1052 {1053 if($result_file->update_annotation_for_result_object_by_id($_REQUEST['result_object'], $_REQUEST['annotation']))1054 {1055 $result_file->save();1056 }1057 }1058 exit;1059 case 'reorder_result_file':1060 if($can_modify_results)1061 {1062 if(count($result_file_identifiers = $result_file->get_system_identifiers()) > 1)1063 {1064 if(isset($_POST['reorder_post']))1065 {1066 $sort_array = array();1067 foreach($result_file_identifiers as $i => $id)1068 {1069 if(isset($_POST[base64_encode($id)]))1070 {1071 $sort_array[$id] = $_POST[base64_encode($id)];1072 }1073 }1074 asort($sort_array);1075 $sort_array = array_keys($sort_array);1076 $result_file->reorder_runs($sort_array);1077 $result_file->save();1078 echo '<p>Result file is now reordered. <script> window.close(); </script></p>';1079 }1080 else if(isset($_POST['auto_sort']))1081 {1082 sort($result_file_identifiers);1083 $result_file->reorder_runs($result_file_identifiers);1084 $result_file->save();1085 echo '<p>Result file is now auto-sorted. <script> window.close(); </script></p>';1086 }1087 else1088 {1089 echo '<p>Reorder the result file as desired by altering the numbering from lowest to highest.</p>';1090 echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">';1091 foreach($result_file_identifiers as $i => $id)1092 {1093 echo '<input style="width: 80px;" name="' . base64_encode($id) . '" type="number" min="0" value="' . ($i + 1) . '" />' . $id . '<br />';1094 }1095 echo '<input type="hidden" name="reorder_post" value="1" /><input type="submit" value="Reorder Results" /></form>';1096 echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">';1097 echo '<input type="hidden" name="auto_sort" value="1" /><input type="submit" value="Auto-Sort Result File" /></form>';1098 }1099 }1100 }1101 exit;1102 }1103 }1104 public static function process_helper_html(&$request, &$result_file, &$extra_attributes, $can_modify_results = false, $can_delete_results = false)1105 {1106 self::process_result_export_pre_render($request, $result_file, $extra_attributes, $can_modify_results, $can_delete_results);1107 $html = null;1108 if(self::check_request_for_var($request, 'spr'))1109 {1110 $results = $result_file->get_result_objects();1111 $spreads = array();1112 foreach($results as $i => &$result_object)1113 {1114 $spreads[$i] = $result_object->get_spread();1115 }1116 arsort($spreads);1117 $spreads = array_slice($spreads, 0, min((int)(count($results) / 4), 10), true);1118 if(!empty($spreads))1119 {1120 $html .= '<h3>Notable Results</h3>';1121 foreach($spreads as $result_key => $spread)1122 {1123 $ro = $result_file->get_result_objects($result_key);1124 if(!is_object($ro[0]))1125 {1126 continue;1127 }1128 $html .= '<a href="#r-' . $result_key . '">' . $ro[0]->test_profile->get_title() . ' - ' . $ro[0]->get_arguments_description() . '</a><br />';1129 }1130 }1131 }1132 return $html;1133 }1134 public static function check_request_for_var(&$request, $check)1135 {1136 // the obr_ check is to maintain OpenBenchmarking.org compatibility for its original variable naming to preserve existing URLs1137 $ret = false;1138 if(defined('OPENBENCHMARKING_BUILD') && isset($request['obr_' . $check]))1139 {1140 $ret = empty($request['obr_' . $check]) ? true : $request['obr_' . $check];1141 }1142 if(isset($request[$check]))1143 {1144 $ret = empty($request[$check]) ? true : $request[$check];1145 }1146 if($ret && isset($ret[5]))1147 {1148 $ret = str_replace('_DD_', '.', $ret);1149 }1150 return $ret;1151 }1152 public static function process_request_to_attributes(&$request, &$result_file, &$extra_attributes)1153 {1154 if(($oss = self::check_request_for_var($request, 'oss')))1155 {1156 $oss = pts_strings::comma_explode($oss);1157 foreach($result_file->get_result_objects() as $i => $result_object)1158 {1159 $matched = false;1160 foreach($oss as $search_check)1161 {1162 if(stripos($result_object->get_arguments_description(), $search_check) === false && stripos($result_object->test_profile->get_identifier(), $search_check) === false && stripos($result_object->test_profile->get_title(), $search_check) === false)1163 {1164 // Not found1165 $matched = false;1166 }1167 else1168 {1169 $matched = true;1170 break;1171 }1172 }1173 if(!$matched)1174 {1175 $result_file->remove_result_object_by_id($i);1176 }1177 }1178 }1179 if(self::check_request_for_var($request, 'ftt') && self::check_request_for_var($request, 'ftt'))1180 {1181 $ftt = self::check_request_for_var($request, 'ftt');1182 $ftb = self::check_request_for_var($request, 'ftb');1183 if(!empty($ftt) && !empty($ftb) && $ftt !== true && $ftb !== true)1184 {1185 foreach($result_file->get_result_objects() as $i => $result_object)1186 {1187 $ftt_result = $result_object->test_result_buffer->get_result_from_identifier($ftt);1188 $ftb_result = $result_object->test_result_buffer->get_result_from_identifier($ftb);1189 if($ftt_result && $ftb_result)1190 {1191 $ftt_wins = false;1192 if($result_object->test_profile->get_result_proportion() == 'HIB')1193 {1194 if($ftt_result > $ftb_result)1195 {1196 $ftt_wins = true;1197 }1198 }1199 else1200 {1201 if($ftt_result < $ftb_result)1202 {1203 $ftt_wins = true;1204 }1205 }1206 if(!$ftt_wins)1207 {1208 $result_file->remove_result_object_by_id($i);1209 }1210 }1211 else1212 {1213 $result_file->remove_result_object_by_id($i);1214 }1215 }1216 }1217 }1218 if(($stis = self::check_request_for_var($request, 'stis')))1219 {1220 if(!is_array($stis))1221 {1222 $stis = explode(',', $stis);1223 }1224 $suites_in_result_file = pts_test_suites::suites_in_result_file($result_file, true, 0);1225 $tests_to_show = array();1226 foreach($stis as $suite_to_show)1227 {1228 $suite_to_show = base64_decode($suite_to_show);1229 if(isset($suites_in_result_file[$suite_to_show]))1230 {1231 foreach($suites_in_result_file[$suite_to_show][1] as $test_to_show)1232 {1233 $tests_to_show[] = $test_to_show;1234 }1235 }1236 }1237 if(!empty($tests_to_show))1238 {1239 foreach($result_file->get_result_objects() as $i => $result_object)1240 {1241 if($result_object->get_parent_hash())1242 {1243 if(!$result_file->get_result_object_by_hash($result_object->get_parent_hash()) || !in_array($result_file->get_result_object_by_hash($result_object->get_parent_hash())->test_profile->get_identifier(false), $tests_to_show))1244 {1245 $result_file->remove_result_object_by_id($i);1246 }1247 }1248 else if(!in_array($result_object->test_profile->get_identifier(false), $tests_to_show))1249 {1250 $result_file->remove_result_object_by_id($i);1251 }1252 }1253 }1254 }1255 if(self::check_request_for_var($request, 'hlc'))1256 {1257 foreach($result_file->get_result_objects() as $i => $result_object)1258 {1259 if($result_object->result_flat())1260 {1261 $result_file->remove_result_object_by_id($i);1262 }1263 }1264 }1265 if(self::check_request_for_var($request, 'hnr'))1266 {1267 $result_file->remove_noisy_results();1268 }1269 if(self::check_request_for_var($request, 'hni'))1270 {1271 $system_count = $result_file->get_system_count();1272 foreach($result_file->get_result_objects() as $i => $result_object)1273 {1274 if($result_object->test_result_buffer->get_count() < $system_count)1275 {1276 $result_file->remove_result_object_by_id($i);1277 }1278 }1279 }1280 if(self::check_request_for_var($request, 'grs'))1281 {1282 $result_file->sort_result_object_order_by_spread();1283 }1284 else if(self::check_request_for_var($request, 'grt'))1285 {1286 $result_file->sort_result_object_order_by_title();1287 }1288 else if(self::check_request_for_var($request, 'gru'))1289 {1290 $result_file->sort_result_object_order_by_result_scale();1291 }1292 else if(self::check_request_for_var($request, 'grr'))1293 {1294 $result_file->sort_result_object_order_by_run_time();1295 }1296 if(self::check_request_for_var($request, 'shm'))1297 {1298 foreach(pts_result_file_analyzer::generate_harmonic_mean_result($result_file) as $result)1299 {1300 if($result)1301 {1302 $result_file->add_result($result);1303 }1304 }1305 }1306 if(self::check_request_for_var($request, 'sgm'))1307 {1308 $result = pts_result_file_analyzer::generate_geometric_mean_result($result_file);1309 if($result)1310 {1311 $result_file->add_result($result);1312 }1313 }1314 if(self::check_request_for_var($request, 'sts'))1315 {1316 foreach(pts_result_file_analyzer::generate_geometric_mean_result_for_suites_in_result_file($result_file, true, 0) as $result)1317 {1318 if($result)1319 {1320 $result_file->add_result($result);1321 }1322 }1323 }1324 if(self::check_request_for_var($request, 'swl'))1325 {1326 foreach(pts_result_file_analyzer::generate_wins_losses_results($result_file) as $result)1327 {1328 if($result)1329 {1330 $result_file->add_result($result);1331 }1332 }1333 }1334 if(self::check_request_for_var($request, 'cts'))1335 {1336 pts_result_file_analyzer::condense_result_file_by_multi_option_tests($result_file);1337 }1338 if(self::check_request_for_var($request, 'cmv'))1339 {1340 pts_result_file_analyzer::condense_result_file_by_multi_version_tests($result_file);1341 }1342 if(self::check_request_for_var($request, 'sor'))1343 {1344 $extra_attributes['sort_result_buffer_values'] = true;1345 }1346 if(self::check_request_for_var($request, 'rro'))1347 {1348 $extra_attributes['reverse_result_buffer'] = true;1349 }1350 if(self::check_request_for_var($request, 'sro'))1351 {1352 $extra_attributes['sort_result_buffer'] = true;1353 }1354 if(self::check_request_for_var($request, 'nor'))1355 {1356 $extra_attributes['normalize_result_buffer'] = true;1357 }1358 if(self::check_request_for_var($request, 'ftr'))1359 {1360 $extra_attributes['force_tracking_line_graph'] = true;1361 }1362 if(self::check_request_for_var($request, 'imw'))1363 {1364 $extra_attributes['multi_way_comparison_invert_default'] = false;1365 }1366 if(self::check_request_for_var($request, 'cmw'))1367 {1368 $extra_attributes['condense_multi_way'] = true;1369 }1370 if(($hgv = self::check_request_for_var($request, 'hgv')))1371 {1372 if(is_array($hgv))1373 {1374 $extra_attributes['highlight_graph_values'] = $hgv;1375 }1376 else1377 {1378 $extra_attributes['highlight_graph_values'] = explode(',', $hgv);1379 }1380 }1381 else if(self::check_request_for_var($request, 'hgv_base64'))1382 {1383 $extra_attributes['highlight_graph_values'] = explode(',', base64_decode(self::check_request_for_var($request, 'hgv_base64')));1384 }1385 if(($rmm = self::check_request_for_var($request, 'rmm')))1386 {1387 if(!is_array($rmm))1388 {1389 $rmm = explode(',', $rmm);1390 }1391 foreach($rmm as $rm)1392 {1393 $result_file->remove_run($rm);1394 }1395 }1396 if(self::check_request_for_var($request, 'scalar'))1397 {1398 $extra_attributes['compact_to_scalar'] = true;1399 }1400 if(self::check_request_for_var($request, 'ncb'))1401 {1402 $extra_attributes['no_color_branding'] = true;1403 }1404 if(self::check_request_for_var($request, 'nbp'))1405 {1406 $extra_attributes['no_box_plots'] = true;1407 }1408 if(self::check_request_for_var($request, 'vb'))1409 {1410 $extra_attributes['vertical_bars'] = true;1411 }1412 /*1413 if(self::check_request_for_var($request, 'gtb'))1414 {1415 $extra_attributes['graph_render_type'] = 'HORIZONTAL_BOX_PLOT';1416 }1417 else if(self::check_request_for_var($request, 'gtl'))1418 {1419 $extra_attributes['graph_render_type'] = 'LINE_GRAPH';1420 $extra_attributes['graph_raw_values'] = true;1421 }1422 */1423 if(self::check_request_for_var($request, 'rol'))1424 {1425 foreach($result_file->get_result_objects() as $i => $result_object)1426 {1427 $result_object->recalculate_averages_without_outliers(1.5);1428 }1429 }1430 $perf_per_dollar_values = array();1431 foreach($result_file->get_system_identifiers() as $si)1432 {1433 $ppd = self::check_request_for_var($request, 'ppd_' . rtrim(base64_encode($si), '='));1434 if($ppd && $ppd > 0 && is_numeric($ppd))1435 {1436 $perf_per_dollar_values[$si] = $ppd;1437 }1438 }1439 if(!empty($perf_per_dollar_values))1440 {1441 $perf_per_hour = self::check_request_for_var($request, 'ppt') == 'DPH';1442 pts_result_file_analyzer::generate_perf_per_dollar($result_file, $perf_per_dollar_values, 'Dollar', false, $perf_per_hour);1443 }1444 }1445 public static function html_input_field($name, $id, $on_change = null)1446 {1447 return '<input type="text" name="' . $name . '" id="' . $id . '" onclick="" value="' . (isset($_REQUEST[$name]) ? strip_tags($_REQUEST[$name]) : null) . '">';1448 }1449 public static function html_select_menu($name, $id, $on_change, $elements, $use_index = true, $other_attributes = array(), $selected = false)1450 {1451 $tag = null;1452 foreach($other_attributes as $i => $v)1453 {1454 $tag .= ' ' . $i . '="' . $v . '"';1455 }...

Full Screen

Full Screen

pts_result_viewer_settings.php

Source:pts_result_viewer_settings.php Github

copy

Full Screen

...166 }167 if(count($suites_in_result_file) > 1)168 {169 $suite_limit = '<h3>Limit displaying results to tests within:</h3>';170 $stis = self::check_request_for_var($request, 'stis');171 if(!is_array($stis))172 {173 $stis = explode(',', $stis);174 }175 ksort($suites_in_result_file);176 $suite_limit .= '<div style="max-height: 250px; overflow: scroll;">';177 foreach($suites_in_result_file as $suite_identifier => $s)178 {179 list($suite, $contained_tests) = $s;180 $id = rtrim(base64_encode($suite_identifier), '=');181 $suite_limit .= '<input type="checkbox" name="stis[]" value="' . $id . '"' . (is_array($stis) && in_array($id, $stis) ? ' checked="checked"' : null) . ' /> ' . $suite->get_title() . ' <sup><em>' . count($contained_tests) . ' Tests</em></sup><br />';182 }183 $suite_limit .= '</div>';184 $analyze_checkboxes['View'][] = array('', $suite_limit);185 }186 $analyze_checkboxes['Graph Settings'][] = array('vb', 'Prefer Vertical Bar Graphs');187 $analyze_checkboxes['Statistics'][] = array('rol', 'Remove Outliers Before Calculating Averages');188 //$analyze_checkboxes['Statistics'][] = array('gtb', 'Graph Values Of All Runs (Box Plot)');189 //$analyze_checkboxes['Statistics'][] = array('gtl', 'Graph Values Of All Runs (Line Graph)');190 if($has_box_plot || $has_line_graph)191 {192 $analyze_checkboxes['Graph Settings'][] = array('nbp', 'No Box Plots');193 }194 if($is_multi_way && $system_count > 1)195 {196 $analyze_checkboxes['Multi-Way Comparison'][] = array('cmw', 'Condense Comparison');197 }198 if(($is_multi_way && $system_count > 1) || self::check_request_for_var($request, 'cmv') || self::check_request_for_var($request, 'cts'))199 {200 $analyze_checkboxes['Multi-Way Comparison'][] = array('imw', 'Transpose Comparison');201 }202 if((!$is_multi_way && $has_test_with_multiple_options && !self::check_request_for_var($request, 'cmv')) || self::check_request_for_var($request, 'cts'))203 {204 $analyze_checkboxes['Multi-Way Comparison'][] = array('cts', 'Condense Multi-Option Tests Into Single Result Graphs');205 }206 if((!$is_multi_way && $has_test_with_multiple_versions && !self::check_request_for_var($request, 'cts')) || self::check_request_for_var($request, 'cmv'))207 {208 $analyze_checkboxes['Multi-Way Comparison'][] = array('cmv', 'Condense Test Profiles With Multiple Version Results Into Single Result Graphs');209 }210 $analyze_checkboxes['Table'][] = array('sdt', 'Show Detailed System Result Table');211 $t = null;212 foreach($analyze_checkboxes as $title => $group)213 {214 if(empty($group))215 {216 continue;217 }218 $t .= '<div class="pts_result_viewer_settings_box">';219 $t .= '<h2>' . $title . '</h2>';220 foreach($group as $key)221 {222 if($key[0] == null)223 {224 $t .= $key[1] . '<br />';225 }226 else227 {228 $t .= '<input type="checkbox" name="' . $key[0] . '" value="1"' . (self::check_request_for_var($request, $key[0]) ? ' checked="checked"' : null) . ' /> ' . $key[1] . '<br />';229 }230 }231 $t .= '</div>';232 }233 if($system_count > 0)234 {235 $has_system_logs = $result_file->system_logs_available();236 $t .= '<div style="clear: both;"><h2>Run Management</h2>237<div class="div_table">238<div class="div_table_body">239<div class="div_table_first_row">';240if($system_count > 1)241{242 $t .= '<div class="div_table_cell">Highlight<br />Result</div>243<div class="div_table_cell">Hide<br />Result</div>';244}245$t .= '<div class="div_table_cell">Result<br />Identifier</div>';246if($has_system_logs)247{248 $t .= '<div class="div_table_cell">View Logs</div>';249}250$t .= '<div class="div_table_cell">Performance Per<br />Dollar</div>251<div class="div_table_cell">Date<br />Run</div>252<div class="div_table_cell"> &nbsp; Test<br /> &nbsp; Duration</div>253<div class="div_table_cell"> </div>254</div>255';256$hgv = self::check_request_for_var($request, 'hgv');257if(!is_array($hgv))258{259 $hgv = explode(',', $hgv);260}261$rmm = self::check_request_for_var($request, 'rmm');262if(!is_array($rmm))263{264 $rmm = explode(',', $rmm);265}266$start_of_year = strtotime(date('Y-01-01'));267$test_run_times = $result_file->get_test_run_times();268foreach($result_file->get_systems() as $sys)269{270 $si = $sys->get_identifier();271 $ppdx = rtrim(base64_encode($si), '=');272 $ppd = self::check_request_for_var($request, 'ppd_' . $ppdx);273$t .= '274 <div id="table-line-' . $ppdx . '" class="div_table_row">';275 if($system_count > 1)276 {277 $t .= '<div class="div_table_cell"><input type="checkbox" name="hgv[]" value="' . $si . '"' . (is_array($hgv) && in_array($si, $hgv) ? ' checked="checked"' : null) . ' /></div>278 <div class="div_table_cell"><input type="checkbox" name="rmm[]" value="' . $si . '"' . (is_array($rmm) && in_array($si, $rmm) ? ' checked="checked"' : null) . ' /></div>';279 }280 $t .= '<div class="div_table_cell"><strong>' . $si . '</strong></div>';281 if($has_system_logs)282 {283 $t .= '<div class="div_table_cell">' . ($sys->has_log_files() ? '<button type="button" onclick="javascript:display_system_logs_for_result(\'' . $public_id . '\', \'' . $sys->get_original_identifier() . '\'); return false;">View System Logs</button>' : ' ') . '</div>';284 }285 $stime = strtotime($sys->get_timestamp());286 $t .= '<div class="div_table_cell"><input type="number" min="0" step="0.001" name="ppd_' . $ppdx . '" value="' . ($ppd && $ppd !== true ? strip_tags($ppd) : '0') . '" /></div>287<div class="div_table_cell">' . date(($stime > $start_of_year ? 'F d' : 'F d Y'), $stime) . '</div>288<div class="div_table_cell"> &nbsp; ' . (isset($test_run_times[$si]) && $test_run_times[$si] > 0 ? pts_strings::format_time($test_run_times[$si], 'SECONDS', true, 60) : ' ') . '</div>';289 if($can_delete_results && !empty($public_id))290 {291 $t .= '<div class="div_table_cell">';292 if($system_count > 1)293 {294 $t .= '<button type="button" onclick="javascript:delete_run_from_result_file(\'' . $public_id . '\', \'' . $si . '\', \'' . $ppdx . '\'); return false;">Delete Run</button> ';295 }296 $t .= '<button type="button" onclick="javascript:rename_run_in_result_file(\'' . $public_id . '\', \'' . $si . '\'); return false;">Rename Run</button></div>';297 }298 $t .= '</div>';299}300if($system_count > 1)301{302 $t .= '303 <div class="div_table_row">304 <div class="div_table_cell"> </div>305 <div class="div_table_cell"><input type="checkbox" onclick="javascript:invert_hide_all_results_checkboxes();" /></div>306 <div class="div_table_cell"><em>Invert Hiding All Results Option</em></div>';307 if($has_system_logs)308 {309 $t .= '<div class="div_table_cell"> </div>';310 }311 $t .= '<div class="div_table_cell">' . self::html_select_menu('ppt', 'ppt', null, array('D' => 'Dollar', 'DPH' => 'Dollar / Hour'), true) . '</div>312 <div class="div_table_cell"> </div>313 <div class="div_table_cell"> &nbsp; <em>' . pts_strings::format_time(array_sum($test_run_times) / count($test_run_times), 'SECONDS', true, 60) . '</em></div>314 <div class="div_table_cell">';315 if($can_delete_results)316 {317 $t .= '<button type="button" onclick="javascript:reorder_result_file(\'' . $public_id . '\'); return false;">Sort / Reorder Runs</button>';318 }319 $t .= '</div></div>';320}321$t .= '322</div>323</div></div>';324 }325$analyze_options .= $t;326if($system_count > 2)327{328 $analyze_options .= '<br /><div>Only show results where ' . self::html_select_menu('ftt', 'ftt', null, array_merge(array(null), $result_file->get_system_identifiers()), false) . ' is faster than ' . self::html_select_menu('ftb', 'ftb', null, array_merge(array(null), $result_file->get_system_identifiers()), false) . '</div>';329}330if($result_file->get_test_count() > 1)331{332 $analyze_options .= '<div>Only show results matching title/arguments (delimit multiple options with a comma): ' . self::html_input_field('oss', 'oss') . '</div>';333}334 $analyze_options .= '<br /><input style="clear: both;" name="submit" value="Refresh Results" type="submit" /></form>';335 return $analyze_options;336 }337 public static function process_result_export_pre_render(&$request, &$result_file, &$extra_attributes)338 {339 // Result export?340 $result_title = (isset($_GET['result']) ? $_GET['result'] : 'result');341 switch(isset($_REQUEST['export']) ? $_REQUEST['export'] : null)342 {343 case 'pdf':344 header('Content-Type: application/pdf');345 $pdf_output = pts_result_file_output::result_file_to_pdf($result_file, $result_title . '.pdf', 'D', $extra_attributes);346 exit;347 case 'csv':348 $result_csv = pts_result_file_output::result_file_to_csv($result_file, ',', $extra_attributes);349 header('Content-Description: File Transfer');350 header('Content-Type: application/csv');351 header('Content-Disposition: attachment; filename=' . $result_title . '.csv');352 header('Expires: 0');353 header('Cache-Control: must-revalidate');354 header('Pragma: public');355 header('Content-Length: ' . strlen($result_csv));356 echo $result_csv;357 exit;358 case 'csv-all':359 $result_csv = pts_result_file_output::result_file_raw_to_csv($result_file);360 header('Content-Description: File Transfer');361 header('Content-Type: application/csv');362 header('Content-Disposition: attachment; filename=' . $result_title . '.csv');363 header('Expires: 0');364 header('Cache-Control: must-revalidate');365 header('Pragma: public');366 header('Content-Length: ' . strlen($result_csv));367 echo $result_csv;368 exit;369 case 'txt':370 $result_txt = pts_result_file_output::result_file_to_text($result_file);371 header('Content-Description: File Transfer');372 header('Content-Type: text/plain');373 header('Content-Disposition: attachment; filename=' . $result_title . '.txt');374 header('Expires: 0');375 header('Cache-Control: must-revalidate');376 header('Pragma: public');377 header('Content-Length: ' . strlen($result_txt));378 echo $result_txt;379 exit;380 case 'xml-suite':381 $suite_xml = pts_result_file_output::result_file_to_suite_xml($result_file);382 header('Content-Description: File Transfer');383 header('Content-Type: text/xml');384 header('Content-Disposition: attachment; filename=' . $result_title . '-suite.xml');385 header('Expires: 0');386 header('Cache-Control: must-revalidate');387 header('Pragma: public');388 header('Content-Length: ' . strlen($suite_xml));389 echo $suite_xml;390 exit;391 case 'xml':392 $result_xml = $result_file->get_xml(null, true);393 header('Content-Description: File Transfer');394 header('Content-Type: text/xml');395 header('Content-Disposition: attachment; filename=' . $result_title . '.xml');396 header('Expires: 0');397 header('Cache-Control: must-revalidate');398 header('Pragma: public');399 header('Content-Length: ' . strlen($result_xml));400 echo $result_xml;401 exit;402 case 'view_system_logs':403 $html_viewer = '';404 foreach($result_file->get_systems() as $system)405 {406 $sid = base64_decode($_REQUEST['system_id']);407 if($system->get_original_identifier() == $sid)408 {409 $system_logs = $system->log_files();410 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' ? $_REQUEST['log_select'] : (isset($system_logs[0]) ? $system_logs[0] : '');411 $log_contents = $system->log_files($show_log, false);412 pts_result_viewer_embed::display_log_html_or_download($log_contents, $system_logs, $show_log, $html_viewer, $sid);413 break;414 }415 }416 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);417 exit;418 case 'view_install_logs':419 $html_viewer = '';420 if(isset($_REQUEST['result_object']))421 {422 if(($result_object = $result_file->get_result_object_by_hash($_REQUEST['result_object'])))423 {424 $install_logs = $result_file->get_install_log_for_test($result_object->test_profile, false);425 if(count($install_logs) > 0)426 {427 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' ? $_REQUEST['log_select'] : (isset($install_logs[0]) ? $install_logs[0] : '');428 $log_contents = $result_file->get_install_log_for_test($result_object->test_profile, $show_log, false);429 pts_result_viewer_embed::display_log_html_or_download($log_contents, $install_logs, $show_log, $html_viewer, $result_object->test_profile->get_title() . ' Installation');430 }431 }432 }433 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);434 exit;435 case 'view_test_logs':436 $html_viewer = '';437 if(isset($_REQUEST['result_object']))438 {439 if(($result_object = $result_file->get_result_object_by_hash($_REQUEST['result_object'])))440 {441 if(($test_logs = $result_file->get_test_run_log_for_result($result_object, false)))442 {443 $show_log = isset($_REQUEST['log_select']) && $_REQUEST['log_select'] != 'undefined' ? $_REQUEST['log_select'] : (isset($test_logs[0]) ? $test_logs[0] : '');444 $log_contents = $result_file->get_test_run_log_for_result($result_object, $show_log, false);445 pts_result_viewer_embed::display_log_html_or_download($log_contents, $test_logs, $show_log, $html_viewer, trim($result_object->test_profile->get_title() . ' ' . $result_object->get_arguments_description()));446 }447 }448 }449 echo pts_result_viewer_embed::html_template_log_viewer($html_viewer, $result_file);450 exit;451 }452 // End result export453 }454 public static function process_helper_html(&$request, &$result_file, &$extra_attributes)455 {456 self::process_result_export_pre_render($request, $result_file, $extra_attributes);457 $html = null;458 if(self::check_request_for_var($request, 'spr'))459 {460 $results = $result_file->get_result_objects();461 $spreads = array();462 foreach($results as $i => &$result_object)463 {464 $spreads[$i] = $result_object->get_spread();465 }466 arsort($spreads);467 $spreads = array_slice($spreads, 0, min((int)(count($results) / 4), 10), true);468 if(!empty($spreads))469 {470 $html .= '<h3>Notable Results</h3>';471 foreach($spreads as $result_key => $spread)472 {473 $ro = $result_file->get_result_objects($result_key);474 if(!is_object($ro[0]))475 {476 continue;477 }478 $html .= '<a href="#r-' . $result_key . '">' . $ro[0]->test_profile->get_title() . ' - ' . $ro[0]->get_arguments_description() . '</a><br />';479 }480 }481 }482 return $html;483 }484 public static function check_request_for_var(&$request, $check)485 {486 // the obr_ check is to maintain OpenBenchmarking.org compatibility for its original variable naming to preserve existing URLs487 $ret = false;488 if(defined('OPENBENCHMARKING_BUILD') && isset($request['obr_' . $check]))489 {490 $ret = empty($request['obr_' . $check]) ? true : $request['obr_' . $check];491 }492 if(isset($request[$check]))493 {494 $ret = empty($request[$check]) ? true : $request[$check];495 }496 if($ret && isset($ret[5]))497 {498 $ret = str_replace('_DD_', '.', $ret);499 }500 return $ret;501 }502 public static function process_request_to_attributes(&$request, &$result_file, &$extra_attributes)503 {504 if(($oss = self::check_request_for_var($request, 'oss')))505 {506 $oss = pts_strings::comma_explode($oss);507 foreach($result_file->get_result_objects() as $i => $result_object)508 {509 $matched = false;510 foreach($oss as $search_check)511 {512 if(stripos($result_object->get_arguments_description(), $search_check) === false && stripos($result_object->test_profile->get_identifier(), $search_check) === false && stripos($result_object->test_profile->get_title(), $search_check) === false)513 {514 // Not found515 $matched = false;516 }517 else518 {519 $matched = true;520 break;521 }522 }523 if(!$matched)524 {525 $result_file->remove_result_object_by_id($i);526 }527 }528 }529 if(self::check_request_for_var($request, 'ftt') && self::check_request_for_var($request, 'ftt'))530 {531 $ftt = self::check_request_for_var($request, 'ftt');532 $ftb = self::check_request_for_var($request, 'ftb');533 if(!empty($ftt) && !empty($ftb) && $ftt !== true && $ftb !== true)534 {535 foreach($result_file->get_result_objects() as $i => $result_object)536 {537 $ftt_result = $result_object->test_result_buffer->get_result_from_identifier($ftt);538 $ftb_result = $result_object->test_result_buffer->get_result_from_identifier($ftb);539 if($ftt_result && $ftb_result)540 {541 $ftt_wins = false;542 if($result_object->test_profile->get_result_proportion() == 'HIB')543 {544 if($ftt_result > $ftb_result)545 {546 $ftt_wins = true;547 }548 }549 else550 {551 if($ftt_result < $ftb_result)552 {553 $ftt_wins = true;554 }555 }556 if(!$ftt_wins)557 {558 $result_file->remove_result_object_by_id($i);559 }560 }561 else562 {563 $result_file->remove_result_object_by_id($i);564 }565 }566 }567 }568 if(($stis = self::check_request_for_var($request, 'stis')))569 {570 if(!is_array($stis))571 {572 $stis = explode(',', $stis);573 }574 $suites_in_result_file = pts_test_suites::suites_in_result_file($result_file, true, 0);575 $tests_to_show = array();576 foreach($stis as $suite_to_show)577 {578 $suite_to_show = base64_decode($suite_to_show);579 if(isset($suites_in_result_file[$suite_to_show]))580 {581 foreach($suites_in_result_file[$suite_to_show][1] as $test_to_show)582 {583 $tests_to_show[] = $test_to_show;584 }585 }586 }587 if(!empty($tests_to_show))588 {589 foreach($result_file->get_result_objects() as $i => $result_object)590 {591 if($result_object->get_parent_hash())592 {593 if(!$result_file->get_result_object_by_hash($result_object->get_parent_hash()) || !in_array($result_file->get_result_object_by_hash($result_object->get_parent_hash())->test_profile->get_identifier(false), $tests_to_show))594 {595 $result_file->remove_result_object_by_id($i);596 }597 }598 else if(!in_array($result_object->test_profile->get_identifier(false), $tests_to_show))599 {600 $result_file->remove_result_object_by_id($i);601 }602 }603 }604 }605 if(self::check_request_for_var($request, 'hlc'))606 {607 foreach($result_file->get_result_objects() as $i => $result_object)608 {609 if($result_object->result_flat())610 {611 $result_file->remove_result_object_by_id($i);612 }613 }614 }615 if(self::check_request_for_var($request, 'hnr'))616 {617 $result_file->remove_noisy_results();618 }619 if(self::check_request_for_var($request, 'hni'))620 {621 $system_count = $result_file->get_system_count();622 foreach($result_file->get_result_objects() as $i => $result_object)623 {624 if($result_object->test_result_buffer->get_count() < $system_count)625 {626 $result_file->remove_result_object_by_id($i);627 }628 }629 }630 if(self::check_request_for_var($request, 'grs'))631 {632 $result_file->sort_result_object_order_by_spread();633 }634 else if(self::check_request_for_var($request, 'grt'))635 {636 $result_file->sort_result_object_order_by_title();637 }638 else if(self::check_request_for_var($request, 'gru'))639 {640 $result_file->sort_result_object_order_by_result_scale();641 }642 else if(self::check_request_for_var($request, 'grr'))643 {644 $result_file->sort_result_object_order_by_run_time();645 }646 if(self::check_request_for_var($request, 'shm'))647 {648 foreach(pts_result_file_analyzer::generate_harmonic_mean_result($result_file) as $result)649 {650 if($result)651 {652 $result_file->add_result($result);653 }654 }655 }656 if(self::check_request_for_var($request, 'sgm'))657 {658 $result = pts_result_file_analyzer::generate_geometric_mean_result($result_file);659 if($result)660 {661 $result_file->add_result($result);662 }663 }664 if(self::check_request_for_var($request, 'sts'))665 {666 foreach(pts_result_file_analyzer::generate_geometric_mean_result_for_suites_in_result_file($result_file, true, 0) as $result)667 {668 if($result)669 {670 $result_file->add_result($result);671 }672 }673 }674 if(self::check_request_for_var($request, 'swl'))675 {676 foreach(pts_result_file_analyzer::generate_wins_losses_results($result_file) as $result)677 {678 if($result)679 {680 $result_file->add_result($result);681 }682 }683 }684 if(self::check_request_for_var($request, 'cts'))685 {686 pts_result_file_analyzer::condense_result_file_by_multi_option_tests($result_file);687 }688 if(self::check_request_for_var($request, 'cmv'))689 {690 pts_result_file_analyzer::condense_result_file_by_multi_version_tests($result_file);691 }692 if(self::check_request_for_var($request, 'sor'))693 {694 $extra_attributes['sort_result_buffer_values'] = true;695 }696 if(self::check_request_for_var($request, 'rro'))697 {698 $extra_attributes['reverse_result_buffer'] = true;699 }700 if(self::check_request_for_var($request, 'sro'))701 {702 $extra_attributes['sort_result_buffer'] = true;703 }704 if(self::check_request_for_var($request, 'nor'))705 {706 $extra_attributes['normalize_result_buffer'] = true;707 }708 if(self::check_request_for_var($request, 'ftr'))709 {710 $extra_attributes['force_tracking_line_graph'] = true;711 }712 if(self::check_request_for_var($request, 'imw'))713 {714 $extra_attributes['multi_way_comparison_invert_default'] = false;715 }716 if(self::check_request_for_var($request, 'cmw'))717 {718 $extra_attributes['condense_multi_way'] = true;719 }720 if(($hgv = self::check_request_for_var($request, 'hgv')))721 {722 if(is_array($hgv))723 {724 $extra_attributes['highlight_graph_values'] = $hgv;725 }726 else727 {728 $extra_attributes['highlight_graph_values'] = explode(',', $hgv);729 }730 }731 else if(self::check_request_for_var($request, 'hgv_base64'))732 {733 $extra_attributes['highlight_graph_values'] = explode(',', base64_decode(self::check_request_for_var($request, 'hgv_base64')));734 }735 if(($rmm = self::check_request_for_var($request, 'rmm')))736 {737 if(!is_array($rmm))738 {739 $rmm = explode(',', $rmm);740 }741 foreach($rmm as $rm)742 {743 $result_file->remove_run($rm);744 }745 }746 if(self::check_request_for_var($request, 'scalar'))747 {748 $extra_attributes['compact_to_scalar'] = true;749 }750 if(self::check_request_for_var($request, 'ncb'))751 {752 $extra_attributes['no_color_branding'] = true;753 }754 if(self::check_request_for_var($request, 'nbp'))755 {756 $extra_attributes['no_box_plots'] = true;757 }758 if(self::check_request_for_var($request, 'vb'))759 {760 $extra_attributes['vertical_bars'] = true;761 }762 /*763 if(self::check_request_for_var($request, 'gtb'))764 {765 $extra_attributes['graph_render_type'] = 'HORIZONTAL_BOX_PLOT';766 }767 else if(self::check_request_for_var($request, 'gtl'))768 {769 $extra_attributes['graph_render_type'] = 'LINE_GRAPH';770 $extra_attributes['graph_raw_values'] = true;771 }772 */773 if(self::check_request_for_var($request, 'rol'))774 {775 foreach($result_file->get_result_objects() as $i => $result_object)776 {777 $result_object->recalculate_averages_without_outliers(1.5);778 }779 }780 $perf_per_dollar_values = array();781 foreach($result_file->get_system_identifiers() as $si)782 {783 $ppd = self::check_request_for_var($request, 'ppd_' . rtrim(base64_encode($si), '='));784 if($ppd && $ppd > 0 && is_numeric($ppd))785 {786 $perf_per_dollar_values[$si] = $ppd;787 }788 }789 if(!empty($perf_per_dollar_values))790 {791 $perf_per_hour = self::check_request_for_var($request, 'ppt') == 'DPH';792 pts_result_file_analyzer::generate_perf_per_dollar($result_file, $perf_per_dollar_values, 'Dollar', false, $perf_per_hour);793 }794 }795 public static function html_input_field($name, $id, $on_change = null)796 {797 return '<input type="text" name="' . $name . '" id="' . $id . '" onclick="" value="' . (isset($_REQUEST[$name]) ? strip_tags($_REQUEST[$name]) : null) . '">';798 }799 public static function html_select_menu($name, $id, $on_change, $elements, $use_index = true, $other_attributes = array(), $selected = false)800 {801 $tag = null;802 foreach($other_attributes as $i => $v)803 {804 $tag .= ' ' . $i . '="' . $v . '"';805 }...

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1$embed = new pts_result_viewer_embed();2$embed->check_request_for_var();3$analyzer = new pts_result_file_analyzer();4$analyzer->check_request_for_var();5$output = new pts_result_file_output();6$output->check_request_for_var();7$analyzer = new pts_result_file_analyzer();8$analyzer->check_request_for_var();9$output = new pts_result_file_output();10$output->check_request_for_var();11$analyzer = new pts_result_file_analyzer();12$analyzer->check_request_for_var();13$output = new pts_result_file_output();14$output->check_request_for_var();15$analyzer = new pts_result_file_analyzer();16$analyzer->check_request_for_var();17$output = new pts_result_file_output();18$output->check_request_for_var();19$analyzer = new pts_result_file_analyzer();20$analyzer->check_request_for_var();21$output = new pts_result_file_output();22$output->check_request_for_var();23$analyzer = new pts_result_file_analyzer();24$analyzer->check_request_for_var();25$output = new pts_result_file_output();26$output->check_request_for_var();27$analyzer = new pts_result_file_analyzer();28$analyzer->check_request_for_var();29$output = new pts_result_file_output();30$output->check_request_for_var();

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1require_once('pts_result_viewer_embed.php');2$embed = new pts_result_viewer_embed();3$embed->check_request_for_var('test');4require_once('pts_result_viewer_embed.php');5$embed = new pts_result_viewer_embed();6$embed->check_request_for_var('test');7require_once('pts_result_viewer_embed.php');8$embed = new pts_result_viewer_embed();9$embed->check_request_for_var('test');10require_once('pts_result_viewer_embed.php');11$embed = new pts_result_viewer_embed();12$embed->check_request_for_var('test');13require_once('pts_result_viewer_embed.php');14$embed = new pts_result_viewer_embed();15$embed->check_request_for_var('test');16require_once('pts_result_viewer_embed.php');17$embed = new pts_result_viewer_embed();18$embed->check_request_for_var('test');19require_once('pts_result_viewer_embed.php');20$embed = new pts_result_viewer_embed();21$embed->check_request_for_var('test');22require_once('pts_result_viewer_embed.php');23$embed = new pts_result_viewer_embed();24$embed->check_request_for_var('test');25require_once('pts_result_viewer_embed.php');26$embed = new pts_result_viewer_embed();27$embed->check_request_for_var('test');28require_once('

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1require_once('pts-result-viewer-embed.php');2$rv = new pts_result_viewer_embed();3if($rv->check_request_for_var('var1'))4{5 echo "var1 is set";6}7{8 echo "var1 is not set";9}10require_once('pts-result-viewer-embed.php');11$rv = new pts_result_viewer_embed();12if($rv->check_request_for_var_get('var1'))13{14 echo "var1 is set";15}16{17 echo "var1 is not set";18}19require_once('pts-result-viewer-embed.php');20$rv = new pts_result_viewer_embed();21if($rv->check_request_for_var_post('var1'))22{23 echo "var1 is set";24}25{26 echo "var1 is not set";27}28require_once('pts-result-viewer-embed.php');29$rv = new pts_result_viewer_embed();30if($rv->check_request_for_var_cookie('var1'))31{32 echo "var1 is set";33}34{35 echo "var1 is not set";36}

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1if (!isset($var))2{3 $var = check_request_for_var('var');4}5if (!isset($var2))6{7 $var2 = check_request_for_var('var2');8}9if (!isset($var3))10{11 $var3 = check_request_for_var('var3');12}13if (!isset($var))14{15 $var = check_request_for_var('var');16}17if (!isset($var2))18{19 $var2 = check_request_for_var('var2');20}21if (!isset($var3))22{23 $var3 = check_request_for_var('var3');24}25if (!isset($var))26{27 $var = check_request_for_var('var');28}29if (!isset($var2))30{31 $var2 = check_request_for_var('var2');32}33if (!isset($var3))34{35 $var3 = check_request_for_var('var3');36}37if (!isset($var))38{39 $var = check_request_for_var('var');40}41if (!isset($var2))42{43 $var2 = check_request_for_var('var2');44}

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1require_once('pts-core.php');2$viewer = new pts_result_viewer_embed();3$viewer->check_request_for_var('variable1');4echo 'variable1 is set to '.$viewer->get_request_var('variable1');5require_once('pts-core.php');6$viewer = new pts_result_viewer_embed();7$viewer->check_request_for_var('variable1');8echo 'variable1 is set to '.$viewer->get_request_var('variable1');9require_once('pts-core.php');10$viewer = new pts_result_viewer_embed();11$viewer->check_request_for_var('variable1');12echo 'variable1 is set to '.$viewer->get_request_var('variable1');13require_once('pts-core.php');14$viewer = new pts_result_viewer_embed();15$viewer->check_request_for_var('variable1');16echo 'variable1 is set to '.$viewer->get_request_var('variable1');17require_once('pts-core.php');18$viewer = new pts_result_viewer_embed();19$viewer->check_request_for_var('variable1');20echo 'variable1 is set to '.$viewer->get_request_var('variable1');21require_once('pts-core.php');22$viewer = new pts_result_viewer_embed();23$viewer->check_request_for_var('variable1');24echo 'variable1 is set to '.$viewer->get_request_var('variable1');25require_once('pts-core.php');26$viewer = new pts_result_viewer_embed();27$viewer->check_request_for_var('variable1');28echo 'variable1 is set to '.$viewer->get_request_var('variable1');

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1require_once('pts_result_viewer_embed.php');2echo pts_result_viewer_embed::check_request_for_var('var1');3require_once('pts_result_viewer_embed.php');4echo pts_result_viewer_embed::check_request_for_var('var1');5require_once('pts_result_viewer_embed.php');6echo pts_result_viewer_embed::check_request_for_var('var1');7require_once('pts_result_viewer_embed.php');8echo pts_result_viewer_embed::check_request_for_var('var1');9require_once('pts_result_viewer_embed.php');10echo pts_result_viewer_embed::check_request_for_var('var1');11require_once('pts_result_viewer_embed.php');12echo pts_result_viewer_embed::check_request_for_var('var1');13require_once('pts_result_viewer_embed.php');

Full Screen

Full Screen

check_request_for_var

Using AI Code Generation

copy

Full Screen

1$embed = new pts_result_viewer_embed();2if($embed->check_request_for_var('show'))3{4echo "The variable 'show' is set in the request";5}6{7echo "The variable 'show' is not set in the request";8}9$embed = new pts_result_viewer_embed();10if($embed->check_request_for_var('show'))11{12echo "The variable 'show' is set in the request";13echo "The value of the variable 'show' is ".$embed->get_request_var_value('show');14}15{16echo "The variable 'show' is not set in the request";17}18$embed = new pts_result_viewer_embed();19if($embed->check_request_for_var('show'))20{21echo "The variable 'show' is set in the request";22echo "The value of the variable 'show' is ".$embed->get_request_var_value('show');23}24{25echo "The variable 'show' is not set in the request";26}

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 check_request_for_var code on LambdaTest Cloud Grid

Execute automation tests with check_request_for_var 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