How to use phoromatic_tracker class

Best Phoronix-test-suite code snippet using phoromatic_tracker

pts_ResultFileTable.php

Source: pts_ResultFileTable.php Github

copy

Full Screen

1<?php2/​*3 Phoronix Test Suite4 URLs: http:/​/​www.phoronix.com, http:/​/​www.phoronix-test-suite.com/​5 Copyright (C) 2009 - 2017, Phoronix Media6 Copyright (C) 2009 - 2017, Michael Larabel7 pts_ResultFileTable.php: The result file table object8 This program is free software; you can redistribute it and/​or modify9 it under the terms of the GNU General Public License as published by10 the Free Software Foundation; either version 3 of the License, or11 (at your option) any later version.12 This program is distributed in the hope that it will be useful,13 but WITHOUT ANY WARRANTY; without even the implied warranty of14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 GNU General Public License for more details.16 You should have received a copy of the GNU General Public License17 along with this program. If not, see <http:/​/​www.gnu.org/​licenses/​>.18*/​19class pts_ResultFileTable extends pts_Table20{21 public $flagged_results = array();22 public function __construct(&$result_file, $system_id_keys = null, $result_object_index = -1, $extra_attributes = null)23 {24 list($rows, $columns, $table_data) = self::result_file_to_result_table($result_file, $system_id_keys, $result_object_index, $this->flagged_results, $extra_attributes);25 parent::__construct($rows, $columns, $table_data, $result_file);26 $this->result_object_index = $result_object_index;27 if($result_object_index == -1)28 {29 $this->graph_title = $result_file->get_title();30 }31 else32 {33 $result_object = $result_file->get_result_objects($result_object_index);34 if(isset($result_object[0]))35 {36 $this->graph_title = $result_object[0]->test_profile->get_title();37 $this->graph_sub_titles[] = $result_object[0]->get_arguments_description();38 }39 }40 /​/​ where to start the table values41 $this->longest_row_identifier = null;42 $longest_row_title_length = 0;43 foreach($this->rows as $result_test)44 {45 if(($len = strlen($result_test)) > $longest_row_title_length)46 {47 $this->longest_row_identifier = $result_test;48 $longest_row_title_length = $len;49 }50 }51 $this->column_heading_vertical = false;52 /​/​$this->longest_column_identifier = max(pts_strings::find_longest_string($this->columns), pts_strings::find_longest_string($result_file->get_system_identifiers()));53 }54 public static function result_file_to_result_table(&$result_file, &$system_id_keys = null, &$result_object_index = -1, &$flag_delta_results = false, $extra_attributes = null)55 {56 $result_table = array();57 $result_tests = array();58 $result_counter = 0;59 foreach($result_file->get_system_identifiers() as $sys_identifier)60 {61 $result_table[$sys_identifier] = null;62 }63 foreach($result_file->get_result_objects($result_object_index) as $ri => $result_object)64 {65 if($result_object->test_profile->get_identifier() == null)66 {67 continue;68 }69 if($extra_attributes != null)70 {71 if(isset($extra_attributes['reverse_result_buffer']))72 {73 $result_object->test_result_buffer->buffer_values_reverse();74 }75 if(isset($extra_attributes['normalize_result_buffer']))76 {77 if(isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1)78 {79 $normalize_against = $extra_attributes['highlight_graph_values'][0];80 }81 else82 {83 $normalize_against = false;84 }85 $result_object->normalize_buffer_values($normalize_against);86 }87 }88 if($result_object_index != -1)89 {90 if(is_array($result_object_index))91 {92 $result_tests[$result_counter] = new pts_graph_ir_value($result_object->get_arguments_description());93 }94 else95 {96 $result_tests[$result_counter] = new pts_graph_ir_value('Results');97 }98 }99 else100 {101 $result_tests[$result_counter] = new pts_graph_ir_value($result_object->test_profile->get_identifier_base_name() . ': ' . $result_object->get_arguments_description());102 $result_tests[$result_counter]->set_attribute('title', $result_object->get_arguments_description());103 if($result_object->test_profile->get_identifier() != null)104 {105 $result_tests[$result_counter]->set_attribute('href', 'http:/​/​openbenchmarking.org/​test/​' . $result_object->test_profile->get_identifier());106 }107 }108 if($result_object->test_profile->get_identifier() == null)109 {110 if($result_object->test_profile->get_display_format() == 'BAR_GRAPH')111 {112 $result_tests[$result_counter]->set_attribute('alert', true);113 foreach($result_object->test_result_buffer->get_buffer_items() as $index => $buffer_item)114 {115 $identifier = $buffer_item->get_result_identifier();116 $value = $buffer_item->get_result_value();117 $result_table[$identifier][$result_counter] = new pts_graph_ir_value($value, array('alert' => true));118 }119 $result_counter++;120 }121 continue;122 }123 switch($result_object->test_profile->get_display_format())124 {125 case 'BAR_GRAPH':126 $best_value = 0;127 $worst_value = 0;128 if(!defined('PHOROMATIC_TRACKER') && count($result_object->test_result_buffer->get_values()) > 1)129 {130 switch($result_object->test_profile->get_result_proportion())131 {132 case 'HIB':133 $best_value = max($result_object->test_result_buffer->get_values());134 $worst_value = min($result_object->test_result_buffer->get_values());135 break;136 case 'LIB':137 $best_value = min($result_object->test_result_buffer->get_values());138 $worst_value = max($result_object->test_result_buffer->get_values());139 break;140 }141 }142 $prev_value = 0;143 $prev_identifier = null;144 $prev_identifier_0 = null;145 $values_in_buffer = $result_object->test_result_buffer->get_values();146 sort($values_in_buffer);147 $min_value_in_buffer = $values_in_buffer[0];148 if($min_value_in_buffer == 0)149 {150 /​/​ Go through the values until something not 0, otherwise down in the code will be a divide by zero151 for($i = 1; $i < count($values_in_buffer) && $min_value_in_buffer == 0; $i++)152 {153 $min_value_in_buffer = $values_in_buffer[$i];154 }155 }156 $max_value_in_buffer = $values_in_buffer[(count($values_in_buffer) - 1)];157 foreach($result_object->test_result_buffer->get_buffer_items() as $index => $buffer_item)158 {159 $identifier = $buffer_item->get_result_identifier();160 $value = $buffer_item->get_result_value();161 $raw_values = pts_strings::colon_explode($buffer_item->get_result_raw());162 $percent_std = pts_math::set_precision(pts_math::percent_standard_deviation($raw_values), 2);163 $std_error = pts_math::set_precision(pts_math::standard_error($raw_values), 2);164 $delta = 0;165 if(defined('PHOROMATIC_TRACKER'))166 {167 $identifier_r = pts_strings::colon_explode($identifier);168 if($identifier_r[0] == $prev_identifier_0 && $prev_value != 0)169 {170 $delta = pts_math::set_precision(abs(1 - ($value /​ $prev_value)), 4);171 if($delta > 0.02 && $delta > pts_math::standard_deviation($raw_values))172 {173 switch($result_object->test_profile->get_result_proportion())174 {175 case 'HIB':176 if($value < $prev_value)177 {178 $delta = 0 - $delta;179 }180 break;181 case 'LIB':182 if($value > $prev_value)183 {184 $delta = 0 - $delta;185 }186 break;187 }188 }189 else190 {191 $delta = 0;192 }193 }194 $prev_identifier_0 = $identifier_r[0];195 $highlight = false;196 $alert = false;197 }198 else199 {200 if($result_file->is_multi_way_comparison())201 {202 /​/​ TODO: make it work better for highlighting multiple winners in multi-way comparisons203 $highlight = false;204 $alert = false;205 /​/​ TODO: get this working right206 if(false && $index % 2 == 1 && $prev_value != 0)207 {208 switch($result_object->test_profile->get_result_proportion())209 {210 case 'HIB':211 if($value > $prev_value)212 {213 $highlight = true;214 }215 else216 {217 $result_table[$prev_identifier][$result_counter]->set_attribute('highlight', true);218 $result_table[$prev_identifier][$result_counter]->set_attribute('delta', -1);219 }220 break;221 case 'LIB':222 if($value < $prev_value)223 {224 $highlight = true;225 }226 else227 {228 $result_table[$prev_identifier][$result_counter]->set_attribute('highlight', true);229 $result_table[$prev_identifier][$result_counter]->set_attribute('delta', -1);230 }231 break;232 }233 }234 }235 else236 {237 $alert = $worst_value == $value;238 $highlight = $best_value == $value;239 }240 if($min_value_in_buffer != $max_value_in_buffer)241 {242 switch($result_object->test_profile->get_result_proportion())243 {244 case 'HIB':245 $delta = pts_math::set_precision($value /​ $min_value_in_buffer, 2);246 break;247 case 'LIB':248 $delta = pts_math::set_precision(1 - ($value /​ $max_value_in_buffer) + 1, 2);249 break;250 }251 }252 }253 $attributes = array(254 'std_percent' => $percent_std,255 'std_error' => $std_error,256 'delta' => $delta,257 'highlight' => $highlight,258 'alert' => $alert259 );260 if($delta > $percent_std && $flag_delta_results !== false)261 {262 $flag_delta_results[$ri] = $delta;263 }264 $result_table[$identifier][$result_counter] = new pts_graph_ir_value($value, $attributes);265 $prev_identifier = $identifier;266 $prev_value = $value;267 }268 break;269 case 'LINE_GRAPH':270 case 'FILLED_LINE_GRAPH':271 $result_tests[$result_counter] = new pts_graph_ir_value($result_object->test_profile->get_title() . ' (Avg)');272 foreach($result_object->test_result_buffer->get_buffer_items() as $index => $buffer_item)273 {274 $identifier = $buffer_item->get_result_identifier();275 $values = pts_strings::comma_explode($buffer_item->get_result_value());276 $avg_value = pts_math::set_precision(array_sum($values) /​ count($values), 2);277 $result_table[$identifier][$result_counter] = new pts_graph_ir_value($avg_value);278 }279 break;280 }281 $result_counter++;282 }283 if($result_counter == 1)284 {285 /​/​ This should provide some additional information under normal modes286 $has_written_std = false;287 $has_written_diff = false;288 $has_written_error = false;289 foreach($result_table as $identifier => $info)290 {291 if(!isset($info[($result_counter - 1)]))292 {293 continue;294 }295 $std_percent = $info[($result_counter - 1)]->get_attribute('std_percent');296 $std_error = $info[($result_counter - 1)]->get_attribute('std_error');297 $delta = $info[($result_counter - 1)]->get_attribute('delta');298 if($delta != 0)299 {300 $result_table[$identifier][] = new pts_graph_ir_value($delta . 'x');301 $has_written_diff = true;302 }303 if($std_error != 0)304 {305 $result_table[$identifier][] = new pts_graph_ir_value($std_error);306 $has_written_error = true;307 }308 if($std_percent != 0)309 {310 $result_table[$identifier][] = new pts_graph_ir_value($std_percent . '%');311 $has_written_std = true;312 }313 }314 if($has_written_diff)315 {316 $result_tests[] = new pts_graph_ir_value('Difference');317 }318 if($has_written_error)319 {320 $result_tests[] = new pts_graph_ir_value('Standard Error');321 }322 if($has_written_std)323 {324 $result_tests[] = new pts_graph_ir_value('Standard Deviation');325 }326 }327 if(defined('PHOROMATIC_TRACKER'))328 {329 /​/​ Resort the results by SYSTEM, then date330 $systems_table = array();331 $sorted_table = array();332 foreach($result_table as $system_identifier => &$identifier_table)333 {334 $identifier = pts_strings::colon_explode($system_identifier);335 if(!isset($systems_table[$identifier[0]]))336 {337 $systems_table[$identifier[0]] = array();338 }339 $systems_table[$identifier[0]][$system_identifier] = $identifier_table;340 }341 $result_table = array();342 $result_systems = array();343 foreach($systems_table as &$group)344 {345 foreach($group as $identifier => $table)346 {347 $result_table[$identifier] = $table;348 $identifier = pts_strings::colon_explode($identifier);349 $show_id = isset($identifier[1]) ? $identifier[1] : $identifier[0];/​*350 if($system_id_keys != null && ($s = array_search($identifier[0], $system_id_keys)) !== false)351 {352 $system_id = $s;353 }354 else355 {356 $system_id = null;357 }*/​358 $result_systems[] = $show_id;359 }360 }361 }362 else363 {364 $result_systems = array();365 foreach(array_keys($result_table) as $id)366 {367 $result_systems[] = $id;368 }369 }370 return array($result_tests, $result_systems, $result_table);371 }372}373?>...

