public static function run($r)
 {
     $result_file = new pts_result_file($r[0]);
     $result_title = $result_file->get_title();
     echo PHP_EOL . 'Current Result Title: ' . $result_title . PHP_EOL;
     $new_title = pts_user_io::prompt_user_input('Enter New Title');
     if (!empty($new_title)) {
         $result_file->set_title($new_title);
     }
     $result_description = $result_file->get_description();
     echo PHP_EOL . 'Current Result Description: ' . $result_description . PHP_EOL;
     $new_description = pts_user_io::prompt_user_input('Enter New Description');
     if (!empty($new_description)) {
         $result_file->set_description($new_description);
     }
     pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml());
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html');
 }
 public static function run($r)
 {
     $saved_results = pts_client::saved_test_results();
     pts_client::$display->generic_heading(count($saved_results) . ' Saved Results');
     if (count($saved_results) > 0) {
         foreach ($saved_results as $saved_results_identifier) {
             $result_file = new pts_result_file($saved_results_identifier);
             if (($title = $result_file->get_title()) != null) {
                 echo sprintf('Saved Name: %-18ls Title: %-18ls', $saved_results_identifier, $title) . PHP_EOL;
                 foreach ($result_file->get_system_identifiers() as $id) {
                     if (!empty($id)) {
                         echo "\t" . '- ' . $id . PHP_EOL;
                     }
                 }
                 echo PHP_EOL;
             }
         }
     }
 }
 public static function run($r)
 {
     $result_file = new pts_result_file($r[0]);
     $result_title = $result_file->get_title();
     echo PHP_EOL . 'Current Result Title: ' . $result_title . PHP_EOL;
     $new_title = pts_user_io::prompt_user_input('Enter New Title');
     if (!empty($new_title)) {
         $result_title = $new_title;
     }
     $result_description = $result_file->get_description();
     echo PHP_EOL . 'Current Result Description: ' . $result_description . PHP_EOL;
     $new_description = pts_user_io::prompt_user_input('Enter New Description');
     if (!empty($new_description)) {
         $result_description = $new_description;
     }
     $result_file_writer = new pts_result_file_writer();
     $result_file_writer->add_result_file_meta_data($result_file, null, $new_title, $new_description);
     $result_file_writer->add_system_information_from_result_file($result_file);
     $result_file_writer->add_results_from_result_file($result_file);
     pts_client::save_test_result($r[0] . '/composite.xml', $result_file_writer->get_xml());
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html');
 }
 public static function run($r)
 {
     $_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($r[0], $tdir);
     $result_file = new pts_result_file($r[0]);
     $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->WriteText($notes_r[$i]);
     }
     /*
     if(count($identifiers) > 1 && is_file($tdir . 'result-graphs/overview.jpg'))
     {
     	$pdf->AddPage();
     	$pdf->Ln(100);
     	$pdf->Image($tdir . 'result-graphs/overview.jpg', 15, 40, 180);
     }
     */
     $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++;
     }
     // To save:
     /*
     $pdf_file = 'SAVE_TO';
     
     if(substr($pdf_file, -4) != '.pdf')
     {
     	$pdf_file .= '.pdf';
     }
     */
     $pdf_file = pts_client::user_home_directory() . $r[0] . '.pdf';
     $pdf->Output($pdf_file);
     pts_file_io::delete($tdir, null, true);
     echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL;
 }
    public static function render_page_process($PATH)
    {
        echo '<div style="background: #CCC; padding: 10px; margin: 10px 20px;">Thanks for trying out the Phoronix Test Suite GUI. With Phoronix Test Suite 5.0 the GUI is still considered in an <strong>experimental / tech preview state</strong>. The GUI should be more end-user friendly and reach feature parity with the command-line interface in forthcoming releases. Your feedback is appreciated on the GUI while the command-line interface continues to be our primary focus along with remotely-managed enterprise features like <a href="http://www.phoromatic.com/">Phoromatic</a> and <a href="http://openbenchmarking.org/">OpenBenchmarking.org</a>. <a href="/early">Read more details on the GUI</a>.</div>';
        echo '<h1>' . pts_core::program_title(false) . '</h1>';
        echo '<div id="pts_side_pane">';
        $hw_component_modal = array('CPU' => phodevi::read_property('cpu', 'model'), 'Motherboard' => phodevi::read_property('motherboard', 'identifier'), 'Memory' => phodevi::read_property('memory', 'identifier'), 'Disk' => phodevi::read_property('disk', 'identifier'), 'GPU' => phodevi::read_property('gpu', 'model'));
        echo '<ul>';
        foreach ($hw_component_modal as $type => $component) {
            echo '<a href="/?component/' . $type . '"><li>' . $component . '</li></a>';
        }
        echo '</ul>';
        echo '<hr />';
        $sw_component_modal = array(1 => phodevi::read_property('system', 'operating-system'), 2 => phodevi::read_property('system', 'kernel-string'), 3 => phodevi::read_property('system', 'display-driver-string'), 4 => phodevi::read_property('system', 'opengl-driver'), 5 => phodevi::read_property('system', 'compiler'));
        echo '<ul>';
        foreach ($sw_component_modal as $type => $component) {
            echo '<a href="/?component/Software"><li>' . $component . '</li></a>';
        }
        echo '</ul>';
        echo '<div class="pts_pane_window"><strong>OpenBenchmarking.org</strong><br />Log-in to gain access to additional features.</div>';
        echo '<ul>';
        echo '<a href="/?settings"><li>Software Settings</li></a>';
        echo '<a href="/?about"><li>About The Phoronix Test Suite</li></a>';
        echo '</ul>';
        echo '</div>';
        echo '<div id="pts_search_bar">';
        echo 'SEARCH: <input type="text" size="30" id="pts_search" name="search" onkeydown="if(event.keyCode == 13) { if(document.getElementById(\'pts_search\').value.length < 3) { alert(\'Please enter a longer search query.\'); return false; } else { window.location.href = \'/?search/\' + document.getElementById(\'pts_search\').value; } return false; }" />';
        echo '</div>';
        // Graphs
        echo '<div id="svg_graphs" style="margin: 10px 0; text-align: right;"></div>';
        echo '<div style="overflow: hidden;">';
        echo '<div class="pts_list_box">';
        $results = pts_tests::test_results_by_date();
        $result_count = count($results);
        $results = array_slice($results, 0, 10, true);
        echo '<ol>';
        echo '<li><u>Recent Benchmark Results</u></li>';
        foreach ($results as $result) {
            $result_file = new pts_result_file($result);
            echo '<a href="?result/' . $result . '"><li>' . $result_file->get_title() . '</li></a>';
        }
        echo '<a href="?results"><li><strong>' . $result_count . ' Results Saved</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '<div class="pts_list_box">';
        $tests = pts_openbenchmarking_client::recently_updated_tests(10);
        echo '<ol>';
        echo '<li><u>Recently Updated Tests</u></li>';
        foreach ($tests as $test) {
            $test_profile = new pts_test_profile($test);
            echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
        }
        echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '<div class="pts_list_box">';
        $tests = pts_openbenchmarking_client::popular_tests(10);
        echo '<ol>';
        echo '<li><u>Most Popular Tests</u></li>';
        foreach ($tests as $test) {
            $test_profile = new pts_test_profile($test);
            echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
        }
        echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '</div>';
        echo '<script text="text/javascript">

			pts_web_socket.add_onopen_event("user-svg-system-graphs");
			setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-svg-system-graphs"); }},1000);
			pts_web_socket.add_onmessage_event("svg_graphs", "update_svg_graph_space");
		</script>';
    }
 public static function search_test_results($query, $search = 'RESULTS')
 {
     $matches = array();
     foreach (self::test_results_by_date() as $file) {
         $result_file = new pts_result_file($file);
         if (($search == 'ALL' || $search == 'INFO') && (stripos($result_file->get_title(), $query) !== false || stripos($result_file->get_description(), $query) !== false)) {
             array_push($matches, $file);
             continue;
         }
         if ($search == 'ALL' || $search == 'SYSTEM_INFO') {
             $matched = false;
             foreach ($result_file->get_systems() as $s) {
                 if (stripos($s->get_software(), $query) !== false || stripos($s->get_identifier(), $query) !== false || stripos($s->get_hardware(), $query) !== false) {
                     array_push($matches, $file);
                     $matched = true;
                     break;
                 }
             }
             if ($matched) {
                 continue;
             }
         }
         if ($search == 'ALL' || $search == 'RESULTS') {
             $matched = false;
             $result_titles = array();
             foreach ($result_file->get_result_objects() as $result_object) {
                 $result_identifier = $result_object->test_profile->get_title();
                 if (stripos($result_identifier, $query) !== false) {
                     array_push($matches, $file);
                     $matched = true;
                     break;
                 }
             }
             if ($matched) {
                 continue;
             }
         }
     }
     return $matches;
 }
    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();
    }
    }
}
if ($composite_xml == null || sha1($composite_xml) != $COMPOSITE_XML_HASH) {
    $json['phoromatic']['error'] = 'XML Hash Mismatch';
    echo json_encode($json);
    return false;
}
// VALIDATE
$result_file = new pts_result_file($composite_xml);
// Validate the XML
if ($result_file->validate() == false) {
    $json['phoromatic']['error'] = 'XML Did Not Match Schema Definition';
    echo json_encode($json);
    return false;
}
if ($result_file->get_title() == null || $result_file->get_system_count() == 0 || $result_file->get_test_count() == 0) {
    $json['phoromatic']['error'] = 'Invalid Result File';
    echo json_encode($json);
    return false;
}
/*$Featured_Results = -1;
$Featured = pts_result_file_analyzer::analyze_result_file_intent($result_file, $Featured_Results);

if(!is_array($Featured))
{
	$Featured = array(null, null);
}*/
// DETERMINE UNIQUE UPLOAD ID
// IP = INET_ATON($_SERVER["REMOTE_ADDR"]);
$stmt = phoromatic_server::$db->prepare('SELECT UploadID FROM phoromatic_results WHERE AccountID = :account_id ORDER BY UploadID DESC LIMIT 1');
$stmt->bindValue(':account_id', ACCOUNT_ID);
 public static function search_test_results($query, $search = 'RESULTS')
 {
     $matches = array();
     foreach (self::test_results_by_date() as $file) {
         $result_file = new pts_result_file($file);
         if (($search == 'ALL' || $search == 'INFO') && (stripos($result_file->get_title(), $query) !== false || stripos($result_file->get_description(), $query) !== false)) {
             array_push($matches, $file);
             continue;
         }
         if ($search == 'ALL' || $search == 'SYSTEM_INFO') {
             $hw = $result_file->get_system_hardware();
             $sw = $result_file->get_system_software();
             $ids = $result_file->get_system_identifiers();
             $matched = false;
             for ($i = 0; $i < count($ids); $i++) {
                 if (stripos($sw[$i], $query) !== false || stripos($ids[$i], $query) !== false || stripos($hw[$i], $query) !== false) {
                     array_push($matches, $file);
                     $matched = true;
                     break;
                 }
             }
             if ($matched) {
                 continue;
             }
         }
         if ($search == 'ALL' || $search == 'RESULTS') {
             $matched = false;
             foreach ($result_file->get_result_identifiers() as $result_identifier) {
                 if (stripos($result_identifier, $query) !== false) {
                     array_push($matches, $file);
                     $matched = true;
                     break;
                 }
             }
             if ($matched) {
                 continue;
             }
         }
     }
     return $matches;
 }
Example #10
0
 }
 $attributes = array('new_result_file_title' => $result_file_title);
 $result_file = new pts_result_file(null, true);
 $result_file->merge($result_files, $attributes);
 $extra_attributes = array();
 $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');
 foreach ($attribute_options as $web_var => $attr_var) {
     if (isset($_REQUEST[$web_var])) {
         $extra_attributes[$attr_var] = true;
     }
 }
 if (isset($_POST['transpose_comparison'])) {
     $result_file->invert_multi_way_invert();
 }
 $intent = null;
 $main .= '<h1>' . $result_file->get_title() . '</h1>';
 $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;">';