public function __construct(&$result_file) { $columns = array(); $hw = array(); $sw = array(); foreach ($result_file->get_systems() as $system) { $columns[] = $system->get_identifier(); $hw[] = $system->get_hardware(); $sw[] = $system->get_software(); } $rows = array(); $table_data = array(); pts_result_file_analyzer::system_components_to_table($table_data, $columns, $rows, $hw); pts_result_file_analyzer::system_components_to_table($table_data, $columns, $rows, $sw); pts_result_file_analyzer::compact_result_table_data($table_data, $columns, true); // TODO: see if this true value works fine but if rendering starts messing up, disable it if (defined('OPENBENCHMARKING_IDS')) { foreach ($columns as &$column) { $column = new pts_graph_ir_value($column); $column->set_attribute('href', 'http://openbenchmarking.org/system/' . OPENBENCHMARKING_IDS . '/' . $column); } } parent::__construct($rows, $columns, $table_data, $result_file); $this->i['identifier_size'] *= 0.8; $this->column_heading_vertical = false; $this->graph_title = $result_file->get_title(); if (!defined('PHOROMATIC_EXPORT_VIEWER')) { pts_render::report_system_notes_to_table($result_file, $this); } }
public function __construct(&$result_file, $intent = false) { parent::__construct(); $this->intent = is_array($intent) ? $intent : array(array(), array()); $this->graph_title = $result_file->get_title(); $hw = $result_file->get_system_hardware(); $sw = $result_file->get_system_software(); $hw = pts_result_file_analyzer::system_component_string_to_array(array_shift($hw)); $sw = pts_result_file_analyzer::system_component_string_to_array(array_shift($sw)); $this->components = array_merge($hw, $sw); pts_render::report_system_notes_to_table($result_file, $this); }
public static function clear_iqr_outlier_results(&$test_result_buffer) { $is_multi_way = pts_render::multi_way_identifier_check($test_result_buffer->get_identifiers()); if ($is_multi_way) { $group_values = array(); $group_keys = array(); foreach ($test_result_buffer->buffer_items as $key => &$buffer_item) { $identifier_r = pts_strings::trim_explode(': ', $buffer_item->get_result_identifier()); if (!isset($group_values[$identifier_r[1]])) { $group_values[$identifier_r[1]] = array(); $group_keys[$identifier_r[1]] = array(); } array_push($group_values[$identifier_r[1]], $buffer_item->get_result_value()); array_push($group_keys[$identifier_r[1]], $key); } foreach ($group_values as $group_key => $values) { // From: http://www.mathwords.com/o/outlier.htm $fqr = pts_math::first_quartile($values); $tqr = pts_math::third_quartile($values); $iqr_cut = ($tqr - $fqr) * 1.5; $bottom_cut = $fqr - $iqr_cut; $top_cut = $tqr + $iqr_cut; foreach ($group_keys[$group_key] as $key) { $value = $test_result_buffer->buffer_items[$key]->get_result_value(); if ($value > $top_cut || $value < $bottom_cut) { unset($test_result_buffer->buffer_items[$key]); } } } } else { // From: http://www.mathwords.com/o/outlier.htm $values = $test_result_buffer->get_values(); $fqr = pts_math::first_quartile($values); $tqr = pts_math::third_quartile($values); $iqr_cut = ($tqr - $fqr) * 1.5; $bottom_cut = $fqr - $iqr_cut; $top_cut = $tqr + $iqr_cut; foreach ($test_result_buffer->buffer_items as $key => &$buffer_item) { $value = $buffer_item->get_result_value(); if ($value > $top_cut || $value < $bottom_cut) { unset($test_result_buffer->buffer_items[$key]); } } } }
public static function render_page_process($PATH) { echo '<h1>' . self::$result_file->get_title() . '</h2>'; $extra_attributes = array(); $intent = null; if (self::$result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent(self::$result_file, $intent, true))) { $table = new pts_ResultFileCompactSystemsTable(self::$result_file, $intent); } else { $table = new pts_ResultFileSystemsTable(self::$result_file); } echo '<p class="result_object">' . pts_render::render_graph_inline_embed($table, self::$result_file, $extra_attributes) . '</p>'; foreach (self::$result_file->get_result_objects() as $i => $result_object) { echo '<h2><a name="r-' . $i . '"></a>' . $result_object->test_profile->get_title() . '</h2>'; echo '<p class="result_object">'; echo pts_render::render_graph_inline_embed($result_object, self::$result_file, $extra_attributes); echo '</p>'; } }
public function output($save_as = null, &$format = null) { $output_format = 'SVG'; if (isset($_SERVER['HTTP_USER_AGENT']) || isset($_REQUEST['force_format'])) { static $browser_renderer = null; if (isset($_REQUEST['force_format'])) { // Don't nest the force_format within the browser_renderer null check in case its overriden by OpenBenchmarking.org dynamically $output_format = $_REQUEST['force_format']; } else { if ($browser_renderer == null) { $output_format = pts_render::renderer_compatibility_check($_SERVER['HTTP_USER_AGENT']); } else { $output_format = $browser_renderer; } } } $format = $output_format; switch ($output_format) { case 'JPG': case 'JPEG': $output = pts_svg_dom_gd::svg_dom_to_gd($this->dom, 'JPEG'); $output_format = 'jpg'; break; case 'PNG': $output = pts_svg_dom_gd::svg_dom_to_gd($this->dom, 'PNG'); $output_format = 'png'; break; case 'SVG': default: $output = $this->save_xml(); $output_format = 'svg'; break; } if ($output == null) { return false; } else { if ($save_as) { return file_put_contents(str_replace('BILDE_EXTENSION', $output_format, $save_as), $output); } else { return $output; } } }
public function auto_shorten_buffer_identifiers($identifier_shorten_index = false) { // If there's a lot to plot, try to auto-shorten the identifiers // e.g. if each identifier contains like 'GeForce 6800', 'GeForce GT 220', etc.. // then remove the 'GeForce' part of the name. if ($identifier_shorten_index == false) { $identifier_shorten_index = pts_render::evaluate_redundant_identifier_words($this->get_identifiers()); } if (empty($identifier_shorten_index)) { return false; } foreach ($this->buffer_items as &$buffer_item) { $identifier = explode(' ', $buffer_item->get_result_identifier()); foreach ($identifier_shorten_index as $pos => $value) { if ($identifier[$pos] == $value) { unset($identifier[$pos]); } } $buffer_item->reset_result_identifier(implode(' ', $identifier)); } return true; }
} $intent = null; //$table = new pts_ResultFileTable($result_file, $intent); //echo '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; echo '<div id="pts_results_area">'; foreach ($result_file->get_result_objects(isset($_REQUEST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1, true) as $i => $result_object) { if (stripos($result_object->get_arguments_description(), 'frame time') !== false) { continue; } echo '<h2><a name="r-' . $i . '"></a>' . $result_object->test_profile->get_title() . '</h2>'; //echo '<h3>' . $result_object->get_arguments_description() . '</h3>'; echo '<p class="result_object">'; echo pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes); echo '</p>'; unset($result_object); flush(); } echo '</div>'; if (isset($_REQUEST['system_table']) && $_REQUEST['system_table']) { $table = new pts_ResultFileSystemsTable($result_file); echo '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; } ?> <p id="footer"><em><?php echo pts_core::program_title(true); ?> </em><br />Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org are copyright © 2004 - 2015 by Phoronix Media.<br />The Phoronix Test Suite / Phoromatic is open-source under the GNU GPL.<br />For more information, visit <a href="http://www.phoronix-test-suite.com/">Phoronix-Test-Suite.com</a> or contact <a href="http://www.phoronix-media.com/">Phoronix Media</a>.</p> </body> </html>
public static function render_graph_process(&$result_object, &$result_file = null, $save_as = false, $extra_attributes = null) { if (isset($extra_attributes['sort_result_buffer'])) { $result_object->test_result_buffer->sort_buffer_items(); } if (isset($extra_attributes['reverse_result_buffer'])) { $result_object->test_result_buffer->buffer_values_reverse(); } if (isset($extra_attributes['normalize_result_buffer'])) { if (isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1) { $normalize_against = $extra_attributes['highlight_graph_values'][0]; } else { $normalize_against = false; } $result_object->normalize_buffer_values($normalize_against); } if ($result_file != null) { // Cache the redundant words on identifiers so it's not re-computed on every graph static $redundant_word_cache; if (!isset($redundant_word_cache[$result_file->get_title()])) { $redundant_word_cache[$result_file->get_title()] = pts_render::evaluate_redundant_identifier_words($result_file->get_system_identifiers()); } if ($redundant_word_cache[$result_file->get_title()]) { $result_object->test_result_buffer->auto_shorten_buffer_identifiers($redundant_word_cache[$result_file->get_title()]); } // COMPACT PROCESS if (!isset($extra_attributes['compact_to_scalar']) && $result_object->test_profile->get_display_format() == 'LINE_GRAPH' && $result_file->get_system_count() > 10) { // If there's too many lines being plotted on line graph, likely to look messy, so convert to scalar automatically $extra_attributes['compact_to_scalar'] = true; } // XXX: removed || $result_file->is_results_tracker() from below and should be added // Removing the command fixes cases like: 1210053-BY-MYRESULTS43 $result_identifiers = $result_object->test_result_buffer->get_identifiers(); if ($result_file->is_multi_way_comparison($result_identifiers, $extra_attributes) || isset($extra_attributes['compact_to_scalar']) || isset($extra_attributes['compact_scatter'])) { if ((isset($extra_attributes['compact_to_scalar']) || false && $result_file->is_multi_way_comparison($result_identifiers, $extra_attributes)) && in_array($result_object->test_profile->get_display_format(), array('FILLED_LINE_GRAPH'))) { // Convert multi-way line graph into horizontal box plot if (true) { $result_object->test_profile->set_display_format('HORIZONTAL_BOX_PLOT'); } /* else // XXX commented out during PTS 6.0 development, TODO decide if to delete { // Turn a multi-way line graph into an averaged bar graph $buffer_items = $result_object->test_result_buffer->get_buffer_items(); $result_object->test_result_buffer = new pts_test_result_buffer(); foreach($buffer_items as $buffer_item) { $values = pts_strings::comma_explode($buffer_item->get_result_value()); $avg_value = pts_math::set_precision(array_sum($values) / count($values), 2); $j = null; if(count($values) > 2) { $j['min-result'] = min($values); $j['max-result'] = max($values); if($j['min-result'] == $j['max-result']) { $json = null; } } $result_object->test_result_buffer->add_test_result($buffer_item->get_result_identifier(), $avg_value, null, $j, $j['min-result'], $j['max-result']); } $result_object->test_profile->set_display_format('BAR_GRAPH'); } */ } if ($result_object->test_profile->get_display_format() != 'PIE_CHART') { $result_table = false; pts_render::compact_result_file_test_object($result_object, $result_table, $result_file, $extra_attributes); } } else { if (in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH'))) { // Check to see for line graphs if every result is an array of the same result (i.e. a flat line for every result). // If all the results are just flat lines, you might as well convert it to a bar graph $buffer_items = $result_object->test_result_buffer->get_buffer_items(); $all_values_are_flat = false; $flat_values = array(); foreach ($buffer_items as $i => $buffer_item) { $unique_in_buffer = array_unique(explode(',', $buffer_item->get_result_value())); $all_values_are_flat = count($unique_in_buffer) == 1; if ($all_values_are_flat == false) { break; } $flat_values[$i] = array_pop($unique_in_buffer); } if ($all_values_are_flat) { $result_object->test_result_buffer = new pts_test_result_buffer(); foreach ($buffer_items as $i => $buffer_item) { $result_object->test_result_buffer->add_test_result($buffer_item->get_result_identifier(), $flat_values[$i]); } $result_object->test_profile->set_display_format('BAR_GRAPH'); } } } } $display_format = $result_object->test_profile->get_display_format(); $bar_orientation = 'HORIZONTAL'; // default to horizontal bar graph switch ($display_format) { case 'LINE_GRAPH': if (false && $result_object->test_result_buffer->get_count() > 5) { // If there's too many lines close to each other, it's likely to look cluttered so turn it into horizontal range bar / box chart graph $display_format = 'HORIZONTAL_BOX_PLOT'; $graph = new pts_HorizontalBoxPlotGraph($result_object, $result_file); } else { $graph = new pts_LineGraph($result_object, $result_file); } break; case 'HORIZONTAL_BOX_PLOT': $graph = new pts_HorizontalBoxPlotGraph($result_object, $result_file); break; case 'BAR_ANALYZE_GRAPH': case 'BAR_GRAPH': if ($bar_orientation == 'VERTICAL') { $graph = new pts_VerticalBarGraph($result_object, $result_file); } else { $graph = new pts_HorizontalBarGraph($result_object, $result_file); } break; case 'PASS_FAIL': $graph = new pts_PassFailGraph($result_object, $result_file); break; case 'MULTI_PASS_FAIL': $graph = new pts_MultiPassFailGraph($result_object, $result_file); break; case 'TEST_COUNT_PASS': $graph = new pts_TestCountPassGraph($result_object, $result_file); break; case 'PIE_CHART': $graph = new pts_PieChart($result_object, $result_file); break; case 'IMAGE_COMPARISON': $graph = new pts_ImageComparisonGraph($result_object, $result_file); break; case 'SCATTER_PLOT': $graph = new pts_ScatterPlot($result_object, $result_file); break; default: if (isset($extra_attributes['graph_render_type'])) { $requested_graph_type = $extra_attributes['graph_render_type']; } else { if (defined('GRAPH_RENDER_TYPE')) { $requested_graph_type = GRAPH_RENDER_TYPE; } else { $requested_graph_type = null; } } switch ($requested_graph_type) { case 'CANDLESTICK': $graph = new pts_CandleStickGraph($result_object, $result_file); break; case 'LINE_GRAPH': $graph = new pts_LineGraph($result_object, $result_file); break; default: if ($bar_orientation == 'VERTICAL') { $graph = new pts_VerticalBarGraph($result_object, $result_file); } else { $graph = new pts_HorizontalBarGraph($result_object, $result_file); } break; } break; } if (isset($extra_attributes['regression_marker_threshold'])) { $graph->markResultRegressions($extra_attributes['regression_marker_threshold']); } if (isset($extra_attributes['set_alternate_view'])) { $graph->setAlternateView($extra_attributes['set_alternate_view']); } if (isset($extra_attributes['sort_result_buffer_values'])) { $result_object->test_result_buffer->buffer_values_sort(); if ($result_object->test_profile->get_result_proportion() == 'HIB') { $result_object->test_result_buffer->buffer_values_reverse(); } } if (isset($extra_attributes['highlight_graph_values'])) { $graph->highlight_values($extra_attributes['highlight_graph_values']); } if (isset($extra_attributes['force_simple_keys'])) { $graph->override_i_value('force_simple_keys', true); } else { if (PTS_IS_CLIENT && pts_client::read_env('GRAPH_HIGHLIGHT') != false) { $graph->highlight_values(pts_strings::comma_explode(pts_client::read_env('GRAPH_HIGHLIGHT'))); } } switch ($display_format) { case 'LINE_GRAPH': if (isset($extra_attributes['no_overview_text']) && $graph instanceof pts_LineGraph) { $graph->plot_overview_text = false; } case 'BAR_ANALYZE_GRAPH': case 'SCATTER_PLOT': //$graph->hideGraphIdentifiers(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { $graph->loadGraphValues(pts_strings::comma_explode($buffer_item->get_result_value()), $buffer_item->get_result_identifier()); $graph->loadGraphRawValues(pts_strings::comma_explode($buffer_item->get_result_raw())); } $scale_special = $result_object->test_profile->get_result_scale_offset(); if (!empty($scale_special) && count($ss = pts_strings::comma_explode($scale_special)) > 0) { $graph->loadGraphIdentifiers($ss); } break; case 'HORIZONTAL_BOX_PLOT': // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph $identifiers = array(); $values = array(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { array_push($identifiers, $buffer_item->get_result_identifier()); array_push($values, pts_strings::comma_explode($buffer_item->get_result_value())); } $graph->loadGraphIdentifiers($identifiers); $graph->loadGraphValues($values); break; default: // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph $identifiers = array(); $values = array(); $raw_values = array(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { array_push($identifiers, $buffer_item->get_result_identifier()); array_push($values, $buffer_item->get_result_value()); array_push($raw_values, $buffer_item->get_result_raw()); } $graph->loadGraphIdentifiers($identifiers); $graph->loadGraphValues($values); $graph->loadGraphRawValues($raw_values); break; } self::report_test_notes_to_graph($graph, $result_object); return $graph; }
public static function render_graph_process(&$result_object, &$result_file = null, $save_as = false, $extra_attributes = null) { if (isset($extra_attributes['sort_result_buffer'])) { $result_object->test_result_buffer->sort_buffer_items(); } if (isset($extra_attributes['reverse_result_buffer'])) { $result_object->test_result_buffer->buffer_values_reverse(); } if (isset($extra_attributes['normalize_result_buffer'])) { if (isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1) { $normalize_against = $extra_attributes['highlight_graph_values'][0]; } else { $normalize_against = false; } $result_object->normalize_buffer_values($normalize_against); } if ($result_file != null) { // Cache the redundant words on identifiers so it's not re-computed on every graph static $redundant_word_cache; if (!isset($redundant_word_cache[$result_file->get_title()])) { $redundant_word_cache[$result_file->get_title()] = pts_render::evaluate_redundant_identifier_words($result_file->get_system_identifiers()); } if ($redundant_word_cache[$result_file->get_title()]) { $result_object->test_result_buffer->auto_shorten_buffer_identifiers($redundant_word_cache[$result_file->get_title()]); } } self::multi_way_compact($result_file, $result_object, $extra_attributes); $display_format = $result_object->test_profile->get_display_format(); $bar_orientation = 'HORIZONTAL'; // default to horizontal bar graph switch ($display_format) { case 'LINE_GRAPH': if (false && $result_object->test_result_buffer->get_count() > 5) { // If there's too many lines close to each other, it's likely to look cluttered so turn it into horizontal range bar / box chart graph $display_format = 'HORIZONTAL_BOX_PLOT'; $graph = new pts_HorizontalBoxPlotGraph($result_object, $result_file); } else { $graph = new pts_LineGraph($result_object, $result_file); } break; case 'HORIZONTAL_BOX_PLOT': $graph = new pts_HorizontalBoxPlotGraph($result_object, $result_file); break; case 'BAR_ANALYZE_GRAPH': case 'BAR_GRAPH': if ($bar_orientation == 'VERTICAL') { $graph = new pts_VerticalBarGraph($result_object, $result_file); } else { $graph = new pts_HorizontalBarGraph($result_object, $result_file); } break; case 'PASS_FAIL': $graph = new pts_PassFailGraph($result_object, $result_file); break; case 'MULTI_PASS_FAIL': $graph = new pts_MultiPassFailGraph($result_object, $result_file); break; case 'TEST_COUNT_PASS': $graph = new pts_TestCountPassGraph($result_object, $result_file); break; case 'PIE_CHART': $graph = new pts_PieChart($result_object, $result_file); break; case 'IMAGE_COMPARISON': $graph = new pts_ImageComparisonGraph($result_object, $result_file); break; case 'FILLED_LINE_GRAPH': $graph = new pts_FilledLineGraph($result_object, $result_file); break; case 'SCATTER_PLOT': $graph = new pts_ScatterPlot($result_object, $result_file); break; default: if (isset($extra_attributes['graph_render_type'])) { $requested_graph_type = $extra_attributes['graph_render_type']; } else { if (defined('GRAPH_RENDER_TYPE')) { $requested_graph_type = GRAPH_RENDER_TYPE; } else { $requested_graph_type = null; } } switch ($requested_graph_type) { case 'CANDLESTICK': $graph = new pts_CandleStickGraph($result_object, $result_file); break; case 'LINE_GRAPH': $graph = new pts_LineGraph($result_object, $result_file); break; case 'FILLED_LINE_GRAPH': $graph = new pts_FilledLineGraph($result_object, $result_file); break; default: if ($bar_orientation == 'VERTICAL') { $graph = new pts_VerticalBarGraph($result_object, $result_file); } else { $graph = new pts_HorizontalBarGraph($result_object, $result_file); } break; } break; } if (isset($extra_attributes['regression_marker_threshold'])) { $graph->markResultRegressions($extra_attributes['regression_marker_threshold']); } if (isset($extra_attributes['set_alternate_view'])) { $graph->setAlternateView($extra_attributes['set_alternate_view']); } if (isset($extra_attributes['sort_result_buffer_values'])) { $result_object->test_result_buffer->buffer_values_sort(); if ($result_object->test_profile->get_result_proportion() == 'HIB') { $result_object->test_result_buffer->buffer_values_reverse(); } } if (isset($extra_attributes['highlight_graph_values'])) { $graph->highlight_values($extra_attributes['highlight_graph_values']); } if (isset($extra_attributes['force_simple_keys'])) { $graph->override_i_value('force_simple_keys', true); } else { if (PTS_IS_CLIENT && pts_client::read_env('GRAPH_HIGHLIGHT') != false) { $graph->highlight_values(pts_strings::comma_explode(pts_client::read_env('GRAPH_HIGHLIGHT'))); } } switch ($display_format) { case 'LINE_GRAPH': if (isset($extra_attributes['no_overview_text']) && $graph instanceof pts_LineGraph) { $graph->plot_overview_text = false; } case 'FILLED_LINE_GRAPH': case 'BAR_ANALYZE_GRAPH': case 'SCATTER_PLOT': //$graph->hideGraphIdentifiers(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { $graph->loadGraphValues(pts_strings::comma_explode($buffer_item->get_result_value()), $buffer_item->get_result_identifier()); $graph->loadGraphRawValues(pts_strings::comma_explode($buffer_item->get_result_raw())); } $scale_special = $result_object->test_profile->get_result_scale_offset(); if (!empty($scale_special) && count($ss = pts_strings::comma_explode($scale_special)) > 0) { $graph->loadGraphIdentifiers($ss); } break; case 'HORIZONTAL_BOX_PLOT': // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph $identifiers = array(); $values = array(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { array_push($identifiers, $buffer_item->get_result_identifier()); array_push($values, pts_strings::comma_explode($buffer_item->get_result_value())); } $graph->loadGraphIdentifiers($identifiers); $graph->loadGraphValues($values); break; default: // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph $identifiers = array(); $values = array(); $raw_values = array(); foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) { array_push($identifiers, $buffer_item->get_result_identifier()); array_push($values, $buffer_item->get_result_value()); array_push($raw_values, $buffer_item->get_result_raw()); } $graph->loadGraphIdentifiers($identifiers); $graph->loadGraphValues($values); $graph->loadGraphRawValues($raw_values); break; } self::report_test_notes_to_graph($graph, $result_object); return $graph; }
public function is_multi_way_comparison($identifiers = false, $extra_attributes = null) { if (isset($extra_attributes['force_tracking_line_graph'])) { // Phoromatic result tracker $is_multi_way = true; $this->is_multi_way_inverted = true; } else { $hw = null; // XXX: this isn't used anymore at least for now on system hardware if ($identifiers == false) { $identifiers = $this->get_system_identifiers(); } $is_multi_way = count($identifiers) < 2 ? false : pts_render::multi_way_identifier_check($identifiers, $hw, $this); $this->is_multi_way_inverted = $is_multi_way && $is_multi_way[1]; } return $is_multi_way; }
public static function render_page_process($PATH) { $main = null; if (isset($PATH[0])) { $upload_ids = explode(',', $PATH[0]); foreach ($upload_ids as $i => $upload_id) { if (isset($upload_id[5]) && substr($upload_id, 0, 2) == 'S:') { $t = explode(':', $upload_id); $stmt = phoromatic_server::$db->prepare('SELECT UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':schedule_id', $t[1]); $test_result_result = $stmt->execute(); $cutoff_time = is_numeric($t[2]) ? strtotime('today -' . $t[2] . ' days') : false; while ($test_result_row = $test_result_result->fetchArray()) { if ($cutoff_time !== false && strtotime($test_result_row['UploadTime']) < $cutoff_time) { break; } $upload_ids[] = $test_result_row['UploadID']; } unset($upload_ids[$i]); } } $upload_ids = array_unique($upload_ids); $result_files = array(); $display_rows = array(); $system_types = array(); $schedule_types = array(); $trigger_types = array(); $upload_times = array(); $benchmark_tickets = array(); $xml_result_hash = array(); $tickets = array(); foreach ($upload_ids as $id) { $result_share_opt = phoromatic_server::read_setting('force_result_sharing') ? '1 = 1' : 'AccountID = (SELECT AccountID FROM phoromatic_account_settings WHERE LetOtherGroupsViewResults = "1" AND AccountID = phoromatic_results.AccountID)'; $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE PPRID = :pprid AND (AccountID = :account_id OR ' . $result_share_opt . ') LIMIT 1'); $stmt->bindValue(':pprid', $id); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $result = $stmt->execute(); $row = $result->fetchArray(); if (false && empty($row)) { // TODO XXX // XXX this code is ultimately dead $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND UploadID = :upload_id LIMIT 1'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':upload_id', $id); $result = $stmt->execute(); $row = $result->fetchArray(); } if (empty($row)) { continue; } $composite_xml = phoromatic_server::phoromatic_account_result_path($row['AccountID'], $row['UploadID']) . 'composite.xml'; if (!is_file($composite_xml)) { echo 'File Not Found: ' . $composite_xml; return false; } $display_rows[$composite_xml] = $row; pts_arrays::unique_push($benchmark_tickets, $row['BenchmarkTicketID']); pts_arrays::unique_push($upload_times, $row['UploadTime']); pts_arrays::unique_push($xml_result_hash, $row['XmlUploadHash']); pts_arrays::unique_push($system_types, $row['SystemID']); pts_arrays::unique_push($schedule_types, $row['ScheduleID']); pts_arrays::unique_push($trigger_types, $row['Trigger']); pts_arrays::unique_push($tickets, $row['BenchmarkTicketID']); // Update view counter $stmt_view = phoromatic_server::$db->prepare('UPDATE phoromatic_results SET TimesViewed = (TimesViewed + 1) WHERE AccountID = :account_id AND UploadID = :upload_id'); $stmt_view->bindValue(':account_id', $_SESSION['AccountID']); $stmt_view->bindValue(':upload_id', $row['UploadID']); $stmt_view->execute(); } $result_file_title = null; if (count($system_types) == 1) { $result_file_title = phoromatic_system_id_to_name($system_types[0]) . ' Tests'; } if (!empty($tickets) && $tickets[0] != null) { $system_name_format = 'ORIGINAL_DATA'; } else { if (count($trigger_types) == 1 && $trigger_types[0] != null && $benchmark_tickets[0] != null && count($display_rows) > 1) { $system_name_format = 'TRIGGER_AND_SYSTEM'; } else { if (empty($schedule_types[0])) { $system_name_format = 'ORIGINAL_DATA'; } else { if (count($display_rows) == 1) { $system_name_format = 'SYSTEM_NAME'; } else { if (count($schedule_types) == 1 && count($system_types) == 1) { $system_name_format = 'TRIGGER'; $result_file_title = phoromatic_schedule_id_to_name($schedule_types[0]); } else { if (count($schedule_types) == 1) { $system_name_format = 'TRIGGER_AND_SYSTEM'; } else { if (false && count($trigger_types) == 1) { // TODO XXX: this approach yields garbage strings generally without refining the selector // i.e. first make sure all the schedules match or are comparable $system_name_format = 'SYSTEM_AND_SCHEDULE'; } else { $system_name_format = null; } } } } } } } if (count($schedule_types) == 1 && $schedule_types[0] != 0) { self::$schedule_id = $schedule_types[0]; } foreach ($display_rows as $composite_xml => $row) { // $row['SystemID'] . ' ' . $row['ScheduleID'] . ' ' . $row['Trigger'] switch ($system_name_format) { case 'ORIGINAL_DATA': $system_name = null; break; case 'SYSTEM_NAME': $system_name = phoromatic_system_id_to_name($row['SystemID']); break; case 'TRIGGER': $system_name = $row['Trigger']; break; case 'TRIGGER_AND_SYSTEM': $system_name = phoromatic_system_id_to_name($row['SystemID']) . ': ' . $row['Trigger']; break; case 'SYSTEM_AND_SCHEDULE': $system_name = phoromatic_schedule_id_to_name($row['ScheduleID']) . ': ' . $row['Trigger']; break; default: $system_name = phoromatic_system_id_to_name($row['SystemID']) . ' - ' . phoromatic_schedule_id_to_name($row['ScheduleID']) . ' - ' . $row['Trigger']; } if ($system_name == null) { $rf = new pts_result_file($composite_xml); $identifiers = $rf->get_system_identifiers(); if (count($identifiers) == 1) { $system_name = $identifiers[0]; } } $system_name = str_replace('.SYSTEM', phoromatic_system_id_to_name($row['SystemID']), $system_name); $system_name = str_replace('.GROUP', phoromatic_account_id_to_group_name($row['AccountID']), $system_name); $system_variables = explode(';', phoromatic_server::system_id_variables($row['SystemID'], $row['AccountID'])); foreach ($system_variables as $var) { $var = explode('=', $var); if (count($var) == 2) { $system_name = str_replace('.' . $var[0], $var[1], $system_name); } } $result_files[] = new pts_result_merge_select($composite_xml, null, $system_name); } $result_file = new pts_result_file(null, true); $result_file->set_title('Phoromatic Results'); if (!empty($result_files)) { $attributes = array('new_result_file_title' => $result_file_title); if (!empty($result_files)) { $result_file->merge($result_files, $attributes); } } $extra_attributes = array(); if (isset($_GET['upload_to_openbenchmarking'])) { $ob_url = pts_openbenchmarking_client::upload_test_result($result_file, false); if ($ob_url) { header('Location: ' . $ob_url); } } $attribute_options = array('normalize_results' => 'normalize_result_buffer', 'sort_by_performance' => 'sort_result_buffer_values', 'sort_by_reverse' => 'reverse_result_buffer', 'sort_by_name' => 'sort_result_buffer', 'condense_comparison' => 'condense_multi_way', 'force_line_graph' => 'force_tracking_line_graph'); $url_append = null; foreach ($attribute_options as $web_var => $attr_var) { if (isset($_REQUEST[$web_var])) { $extra_attributes[$attr_var] = true; $url_append .= '&' . $web_var . '=1'; } } if (isset($_POST['transpose_comparison'])) { $result_file->invert_multi_way_invert(); } $intent = null; if (isset($_GET['download']) && $_GET['download'] == 'csv') { $result_csv = pts_result_file_output::result_file_to_csv($result_file); header('Content-Description: File Transfer'); header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename=phoromatic-result.csv'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . strlen($result_csv)); ob_clean(); flush(); echo $result_csv; return; } else { if (isset($_GET['download']) && $_GET['download'] == 'txt') { $result_txt = pts_result_file_output::result_file_to_text($result_file); header('Content-Description: File Transfer'); header('Content-Type: application/txt'); header('Content-Disposition: attachment; filename=phoromatic-result.txt'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . strlen($result_txt)); ob_clean(); flush(); echo $result_txt; return; } else { if (isset($_GET['download']) && $_GET['download'] == 'pdf') { ob_start(); $_REQUEST['force_format'] = 'PNG'; // Force to PNG renderer $_REQUEST['svg_dom_gd_no_interlacing'] = true; // Otherwise FPDF will fail $tdir = pts_client::create_temporary_directory(); pts_client::generate_result_file_graphs($result_file, $tdir, $extra_attributes); $pdf = new pts_pdf_template($result_file->get_title(), null); $pdf->AddPage(); $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38); $pdf->Ln(120); $pdf->WriteStatementCenter('www.phoronix-test-suite.com'); $pdf->Ln(15); $pdf->WriteBigHeaderCenter($result_file->get_title()); $pdf->WriteText($result_file->get_description()); $pdf->AddPage(); $pdf->Ln(15); $pdf->SetSubject($result_file->get_title() . ' Benchmarks'); //$pdf->SetKeywords(implode(', ', $identifiers)); $pdf->WriteHeader('Test Systems:'); foreach ($result_file->get_systems() as $s) { $pdf->WriteMiniHeader($s->get_identifier()); $pdf->WriteText($s->get_hardware()); $pdf->WriteText($s->get_software()); } $pdf->AddPage(); $placement = 1; $results = $result_file->get_result_objects(); for ($i = 1; $i <= count($results); $i++) { if (is_file($tdir . 'result-graphs/' . $i . '.png')) { $pdf->Ln(100); $pdf->Image($tdir . 'result-graphs/' . $i . '.png', 50, 40 + ($placement - 1) * 120, 120); } if ($placement == 2) { $placement = 0; if ($i != count($results)) { $pdf->AddPage(); } } $placement++; } ob_get_clean(); $pdf->Output('phoromatic.pdf', 'I'); //pts_file_io::delete($tdir, null, true); return; } else { if (isset($_GET['download']) && $_GET['download'] == 'xml') { echo $result_file->get_xml(); return; } } } } $main .= '<h1>' . $result_file->get_title() . '</h1>'; $main .= phoromatic_annotate_entry('RESULT', implode(',', $upload_ids), 'TOP'); if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) { $table = new pts_ResultFileCompactSystemsTable($result_file, $intent); } else { $table = new pts_ResultFileSystemsTable($result_file); } $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $table = new pts_ResultFileTable($result_file, $intent); $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $main .= '<div id="pts_results_area">'; foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) { $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>'; $main .= phoromatic_annotate_entry('RESULT', implode(',', $upload_ids), $result_object->get_comparison_hash(true, false)); $main .= '<p class="result_object">'; $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes); $main .= '</p>'; } $main .= '</div>'; } else { // No result } $right = null; if (self::$schedule_id && !empty(self::$schedule_id)) { $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id LIMIT 1'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':schedule_id', self::$schedule_id); $result = $stmt->execute(); $row = $result->fetchArray(); if (!empty($row)) { $right .= '<h3><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h3>'; if (!empty($row['ActiveOn'])) { $right .= '<p align="center"><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></p>'; } $right .= '<p>Compare this result file to the latest results from the past: '; $right .= '<select name="view_results_from_past" id="view_results_from_past" onchange="phoromatic_jump_to_results_from(\'' . $row['ScheduleID'] . '\', \'view_results_from_past\', \'' . $PATH[0] . ',\');">'; $oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule(self::$schedule_id)); $opts = array('Week' => 7, 'Three Weeks' => 21, 'Month' => 30, 'Quarter' => 90, 'Six Months' => 180, 'Year' => 365); foreach ($opts as $str_name => $time_offset) { if ($oldest_upload_time > time() - 86400 * $time_offset) { break; } $right .= '<option value="' . $time_offset . '">' . $str_name . '</option>'; } $right .= '<option value="all">All Results</option>'; $right .= '</select>'; $right .= '</p>'; } } if (true) { $compare_results = array(); $hash_matches = 0; $ticket_matches = 0; $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND ComparisonHash = :comparison_hash AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':comparison_hash', $result_file->get_contained_tests_hash(false)); $stmt->bindValue(':pprid', implode(',', $upload_ids)); $result = $stmt->execute(); while ($row = $result->fetchArray()) { $compare_results[$row['PPRID']] = $row; $hash_matches++; } foreach ($benchmark_tickets as $ticket_id) { $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND BenchmarkTicketID = :ticket_id AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':ticket_id', $ticket_id); $stmt->bindValue(':pprid', implode(',', $upload_ids)); $result = $stmt->execute(); while ($row = $result->fetchArray()) { $compare_results[$row['PPRID']] = $row; $ticket_matches++; } } if (!empty($compare_results)) { $right .= '<hr /><h3>Compare Results</h3><form name="compare_similar_results" onsubmit="return false;"> <input type="hidden" value="' . implode(',', $upload_ids) . '" id="compare_similar_results_this" />'; foreach ($compare_results as &$row) { $right .= '<p><input type="checkbox" value="' . $row['PPRID'] . '" name="compare_results" /> ' . $row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($row['SystemID'], $row['AccountID']) . '</em></p>'; } $right .= '<p><input type="submit" value="Compare Results" id="compare_results_submit" onclick="javascript:phoromatic_do_custom_compare_results(this); return false;" /></p></form>'; if ($ticket_matches > 3) { $right .= '<p><a href="/results/ticket/' . $ticket_id . '">Find All Matching Results</a>'; } else { if ($hash_matches > 3) { $right .= '<p><a href="/results/hash/' . $result_file->get_contained_tests_hash(false) . '">Find All Matching Results</a>'; } } } } if (count($upload_ids) > 1) { $checkbox_options = array('normalize_results' => 'Normalize Results', 'sort_by_performance' => 'Sort Results By Performance', 'sort_by_name' => 'Reverse Result By Identifier', 'sort_by_reverse' => 'Reverse Result Order', 'show_only_changed_results' => 'Show Only Results With Result Variation', 'force_line_graph' => 'Force Line Graph'); if ($result_file->is_multi_way_comparison()) { $checkbox_options['condense_comparison'] = 'Condense Comparison'; $checkbox_options['transpose_comparison'] = 'Transpose Comparison'; } $right .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_result_view" method="post"><hr /><h3>Result Analysis Options</h3><p align="left">' . PHP_EOL; foreach ($checkbox_options as $val => $name) { $right .= '<input type="checkbox" name="' . $val . '" value="1" ' . (isset($_POST[$val]) ? 'checked="checked" ' : null) . '/> ' . $name . '<br />'; } $right .= '<br /><input type="submit" value="Refresh Results"></p></form>'; } if (self::$schedule_id && !empty(self::$schedule_id) && $system_types[0] && $trigger_types[0]) { $stmt = phoromatic_server::$db->prepare('SELECT UserContextStep FROM phoromatic_system_context_logs WHERE AccountID = :account_id AND ScheduleID = :schedule_id AND SystemID = :system_id AND TriggerID = :trigger_id'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':system_id', $system_types[0]); $stmt->bindValue(':schedule_id', self::$schedule_id); $stmt->bindValue(':trigger_id', $trigger_types[0]); $result = $stmt->execute(); if ($row = $result->fetchArray()) { $right .= '<hr /><h3>User Context Logs</h3>'; do { $right .= '<p><a href="?logs/context/' . $system_types[0] . ',' . self::$schedule_id . ',' . base64_encode($trigger_types[0]) . '">' . $row['UserContextStep'] . '</a></p>'; } while ($row = $result->fetchArray()); } } $right .= '<hr /><h3>Result Export</h3>'; $right .= '<p><a href="/public.php?t=result&ut=' . implode(',', $upload_ids) . $url_append . '">Public Viewer</a></p>'; $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=pdf' . $url_append . '">Download As PDF</a></p>'; $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=csv">Download As CSV</a></p>'; $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=xml">Download As XML</a></p>'; $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=txt">Download As TEXT</a></p>'; $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&upload_to_openbenchmarking">Upload To OpenBenchmarking.org</a></p>'; if (is_file(phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'system-logs.zip')) { $right .= '<hr /><p><a href="?logs/system/' . $row['UploadID'] . '">View System Logs</a></p>'; } echo phoromatic_webui_header_logged_in(); echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right)); echo phoromatic_webui_footer(); }
$main .= '<p>' . $result_file->get_description() . '</p>'; $main .= phoromatic_annotate_entry('RESULT', implode(',', $result_ids), 'TOP'); if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) { $table = new pts_ResultFileCompactSystemsTable($result_file, $intent); } else { $table = new pts_ResultFileSystemsTable($result_file); } $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $table = new pts_ResultFileTable($result_file, $intent); $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $main .= '<div id="pts_results_area">'; foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) { $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>'; $main .= phoromatic_annotate_entry('RESULT', implode(',', $result_ids), $result_object->get_comparison_hash(true, false)); $main .= '<p style="text-align: center; overflow: auto;">'; $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes); $main .= '</p>'; } $main .= '</div>'; } else { $time_limit = false; $time_str = false; if (isset($_POST['time'])) { $time_str = $_POST['time']; $time_limit = strtotime('- ' . $time_str); } if ($time_limit == false) { $time_str = '1 month'; $time_limit = strtotime('- ' . $time_str); } $result_limit = isset($_POST['result_limit']) && is_numeric($_POST['result_limit']) && $_POST['result_limit'] > 9 ? $_POST['result_limit'] : 50;
public function points_of_possible_interest($threshold_level = 0.1) { $points_of_interest = array(); if ($this->test_profile->get_display_format() != 'BAR_GRAPH') { return $points_of_interest; } $is_multi_way = pts_render::multi_way_identifier_check($this->test_result_buffer->get_identifiers()); $keys = array_keys($this->test_result_buffer->buffer_items); if ($is_multi_way) { $key_sets = array(); foreach ($keys as $k) { $identifier_r = pts_strings::trim_explode(': ', $this->test_result_buffer->buffer_items[$k]->get_result_identifier()); if (!isset($key_sets[$identifier_r[0]])) { $key_sets[$identifier_r[0]] = array(); } $key_sets[$identifier_r[0]][] = $k; } } else { $key_sets = array($keys); } foreach ($key_sets as $keys) { $prev_value = -1; $prev_id = -1; foreach ($keys as $k) { $this_value = $this->test_result_buffer->buffer_items[$k]->get_result_value(); $this_id = $this->test_result_buffer->buffer_items[$k]->get_result_identifier(); if ($prev_value != -1 && $prev_id != -1) { $d = abs($prev_value / $this_value - 1); if ($d > $threshold_level) { $points_of_interest[] = $this_id . ' - ' . $prev_id . ': ' . round($d * 100, 2) . '%'; } } $prev_value = $this_value; $prev_id = $this_id; } } return $points_of_interest; }
public static function generate_result_file_graphs($test_results_identifier, $save_to_dir = false, $extra_attributes = null) { if ($save_to_dir) { if (pts_file_io::mkdir($save_to_dir . '/result-graphs') == false) { // Directory must exist, so remove any old graph files first foreach (pts_file_io::glob($save_to_dir . '/result-graphs/*') as $old_file) { unlink($old_file); } } } if ($test_results_identifier instanceof pts_result_file) { $result_file =& $test_results_identifier; } else { $result_file = new pts_result_file($test_results_identifier); } $generated_graphs = array(); $generated_graph_tables = false; // Render overview chart if ($save_to_dir) { $chart = new pts_ResultFileTable($result_file); $chart->renderChart($save_to_dir . '/result-graphs/overview.BILDE_EXTENSION'); $intent = -1; if (($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true)) || $result_file->get_system_count() == 1) { $chart = new pts_ResultFileCompactSystemsTable($result_file, $intent); } else { $chart = new pts_ResultFileSystemsTable($result_file); } $chart->renderChart($save_to_dir . '/result-graphs/systems.BILDE_EXTENSION'); unset($chart); if ($intent && is_dir($save_to_dir . '/system-logs/')) { $chart = new pts_DetailedSystemComponentTable($result_file, $save_to_dir . '/system-logs/', $intent); if ($chart) { $chart->renderChart($save_to_dir . '/result-graphs/detailed_component.BILDE_EXTENSION'); } } } $result_objects = $result_file->get_result_objects(); $test_titles = array(); foreach ($result_objects as &$result_object) { array_push($test_titles, $result_object->test_profile->get_title()); } $offset = 0; foreach ($result_objects as $key => &$result_object) { $save_to = $save_to_dir; $offset++; if ($save_to_dir && is_dir($save_to_dir)) { $save_to .= '/result-graphs/' . $offset . '.BILDE_EXTENSION'; if (PTS_IS_CLIENT) { if ($result_file->is_multi_way_comparison(null, $extra_attributes) || pts_client::read_env('GRAPH_GROUP_SIMILAR')) { $table_keys = array(); foreach ($test_titles as $this_title_index => $this_title) { if (isset($test_titles[$key]) && $this_title == $test_titles[$key]) { array_push($table_keys, $this_title_index); } } } else { $table_keys = $key; } $chart = new pts_ResultFileTable($result_file, null, $table_keys); $chart->renderChart($save_to_dir . '/result-graphs/' . $offset . '_table.BILDE_EXTENSION'); unset($chart); $generated_graph_tables = true; } } $graph = pts_render::render_graph($result_object, $result_file, $save_to, $extra_attributes); array_push($generated_graphs, $graph); } // Generate mini / overview graphs if ($save_to_dir) { $graph = new pts_OverviewGraph($result_file); if ($graph->doSkipGraph() == false) { $graph->renderGraph(); // Check to see if skip_graph was realized during the rendering process if ($graph->doSkipGraph() == false) { $graph->svg_dom->output($save_to_dir . '/result-graphs/visualize.BILDE_EXTENSION'); } } unset($graph); $graph = new pts_RadarOverviewGraph($result_file); if ($graph->doSkipGraph() == false) { $graph->renderGraph(); // Check to see if skip_graph was realized during the rendering process if ($graph->doSkipGraph() == false) { $graph->svg_dom->output($save_to_dir . '/result-graphs/radar.BILDE_EXTENSION'); } } unset($graph); } // Save XSL if (count($generated_graphs) > 0 && $save_to_dir) { file_put_contents($save_to_dir . '/pts-results-viewer.xsl', pts_client::xsl_results_viewer_graph_template($generated_graph_tables)); } return $generated_graphs; }
public function __construct(&$result_object = null, &$result_file = null, $extra_attributes = null) { // Initalize Colors $this->i['identifier_size'] = self::$c['size']['identifiers']; // Copy this since it's commonly overwritten $this->i['graph_orientation'] = 'VERTICAL'; $this->i['graph_value_type'] = 'NUMERICAL'; $this->i['hide_graph_identifiers'] = false; $this->i['show_graph_key'] = false; $this->i['show_background_lines'] = false; $this->i['iveland_view'] = false; $this->i['graph_max_value_multiplier'] = 1.285; $this->i['graph_max_value'] = 0; $this->i['bottom_offset'] = 0; $this->i['hide_y_title'] = false; $this->i['compact_result_view'] = false; $this->i['key_line_height'] = 0; $this->i['graph_height'] = 0; $this->i['graph_width'] = 0; $this->i['left_start'] = 10; $this->i['left_end_right'] = 10; $this->i['top_start'] = 62; $this->i['top_end_bottom'] = 22; $this->i['mark_count'] = 6; // Number of marks to make on vertical axis $this->i['multi_way_comparison_invert_default'] = true; $this->i['notes'] = array(); // Reset of setup besides config if ($result_object != null) { $test_version = $result_object->test_profile->get_app_version(); if (isset($test_version[2]) && is_numeric($test_version[0])) { $test_version = 'v' . $test_version; } $this->graph_title = trim($result_object->test_profile->get_title() . ' ' . $test_version); $this->graph_y_title = $result_object->test_profile->get_result_scale_formatted(); $this->test_identifier = $result_object->test_profile->get_identifier(); $this->i['graph_proportion'] = $result_object->test_profile->get_result_proportion(); $this->addSubTitle($result_object->get_arguments_description()); } $this->update_graph_dimensions(self::$c['graph']['width'], self::$c['graph']['height'], true); if (isset($extra_attributes['force_tracking_line_graph'])) { // Phoromatic result tracker $this->is_multi_way_comparison = true; } else { if (isset($result_object->test_result_buffer)) { $this->is_multi_way_comparison = pts_render::multi_way_identifier_check($result_object->test_result_buffer->get_identifiers()); } } $this->i['graph_version'] = 'Phoronix Test Suite ' . PTS_VERSION; if (isset($extra_attributes['regression_marker_threshold'])) { $this->d['regression_marker_threshold'] = $extra_attributes['regression_marker_threshold']; } if (isset($extra_attributes['set_alternate_view'])) { $this->d['link_alternate_view'] = $extra_attributes['set_alternate_view']; } if (isset($extra_attributes['highlight_graph_values'])) { $this->value_highlights = $extra_attributes['highlight_graph_values']; } else { if (PTS_IS_CLIENT && pts_client::read_env('GRAPH_HIGHLIGHT') != false) { $this->value_highlights = pts_strings::comma_explode(pts_client::read_env('GRAPH_HIGHLIGHT')); } } if (isset($extra_attributes['force_simple_keys'])) { $this->override_i_value('force_simple_keys', true); } if (isset($extra_attributes['multi_way_comparison_invert_default'])) { $this->i['multi_way_comparison_invert_default'] = $extra_attributes['multi_way_comparison_invert_default']; } $this->test_result =& $result_object; if (!isset($extra_attributes['no_compact_results_var'])) { $this->generate_results_var(); } }
public static function render_graph_process(&$result_object, &$result_file = null, $save_as = false, $extra_attributes = null) { if (isset($extra_attributes['sort_result_buffer'])) { $result_object->test_result_buffer->sort_buffer_items(); } if (isset($extra_attributes['reverse_result_buffer'])) { $result_object->test_result_buffer->buffer_values_reverse(); } if (isset($extra_attributes['normalize_result_buffer'])) { if (isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1) { $normalize_against = $extra_attributes['highlight_graph_values'][0]; } else { $normalize_against = false; } $result_object->normalize_buffer_values($normalize_against); } if (isset($extra_attributes['sort_result_buffer_values'])) { $result_object->test_result_buffer->buffer_values_sort(); if ($result_object->test_profile->get_result_proportion() == 'HIB') { $result_object->test_result_buffer->buffer_values_reverse(); } } if ($result_file != null) { // Cache the redundant words on identifiers so it's not re-computed on every graph static $redundant_word_cache; if (!isset($redundant_word_cache[$result_file->get_title()])) { $redundant_word_cache[$result_file->get_title()] = pts_render::evaluate_redundant_identifier_words($result_file->get_system_identifiers()); } if ($redundant_word_cache[$result_file->get_title()]) { $result_object->test_result_buffer->auto_shorten_buffer_identifiers($redundant_word_cache[$result_file->get_title()]); } // COMPACT PROCESS if (!isset($extra_attributes['compact_to_scalar']) && $result_object->test_profile->get_display_format() == 'LINE_GRAPH' && $result_file->get_system_count() > 10) { // If there's too many lines being plotted on line graph, likely to look messy, so convert to scalar automatically $extra_attributes['compact_to_scalar'] = true; } // XXX: removed || $result_file->is_results_tracker() from below and should be added // Removing the command fixes cases like: 1210053-BY-MYRESULTS43 $result_identifiers = $result_object->test_result_buffer->get_identifiers(); if ($result_file->is_multi_way_comparison($result_identifiers, $extra_attributes) || isset($extra_attributes['compact_to_scalar']) || isset($extra_attributes['compact_scatter'])) { if ((isset($extra_attributes['compact_to_scalar']) || false && $result_file->is_multi_way_comparison($result_identifiers, $extra_attributes)) && in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH', 'FILLED_LINE_GRAPH'))) { // Convert multi-way line graph into horizontal box plot if (true) { $result_object->test_profile->set_display_format('HORIZONTAL_BOX_PLOT'); } /* else // XXX commented out during PTS 6.0 development, TODO decide if to delete { // Turn a multi-way line graph into an averaged bar graph $buffer_items = $result_object->test_result_buffer->get_buffer_items(); $result_object->test_result_buffer = new pts_test_result_buffer(); foreach($buffer_items as $buffer_item) { $values = pts_strings::comma_explode($buffer_item->get_result_value()); $avg_value = pts_math::set_precision(array_sum($values) / count($values), 2); $j = null; if(count($values) > 2) { $j['min-result'] = min($values); $j['max-result'] = max($values); if($j['min-result'] == $j['max-result']) { $json = null; } } $result_object->test_result_buffer->add_test_result($buffer_item->get_result_identifier(), $avg_value, null, $j, $j['min-result'], $j['max-result']); } $result_object->test_profile->set_display_format('BAR_GRAPH'); } */ } if ($result_object->test_profile->get_display_format() != 'PIE_CHART' && (phx_graph_render::multi_way_identifier_check($result_object->test_result_buffer->get_identifiers()) || isset($extra_attributes['force_tracking_line_graph']) && $extra_attributes['force_tracking_line_graph'])) { //$result_table = false; //pts_render::compact_result_file_test_object($result_object, $result_table, $result_file, $extra_attributes); if ($result_object->test_profile->get_display_format() == 'LINE_GRAPH' || isset($extra_attributes['force_tracking_line_graph']) && $extra_attributes['force_tracking_line_graph']) { $result_object->test_profile->set_display_format('LINE_GRAPH'); } } } else { if (in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH'))) { // Check to see for line graphs if every result is an array of the same result (i.e. a flat line for every result). // If all the results are just flat lines, you might as well convert it to a bar graph $buffer_items = $result_object->test_result_buffer->get_buffer_items(); $all_values_are_flat = false; $flat_values = array(); foreach ($buffer_items as $i => $buffer_item) { $unique_in_buffer = array_unique(explode(',', $buffer_item->get_result_value())); $all_values_are_flat = count($unique_in_buffer) == 1; if ($all_values_are_flat == false) { break; } $flat_values[$i] = array_pop($unique_in_buffer); } if ($all_values_are_flat) { $result_object->test_result_buffer = new pts_test_result_buffer(); foreach ($buffer_items as $i => $buffer_item) { $result_object->test_result_buffer->add_test_result($buffer_item->get_result_identifier(), $flat_values[$i]); } $result_object->test_profile->set_display_format('BAR_GRAPH'); } } } } if (isset($extra_attributes['graph_render_type'])) { $result_object->test_profile->set_display_format($extra_attributes['graph_render_type']); } $display_format = $result_object->test_profile->get_display_format(); switch ($display_format) { case 'LINE_GRAPH': $graph = new phx_graph_lines($result_object, $result_file, $extra_attributes); break; case 'HORIZONTAL_BOX_PLOT': $graph = new phx_graph_box_plot($result_object, $result_file, $extra_attributes); break; case 'BAR_ANALYZE_GRAPH': case 'BAR_GRAPH': $graph = new phx_graph_horizontal_bars($result_object, $result_file); break; case 'PASS_FAIL': $graph = new pts_PassFailGraph($result_object, $result_file); break; case 'MULTI_PASS_FAIL': $graph = new pts_MultiPassFailGraph($result_object, $result_file); break; case 'TEST_COUNT_PASS': $graph = new pts_TestCountPassGraph($result_object, $result_file); break; case 'PIE_CHART': $graph = new pts_PieChart($result_object, $result_file); break; case 'IMAGE_COMPARISON': $graph = new pts_ImageComparisonGraph($result_object, $result_file); break; case 'SCATTER_PLOT': $graph = new pts_ScatterPlot($result_object, $result_file); break; default: switch ($requested_graph_type) { case 'LINE_GRAPH': $graph = new phx_graph_lines($result_object, $result_file, $extra_attributes); break; case 'HORIZONTAL_BOX_PLOT': $graph = new phx_graph_box_plot($result_object, $result_file, $extra_attributes); break; default: $graph = new phx_graph_horizontal_bars($result_object, $result_file, $extra_attributes); break; } break; } self::report_test_notes_to_graph($graph, $result_object); return $graph; }
public function buffer_values_to_percent() { $is_multi_way = pts_render::multi_way_identifier_check($this->get_identifiers()); if ($is_multi_way) { $group_values = array(); foreach ($this->buffer_items as &$buffer_item) { $identifier_r = pts_strings::trim_explode(': ', $buffer_item->get_result_identifier()); if (!isset($group_values[$identifier_r[1]])) { $group_values[$identifier_r[1]] = 0; } $group_values[$identifier_r[1]] += $buffer_item->get_result_value(); } foreach ($this->buffer_items as &$buffer_item) { $identifier_r = pts_strings::trim_explode(': ', $buffer_item->get_result_identifier()); $percent = pts_math::set_precision($buffer_item->get_result_value() / $group_values[$identifier_r[1]] * 100, 3); $buffer_item->reset_result_value($percent); } } else { $total_value = array_sum($this->get_values()); foreach ($this->buffer_items as &$buffer_item) { $percent = pts_math::set_precision($buffer_item->get_result_value() / $total_value * 100, 3); $buffer_item->reset_result_value($percent); } } }
public static function run($r) { $render_dir = pts_client::temporary_directory() . '/pts-render-test-310815/'; if (!is_file($render_dir . 'mega-render-test.tar.bz2')) { pts_file_io::mkdir($render_dir); pts_network::download_file('http://linuxbenchmarking.com/misc/mega-render-test-310815.tar.bz2', $render_dir . 'mega-render-test.tar.bz2'); pts_compression::archive_extract($render_dir . 'mega-render-test.tar.bz2'); } define('PATH_TO_EXPORTED_PHOROMATIC_DATA', $render_dir . 'mega-render-test-310815/'); error_reporting(E_ALL); ini_set('memory_limit', '2048M'); $export_index_json = file_get_contents(PATH_TO_EXPORTED_PHOROMATIC_DATA . 'export-index.json'); $export_index_json = json_decode($export_index_json, true); $dump_size = 0; $start = microtime(true); foreach (array_keys($export_index_json['phoromatic']) as $REQUESTED) { $this_render_test = time(); $tracker =& $export_index_json['phoromatic'][$REQUESTED]; $triggers = $tracker['triggers']; echo PHP_EOL . 'STARTING RENDER TEST ON: ' . $REQUESTED . ' (' . count($triggers) . ' Triggers)' . PHP_EOL; $length = count($tracker['triggers']); $result_files = array(); foreach ($triggers as $trigger) { $results_for_trigger = glob(PATH_TO_EXPORTED_PHOROMATIC_DATA . '/' . $REQUESTED . '/' . $trigger . '/*/composite.xml'); echo '.'; if ($results_for_trigger == false) { continue; } foreach ($results_for_trigger as $composite_xml) { // Add to result file $system_name = basename(dirname($composite_xml)) . ': ' . $trigger; array_push($result_files, new pts_result_merge_select($composite_xml, null, $system_name)); } } echo 'STARTING MERGE; '; $result_file = new pts_result_file(null, true); $result_file->merge($result_files); echo 'MAKING NEW RESULT FILE; '; $extra_attributes = array('reverse_result_buffer' => true, 'force_simple_keys' => true, 'force_line_graph_compact' => true, 'force_tracking_line_graph' => true); //$extra_attributes['normalize_result_buffer'] = true; $intent = null; //$table = new pts_ResultFileTable($result_file, $intent); //echo '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; echo 'STARTING RESULT LOOP; '; $html_dump = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body>'; foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) { echo $result_object->test_profile->get_title() . ' '; $html_dump .= '<h3>' . $result_object->get_arguments_description() . '</h3>'; $html_dump .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes); unset($result_object); } $table = new pts_ResultFileSystemsTable($result_file); $html_dump .= pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes); echo PHP_EOL . PHP_EOL . 'RENDER TEST ON: ' . $REQUESTED . ' TOOK ' . (time() - $this_render_test) . PHP_EOL; $dump_size += strlen($html_dump); file_put_contents(PATH_TO_EXPORTED_PHOROMATIC_DATA . $REQUESTED . '.html', $html_dump . '</body></html>'); } echo PHP_EOL . 'RENDER TEST TOOK: ' . (time() - $start) . PHP_EOL . PHP_EOL; echo PHP_EOL . 'PEAK MEMORY USAGE: ' . round(memory_get_peak_usage(true) / 1048576, 3) . ' MB'; echo PHP_EOL . 'PEAK MEMORY USAGE (emalloc): ' . round(memory_get_peak_usage() / 1048576, 3) . ' MB'; echo PHP_EOL . 'TOTAL FILE SIZE: ' . ceil($dump_size / 1000) . ' KB'; echo PHP_EOL; }
public function normalize_buffer_values($normalize_against = false) { if ($this->test_profile->get_display_format() != 'BAR_GRAPH') { return false; } $is_multi_way = pts_render::multi_way_identifier_check($this->test_result_buffer->get_identifiers()); $keys = array_keys($this->test_result_buffer->buffer_items); if ($is_multi_way) { $key_sets = array(); foreach ($keys as $k) { $identifier_r = pts_strings::trim_explode(': ', $this->test_result_buffer->buffer_items[$k]->get_result_identifier()); if (!isset($key_sets[$identifier_r[0]])) { $key_sets[$identifier_r[0]] = array(); } array_push($key_sets[$identifier_r[0]], $k); } } else { $key_sets = array($keys); } foreach ($key_sets as $keys) { if ($this->test_profile->get_result_proportion() == 'LIB') { // Invert values for LIB foreach ($keys as $k) { $this->test_result_buffer->buffer_items[$k]->reset_result_value(1 / $this->test_result_buffer->buffer_items[$k]->get_result_value()); } } $divide_value = -1; if ($normalize_against != false) { foreach ($keys as $k) { if ($is_multi_way && strpos($this->test_result_buffer->buffer_items[$k]->get_result_identifier(), ': ' . $normalize_against) !== false) { // This allows it to just normalize against part of the string $divide_value = $this->test_result_buffer->buffer_items[$k]->get_result_value(); break; } else { if ($this->test_result_buffer->buffer_items[$k]->get_result_identifier() == $normalize_against) { $divide_value = $this->test_result_buffer->buffer_items[$k]->get_result_value(); break; } } } } if ($divide_value == -1) { foreach ($keys as $k) { if ($this->test_result_buffer->buffer_items[$k]->get_result_value() < $divide_value || $divide_value == -1) { $divide_value = $this->test_result_buffer->buffer_items[$k]->get_result_value(); } } } if ($divide_value != 0) { foreach ($keys as $k) { $normalized = pts_math::set_precision($this->test_result_buffer->buffer_items[$k]->get_result_value() / $divide_value, max(3, $this->result_precision)); $this->test_result_buffer->buffer_items[$k]->reset_result_value($normalized); $this->test_result_buffer->buffer_items[$k]->reset_raw_value(0); } } } $this->test_profile->set_result_proportion('HIB'); $this->test_profile->set_result_scale('Relative Performance'); return true; }
public static function render_page_process($PATH) { echo phoromatic_webui_header_logged_in(); $main = null; if (isset($PATH[0]) && !empty($PATH[0])) { ini_set('memory_limit', '4G'); if (isset($_POST['view_results_from_past']) && is_numeric($_POST['view_results_from_past'])) { $cut_duration = $_POST['view_results_from_past']; } else { $cut_duration = 21; } $stmt = phoromatic_server::$db->prepare('SELECT UploadID, UploadTime, ScheduleID, Trigger, SystemID FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':schedule_id', $PATH[0]); $test_result_result = $stmt->execute(); $cutoff_time = is_numeric($cut_duration) ? strtotime('today -' . $cut_duration . ' days') : false; $show_only_latest_systems = array(); $result_files = array(); while ($test_result_result && ($row = $test_result_result->fetchArray())) { if ($cutoff_time !== false && strtotime($row['UploadTime']) < $cutoff_time) { break; } $composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml'; if (!is_file($composite_xml)) { continue; } // Add to result file $system_name = phoromatic_server::system_id_to_name($row['SystemID']) . ': ' . $row['Trigger']; array_push($result_files, new pts_result_merge_select($composite_xml, null, $system_name)); if (!isset($show_only_latest_systems[$_SESSION['AccountID'] . $row['SystemID']])) { $show_only_latest_systems[$_SESSION['AccountID'] . $row['SystemID']] = new pts_result_merge_select($composite_xml, null, $system_name); } } if (count($result_files) < 21) { $show_only_latest_systems = null; } $attributes = array('new_result_file_title' => phoromatic_schedule_id_to_name($row['ScheduleID'])); $result_file = new pts_result_file(null, true); $result_file->merge($result_files, $attributes); $extra_attributes = array('reverse_result_buffer' => true, 'force_simple_keys' => true, 'force_line_graph_compact' => true, 'force_tracking_line_graph' => true); if (isset($_POST['normalize_results']) && $_POST['normalize_results']) { $extra_attributes['normalize_result_buffer'] = true; } $main .= '<h1>' . $result_file->get_title() . '</h1>'; if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) { $table = new pts_ResultFileCompactSystemsTable($result_file, $intent); } else { $table = new pts_ResultFileSystemsTable($result_file); } $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $table = new pts_ResultFileTable($result_file, $intent); $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>'; $main .= '<div id="pts_results_area">'; foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) { $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>'; $main .= '<p class="result_object">'; $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes); $main .= '</p>'; } $main .= '</div>'; $right = '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_result_view" method="post">'; $right .= '<p>Compare results for the past: '; $right .= '<select name="view_results_from_past" id="view_results_from_past">'; $oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule($PATH[0])); $opts = array('Two Weeks' => 14, 'Three Weeks' => 21, 'One Month' => 30, 'Two Months' => 60, 'Quarter' => 90, 'Six Months' => 180, 'Year' => 365); foreach ($opts as $str_name => $time_offset) { if ($oldest_upload_time > time() - 86400 * $time_offset) { break; } $right .= '<option value="' . $time_offset . '">' . $str_name . '</option>'; } $right .= '<option value="all">All Results</option>'; $right .= '</select>'; $right .= '</p>'; $right .= '<p><input type="checkbox" name="normalize_results" value="1" ' . (isset($_POST['normalize_results']) ? 'checked="checked" ' : null) . '/> Normalize Results?</p>'; $right .= '<p><input type="submit" value="Refresh Results"></p></form>'; } else { if (empty($PATH)) { $main .= '<h1>Phoromatic Tracker</h1> <p>The Phoromatic Tracker will show result schedules that have enough uploaded test results from the associated systems to begin providing concise overviews of performance over time.</p> <div class="pts_phoromatic_info_box_area"> <ul> <li><h1>Trackable Results</h1></li>'; $stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups, RunAt, ActiveOn, (SELECT COUNT(*) FROM phoromatic_results WHERE ScheduleID = phoromatic_schedules.ScheduleID) AS UploadedResultCount FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $result = $stmt->execute(); $row = $result->fetchArray(); if ($row == false) { $main .= '<li class="light" style="text-align: center;">No Relevant Schedules Found</li>'; } else { do { if ($row['UploadedResultCount'] > ($row['RunTargetSystems'] + $row['RunTargetGroups'] + 1) * 7) { $stmt_tests = phoromatic_server::$db->prepare('SELECT COUNT(*) AS TestCount FROM phoromatic_schedules_tests WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY TestProfile ASC'); $stmt_tests->bindValue(':account_id', $_SESSION['AccountID']); $stmt_tests->bindValue(':schedule_id', $row['ScheduleID']); $result_tests = $stmt_tests->execute(); $row_tests = $result_tests->fetchArray(); $test_count = !empty($row_tests) ? $row_tests['TestCount'] : 0; $group_count = empty($row['RunTargetGroups']) ? 0 : count(explode(',', $row['RunTargetGroups'])); $main .= '<a href="?tracker/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><table><tr><td>' . pts_strings::plural_handler(count(phoromatic_server::systems_associated_with_schedule($_SESSION['AccountID'], $row['ScheduleID'])), 'System') . '</td><td>' . pts_strings::plural_handler($group_count, 'Group') . '</td><td>' . pts_strings::plural_handler($test_count, 'Test') . '</td><td>' . pts_strings::plural_handler($row['UploadedResultCount'], 'Result') . ' Total</td></tr></table></li></a>'; } } while ($row = $result->fetchArray()); } $main .= '</ul> </div>'; $right = null; } } echo phoromatic_webui_main($main, $right); echo phoromatic_webui_footer(); }
public static function render_page_process($PATH) { $main = null; $identifier_item = isset($PATH[1]) ? $PATH[0] . '/' . $PATH[1] : false; if ($identifier_item && pts_test_profile::is_test_profile($identifier_item)) { $tp = new pts_test_profile($identifier_item); $tp_identifier = $tp->get_identifier(false); $main .= '<h1>' . $tp->get_title() . '</h1><p>' . $tp->get_description() . '</p>'; $main .= '<p><strong>' . $tp->get_test_hardware_type() . ' - ' . phoromatic_server::test_result_count_for_test_profile($_SESSION['AccountID'], $tp_identifier) . ' Results On This Account - ' . $tp->get_test_software_type() . ' - Maintained By: ' . $tp->get_maintainer() . ' - Supported Platforms: ' . implode(', ', $tp->get_supported_platforms()) . '</strong></p>'; $main .= '<p><a href="http://openbenchmarking.org/test/' . $tp_identifier . '">Find out more about this test profile on OpenBenchmarking.org</a>.</p>'; $main .= '<h2>Recent Results With This Test</h2>'; $stmt = phoromatic_server::$db->prepare('SELECT Title, PPRID FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 30'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':tp', $tp_identifier . '%'); $result = $stmt->execute(); $recent_result_count = 0; while ($result && ($row = $result->fetchArray())) { $recent_result_count++; $main .= '<h2><a href="/?result/' . $row['PPRID'] . '">' . $row['Title'] . '</a></h2>'; } if ($recent_result_count == 0) { $main .= '<p>No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.</p>'; } else { if ($recent_result_count > 5) { $stmt = phoromatic_server::$db->prepare('SELECT UploadID, SystemID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 1000'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':tp', $tp_identifier . '%'); $result = $stmt->execute(); $recent_result_count = 0; $result_file = new pts_result_file(null, true); while ($result && ($row = $result->fetchArray())) { $composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml'; if (!is_file($composite_xml)) { continue; } // Add to result file $system_name = strtotime($row['UploadTime']) . ': ' . phoromatic_server::system_id_to_name($row['SystemID']); $sub_result_file = new pts_result_file($composite_xml, true); foreach ($sub_result_file->get_result_objects() as $obj) { if ($obj->test_profile->get_identifier(false) == $tp_identifier) { $obj->test_result_buffer->rename(null, $system_name); $result_file->add_result($obj); } } } $table = null; $extra_attributes = array('multi_way_comparison_invert_default' => false); $f = false; foreach ($result_file->get_result_objects() as $obj) { $obj->test_profile->set_display_format('SCATTER_PLOT'); foreach ($obj->test_result_buffer->buffer_items as $i => &$item) { if (!is_numeric(substr($item->get_result_identifier(), 0, strpos($item->get_result_identifier(), ':')))) { unset($obj->test_result_buffer->buffer_items[$i]); } } $result_file = null; $main .= '<p align="center">' . pts_render::render_graph_inline_embed($obj, $result_file, $extra_attributes) . '</p>'; } } } } else { $dc = pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH))); $dc_exists = is_file($dc . 'pts-download-cache.json'); if ($dc_exists) { $cache_json = file_get_contents($dc . 'pts-download-cache.json'); $cache_json = json_decode($cache_json, true); } $test_counts_for_account = phoromatic_server::test_result_count_for_test_profiles($_SESSION['AccountID']); foreach (pts_openbenchmarking::available_tests() as $test) { $cache_checked = false; if ($dc_exists) { if ($cache_json && isset($cache_json['phoronix-test-suite']['cached-tests'])) { $cache_checked = true; if (!in_array($test, $cache_json['phoronix-test-suite']['cached-tests'])) { //continue; } } } if (!$cache_checked && phoromatic_server::read_setting('show_local_tests_only') && pts_test_install_request::test_files_in_cache($test, true, true) == false) { continue; } $tp = new pts_test_profile($test); if ($tp->get_title() == null) { continue; } $test_count = 0; $tpid = $tp->get_identifier(false); foreach ($test_counts_for_account as $test => $count) { if (strpos($test, $tpid) !== false) { $test_count += $count; unset($test_counts_for_account[$test]); } } $main .= '<h1 style="margin-bottom: 0;"><a href="/?tests/' . $tp->get_identifier(false) . '">' . $tp->get_title() . '</a></h1>'; $main .= '<p style="font-size: 90%;"><strong>' . $tp->get_test_hardware_type() . '</strong> <em>-</em> ' . $test_count . ' Results On This Account' . ' </p>'; } } echo phoromatic_webui_header_logged_in(); echo '<div id="pts_phoromatic_main_area">' . $main . '</div>'; echo phoromatic_webui_footer(); }
public static function result_file_to_pdf(&$result_file, $dest, $output_name, $extra_attributes = null) { ob_start(); $_REQUEST['force_format'] = 'JPEG'; // Force to PNG renderer $_REQUEST['svg_dom_gd_no_interlacing'] = true; // Otherwise FPDF will fail $pdf = new pts_pdf_template($result_file->get_title(), null); $pdf->AddPage(); $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38); $pdf->Ln(120); $pdf->WriteStatementCenter('www.phoronix-test-suite.com'); $pdf->Ln(15); $pdf->WriteBigHeaderCenter($result_file->get_title()); $pdf->WriteText($result_file->get_description()); $pdf->AddPage(); $pdf->Ln(15); $pdf->SetSubject($result_file->get_title() . ' Benchmarks'); //$pdf->SetKeywords(implode(', ', $identifiers)); $pdf->WriteHeader('Test Systems:'); foreach ($result_file->get_systems() as $s) { $pdf->WriteMiniHeader($s->get_identifier()); $pdf->WriteText($s->get_hardware()); $pdf->WriteText($s->get_software()); } $pdf->AddPage(); $placement = 1; $i = 0; foreach ($result_file->get_result_objects() as $key => &$result_object) { $graph = pts_render::render_graph_process($result_object, $result_file, false, $extra_attributes); if ($graph == false) { continue; } $graph->renderGraph(); $output = $graph->svg_dom->output(null); $pdf->Ln(100); $pdf->ImageJPGInline($output, 50, 40 + ($placement - 1) * 120, 120); if ($placement == 2) { $placement = 0; if ($i != count($results)) { $pdf->AddPage(); } } $placement++; $i++; } ob_get_clean(); $pdf->Output($dest, $output_name); }