Full Screen

Full Screen

phoromatic_tracker

Using AI Code Generation

copy

Full Screen

1include_once("phoromatic_tracker.php");2$phoromatic_tracker = new phoromatic_tracker();3$result = $phoromatic_tracker->get_result();4echo $result;5file_put_contents('result.txt', $result);6include_once("phoromatic_tracker.php");7$phoromatic_tracker = new phoromatic_tracker();8$result = $phoromatic_tracker->get_result();9echo $result;10file_put_contents('result.txt', $result);11include_once("phoromatic_tracker.php");12$phoromatic_tracker = new phoromatic_tracker();13$result = $phoromatic_tracker->get_result();14echo $result;

Full Screen

Full Screen

phoromatic_tracker

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic_tracker.php');2$tracker = new phoromatic_tracker();3$test_results = $tracker->get_test_results('TEST_SUITE_NAME');4$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME');5$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION');6$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION','TEST_PROFILE_OPTION_VALUE');7$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE');8$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE');9$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE');10$test_results = $tracker->get_test_results('TEST_SUITE_NAME','TEST_PROFILE_NAME','TEST_PROFILE_OPTION','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE','TEST_PROFILE_OPTION_VALUE');

Full Screen

Full Screen

phoromatic_tracker

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic_tracker.php');2$tracker = new phoromatic_tracker('2.php');3$tracker->set_result_file('/​tmp/​2.php');4$tracker->set_test_name('2.php');5$tracker->set_test_version('1.0.0');6$tracker->set_result_scale('PASS');7$tracker->set_result_proportion('1');8$tracker->set_result_format('HARDCODED');9$tracker->set_result_buffer('PASS');10$tracker->set_result_success('PASS');11$tracker->set_result_failure('FAIL');12$tracker->set_result_message('Test Passed');13$tracker->set_result_identifier('2.php');14$tracker->set_result_append('0');15$tracker->set_result_comparison('HIGHER_IS_BETTER');16$tracker->set_result_trigger('ALWAYS');17$tracker->set_result_display('BAR_GRAPH');18$tracker->set_result_display('LINE_GRAPH');19$tracker->set_result_display('TABLE');20$tracker->set_result_display('TEXT');21$tracker->set_result_display('PASS_FAIL');22$tracker->set_result_display('PASS_FAIL_PER_LINE');23$tracker->set_result_display('PASS_FAIL_PER_LINE_PERCENTAGE');24$tracker->set_result_display('PASS_FAIL_PER_LINE_BAR_GRAPH');25$tracker->set_result_display('PASS_FAIL_PER_LINE_LINE_GRAPH');26$tracker->set_result_display('PASS_FAIL_PER_LINE_TABLE');27$tracker->set_result_display('PASS_FAIL_PER_LINE_TEXT');28$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL');29$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PERCENTAGE');30$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_BAR_GRAPH');31$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_LINE_GRAPH');32$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_TABLE');33$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_TEXT');34$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE');35$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE_PERCENTAGE');36$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE_BAR_GRAPH');37$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE_LINE_GRAPH');38$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE_TABLE');39$tracker->set_result_display('PASS_FAIL_PER_LINE_PASS_FAIL_PER_LINE_TEXT');

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Three Techniques for Improved Communication and Testing

