コード例 #1
0
    public static function render_page_process($PATH)
    {
        $results = pts_tests::test_results_by_date();
        $sections = array(mktime(date('H'), date('i') - 10, 0, date('n'), date('j')) => 'Just Now', mktime(0, 0, 0, date('n'), date('j')) => 'Today', mktime(0, 0, 0, date('n'), date('j') - date('N') + 1) => 'This Week', mktime(0, 0, 0, date('n'), 1) => 'This Month', mktime(0, 0, 0, date('n') - 1, 1) => 'Last Month', mktime(0, 0, 0, 1, 1) => 'This Year', mktime(0, 0, 0, 1, 1, date('Y') - 1) => 'Last Year');
        echo '<div id="results_linear_display" style="overflow: hidden;"></div>';
        echo '<script text="text/javascript">
			pts_web_socket.add_onopen_event("results_grouped_by_date");
			pts_web_socket.add_onmessage_event("results_grouped_by_date", "display_grouped_results_by_date");

		</script>';
    }
コード例 #2
0
    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>';
    }
コード例 #3
0
 protected function process_data(&$user, &$msg)
 {
     $decoded_msg = $this->decode_data($user, $msg);
     //echo 'DECODED MSG: ' . $decoded_msg . PHP_EOL;
     foreach (explode(' ;; ', $decoded_msg) as $single_msg) {
         //echo strstr($single_msg . ' ', ' ', true) . PHP_EOL;
         $args = trim(strstr($single_msg, ' '));
         switch (strstr($single_msg . ' ', ' ', true)) {
             case 'search':
                 $this->search_pts($user, $args);
             case 'result_file':
                 foreach (explode(',', $args) as $result) {
                     if ($result == null) {
                         continue;
                     }
                     $result_file = new pts_result_file($result);
                     $json['pts']['msg']['name'] = 'result_file';
                     $json['pts']['msg']['result'] = $result;
                     $json['pts']['msg']['result_file'] = base64_encode($result_file->to_json());
                     $this->send_json_data($user->socket, $json);
                 }
                 break;
             case 'results_by_date':
                 $results = pts_tests::test_results_by_date();
                 $json['pts']['msg']['name'] = 'results_by_date';
                 $json['pts']['msg']['result_count'] = count($results);
                 $json['pts']['msg']['results'] = base64_encode(json_encode($results));
                 $this->send_json_data($user->socket, $json);
                 break;
             case 'results_grouped_by_date':
                 $results = pts_tests::test_results_by_date();
                 $json['pts']['msg']['name'] = 'results_grouped_by_date';
                 $json['pts']['msg']['result_count'] = count($results);
                 $sections = array(mktime(date('H'), date('i') - 10, 0, date('n'), date('j')) => 'Just Now', mktime(0, 0, 0, date('n'), date('j')) => 'Today', mktime(0, 0, 0, date('n'), date('j') - date('N') + 1) => 'This Week', mktime(0, 0, 0, date('n'), 1) => 'This Month', mktime(0, 0, 0, date('n') - 1, 1) => 'Last Month', mktime(0, 0, 0, 1, 1) => 'This Year', mktime(0, 0, 0, 1, 1, date('Y') - 1) => 'Last Year');
                 $section = current($sections);
                 foreach ($results as $result_time => &$result) {
                     if ($result_time < key($sections)) {
                         while ($result_time < key($sections) && $section !== false) {
                             $section = next($sections);
                         }
                         if ($section === false) {
                             break;
                         }
                     }
                     if (!isset($json['pts']['msg']['results'][current($sections)])) {
                         $json['pts']['msg']['results'][current($sections)] = array();
                     }
                     if ($result != null) {
                         $json['pts']['msg']['results'][current($sections)][] = $result;
                     }
                 }
                 $this->send_json_data($user->socket, $json);
                 break;
             case 'user-svg-system-graphs':
                 //	pts_client::timed_function(array($this, 'generate_system_svg_graphs'), array($user), 1, array($this, 'sensor_logging_continue'), array($user));
                 $this->generate_system_svg_graphs($user, $args);
                 break;
             case 'user-large-svg-system-graphs':
                 //	pts_client::timed_function(array($this, 'generate_system_svg_graphs'), array($user), 1, array($this, 'sensor_logging_continue'), array($user));
                 $this->generate_large_system_svg_graphs($user, $args);
                 break;
             case 'tests-by-popularity':
                 $args = explode(' ', $args);
                 $limit = isset($args[0]) && is_numeric($args[0]) ? $args[0] : 10;
                 $test_type = isset($args[1]) && $args[1] != null ? $args[1] : null;
                 $tests = pts_openbenchmarking_client::popular_tests($limit, $test_type);
                 $json['pts']['msg']['name'] = 'tests_by_popularity';
                 $json['pts']['msg']['test_count'] = count($tests);
                 $json['pts']['msg']['test_type'] = $test_type;
                 $json['pts']['msg']['tests'] = array();
                 $json['pts']['msg']['test_profiles'] = array();
                 foreach ($tests as $test) {
                     $json['pts']['msg']['tests'][] = $test;
                     $tp = new pts_test_profile($test);
                     $json['pts']['msg']['test_profiles'][] = base64_encode($tp->to_json());
                 }
                 $this->send_json_data($user->socket, $json);
                 break;
             case 'available-system-logs':
                 if ($this->phodevi_vfs instanceof phodevi_vfs) {
                     $json['pts']['msg']['name'] = 'available_system_logs';
                     $json['pts']['msg']['logs'] = $this->phodevi_vfs->list_cache_nodes($args);
                     $this->send_json_data($user->socket, $json);
                 }
                 break;
             case 'fetch-system-log':
                 if ($this->phodevi_vfs instanceof phodevi_vfs && $args != null && $this->phodevi_vfs->cache_isset_names($args)) {
                     $json['pts']['msg']['name'] = 'fetch_system_log';
                     $json['pts']['msg']['log_name'] = $args;
                     $json['pts']['msg']['log'] = base64_encode($this->phodevi_vfs->__get($args));
                     $this->send_json_data($user->socket, $json);
                 }
                 break;
             case 'pts-version':
                 $json['pts']['msg']['name'] = 'pts_version';
                 $json['pts']['msg']['version'] = pts_core::program_title(true);
                 $this->send_json_data($user->socket, $json);
                 break;
             case 'core-version':
                 $version = PTS_CORE_VERSION;
                 $this->send_data($user->socket, $version);
                 break;
             case 'run-benchmark-queue':
                 // BENCHMARK
                 //$this->run_benchmark($user, $args);
                 pts_client::fork(array($this, 'run_benchmark'), array($user, $args));
                 break;
         }
     }
 }
コード例 #4
0
 public static function recently_saved_results()
 {
     $recent_results = pts_tests::test_results_by_date();
     if (count($recent_results) > 0) {
         $recent_results = array_slice($recent_results, 0, 5, true);
         $res_length = strlen(pts_strings::find_longest_string($recent_results)) + 2;
         $current_time = time();
         foreach ($recent_results as $m_time => &$recent_result) {
             $days = floor(($current_time - $m_time) / 86400);
             $recent_result = sprintf('%-' . $res_length . 'ls [%-ls]', $recent_result, $days == 0 ? 'Today' : pts_strings::days_ago_format_string($days) . ' old');
         }
         echo PHP_EOL . 'Recently Saved Test Results:' . PHP_EOL;
         echo pts_user_io::display_text_list($recent_results) . PHP_EOL;
         return true;
     }
     return false;
 }