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 static function result_file_to_csv(&$result_file)
 {
     $csv_output = null;
     $delimiter = ',';
     $csv_output .= $result_file->get_title() . PHP_EOL . PHP_EOL;
     $columns = array();
     $hw = array();
     $sw = array();
     foreach ($result_file->get_systems() as $system) {
         array_push($columns, $system->get_identifier());
         array_push($hw, $system->get_hardware());
         array_push($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);
     $csv_output .= ' ';
     foreach ($columns as $column) {
         $csv_output .= $delimiter . '"' . $column . '"';
     }
     $csv_output .= PHP_EOL;
     foreach ($rows as $i => $row) {
         $csv_output .= $row;
         foreach ($columns as $column) {
             $csv_output .= $delimiter . $table_data[$column][$i];
         }
         $csv_output .= PHP_EOL;
     }
     $csv_output .= PHP_EOL;
     $csv_output .= ' ';
     foreach ($columns as $column) {
         $csv_output .= $delimiter . '"' . $column . '"';
     }
     $csv_output .= PHP_EOL;
     foreach ($result_file->get_result_objects() as $result_object) {
         $csv_output .= '"' . $result_object->test_profile->get_title() . ' - ' . $result_object->get_arguments_description() . '"';
         foreach ($columns as $column) {
             $buffer_item = $result_object->test_result_buffer->find_buffer_item($column);
             $value = $buffer_item != false ? $buffer_item->get_result_value() : null;
             $csv_output .= $delimiter . $value;
         }
         $csv_output .= PHP_EOL;
     }
     $csv_output .= PHP_EOL;
     return $csv_output;
 }
 public static function result_file_to_csv(&$result_file)
 {
     $csv_output = null;
     $delimiter = ',';
     $csv_output .= $result_file->get_title() . PHP_EOL . PHP_EOL;
     $columns = $result_file->get_system_identifiers();
     $rows = array();
     $table_data = array();
     pts_result_file_analyzer::system_components_to_table($table_data, $columns, $rows, $result_file->get_system_hardware());
     pts_result_file_analyzer::system_components_to_table($table_data, $columns, $rows, $result_file->get_system_software());
     $csv_output .= ' ';
     foreach ($columns as $column) {
         $csv_output .= $delimiter . '"' . $column . '"';
     }
     $csv_output .= PHP_EOL;
     foreach ($rows as $i => $row) {
         $csv_output .= $row;
         foreach ($columns as $column) {
             $csv_output .= $delimiter . $table_data[$column][$i];
         }
         $csv_output .= PHP_EOL;
     }
     $csv_output .= PHP_EOL;
     $csv_output .= ' ';
     foreach ($columns as $column) {
         $csv_output .= $delimiter . '"' . $column . '"';
     }
     $csv_output .= PHP_EOL;
     foreach ($result_file->get_result_objects() as $result_object) {
         $csv_output .= '"' . $result_object->test_profile->get_title() . ' - ' . $result_object->get_arguments_description() . '"';
         foreach ($result_object->test_result_buffer->get_values() as $value) {
             $csv_output .= $delimiter . $value;
         }
         $csv_output .= PHP_EOL;
     }
     $csv_output .= PHP_EOL;
     return $csv_output;
 }
 public static function analyze_result_file_intent(&$result_file, &$flagged_results = -1, $return_all_changed_indexes = false)
 {
     $identifiers = array();
     $hw = array();
     $sw = array();
     foreach ($result_file->get_systems() as $system) {
         array_push($identifiers, $system->get_identifier());
         array_push($hw, $system->get_hardware());
         array_push($sw, $system->get_software());
     }
     if (count($identifiers) < 2) {
         // Not enough tests to be valid for anything
         return false;
     }
     foreach ($identifiers as $identifier) {
         if (pts_strings::string_only_contains($identifier, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_SPACE)) {
             // All the identifiers are just dates or other junk
             return false;
         }
     }
     $hw_unique = array_unique($hw);
     $sw_unique = array_unique($sw);
     $desc = false;
     if (count($hw_unique) == 1 && count($sw_unique) == 1) {
         // The hardware and software is maintained throughout the testing, so if there's a change in results its something we aren't monitoring
         // TODO XXX: Not sure this below check is needed anymore...
         if (true || count($hw) > 2 && $result_file->get_test_count() != count($hw)) {
             $desc = array('Unknown', implode(', ', $identifiers));
         }
     } else {
         if (count($sw_unique) == 1) {
             // The software is being maintained, but the hardware is being flipped out
             $rows = array();
             $data = array();
             pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $hw);
             pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);
             $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(array('Processor', 'Motherboard', 'Chipset', 'Audio', 'Network'), array('Processor', 'Motherboard', 'Chipset', 'Network'), array('Processor', 'Chipset', 'Graphics'), array('Processor', 'Graphics'), array('Processor', 'Chipset'), array('Motherboard', 'Chipset'), array('Motherboard', 'Chipset', 'Audio', 'Network'), array('Graphics', 'Audio')), $return_all_changed_indexes);
         } else {
             if (count($hw_unique) == 1) {
                 // The hardware is being maintained, but the software is being flipped out
                 $rows = array();
                 $data = array();
                 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $sw);
                 pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);
                 $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(array('Display Driver', 'OpenGL'), array('OpenGL'), array('Display Driver')), $return_all_changed_indexes);
             } else {
                 // Both software and hardware are being flipped out
                 $rows = array();
                 $data = array();
                 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $hw);
                 pts_result_file_analyzer::system_components_to_table($data, $identifiers, $rows, $sw);
                 pts_result_file_analyzer::compact_result_table_data($data, $identifiers, true);
                 $desc = pts_result_file_analyzer::analyze_system_component_changes($data, $rows, array(array('Memory', 'Graphics', 'Display Driver', 'OpenGL'), array('Graphics', 'Monitor', 'Kernel', 'Display Driver', 'OpenGL'), array('Graphics', 'Monitor', 'Display Driver', 'OpenGL'), array('Graphics', 'Kernel', 'Display Driver', 'OpenGL'), array('Graphics', 'Display Driver', 'OpenGL'), array('Graphics', 'OpenGL'), array('Graphics', 'Kernel'), array('Graphics', 'Display Driver')), $return_all_changed_indexes);
             }
         }
     }
     if ($desc) {
         if ($flagged_results === -1) {
             return $desc;
         } else {
             $mark_results = self::locate_interesting_results($result_file, $flagged_results);
             return array($desc[0], $desc[1], $mark_results);
         }
     }
     return false;
 }