Anyone who has worked in the software industry for a while can tell you stories about projects that were on the verge of failure. Many initiatives fail even before they reach clients, which is especially disheartening when the failure is fully avoidable.

Developers and Bugs &#8211; why are they happening again and again?

Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.

How To Handle Multiple Windows In Selenium Python

Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.

Fault-Based Testing and the Pesticide Paradox

In some sense, testing can be more difficult than coding, as validating the efficiency of the test cases (i.e., the ‘goodness’ of your tests) can be much harder than validating code correctness. In practice, the tests are just executed without any validation beyond the pass/fail verdict. On the contrary, the code is (hopefully) always validated by testing. By designing and executing the test cases the result is that some tests have passed, and some others have failed. Testers do not know much about how many bugs remain in the code, nor about their bug-revealing efficiency.

And the Winner Is: Aggregate Model-based Testing

In my last blog, I investigated both the stateless and the stateful class of model-based testing. Both have some advantages and disadvantages. You can use them for different types of systems, depending on whether a stateful solution is required or a stateless one is enough. However, a better solution is to use an aggregate technique that is appropriate for each system. Currently, the only aggregate solution is action-state testing, introduced in the book Paradigm Shift in Software Testing. This method is implemented in Harmony.

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.

Most used methods in phoromatic_tracker

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

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