本文整理汇总了PHP中pts_strings::format_time方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_strings::format_time方法的具体用法?PHP pts_strings::format_time怎么用?PHP pts_strings::format_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_strings
的用法示例。
在下文中一共展示了pts_strings::format_time方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __pre_run_process
public static function __pre_run_process(&$test_run_manager)
{
if ($test_run_manager->get_file_name() == null) {
return false;
}
self::$result_identifier = $test_run_manager->get_results_identifier();
self::post_to_pushover('Now running ' . self::$result_identifier . ' in ' . $test_run_manager->get_title() . '. Estimated time to completion: ' . pts_strings::format_time($test_run_manager->get_estimated_run_time(), 'SECONDS', true, 60) . '.');
}
示例2: run
public static function run($r)
{
$installed_tests = pts_tests::installed_tests();
pts_client::$display->generic_heading(count($installed_tests) . ' Tests Installed');
if (count($installed_tests) > 0) {
echo sprintf('%-18ls %-8ls %-13ls %-11ls %-13ls %-10ls', 'TEST', 'VERSION', 'INSTALL DATE', 'LAST RUN', 'AVG RUN-TIME', 'TIMES RUN') . PHP_EOL;
foreach ($installed_tests as $identifier) {
$test_profile = new pts_test_profile($identifier);
if ($test_profile && $test_profile->test_installation && $test_profile->test_installation->get_installed_version() != null) {
$avg_time = $test_profile->test_installation->get_average_run_time();
$avg_time = !empty($avg_time) ? pts_strings::format_time($avg_time, 'SECONDS', false) : 'N/A';
$last_run = $test_profile->test_installation->get_last_run_date();
$last_run = $last_run == '0000-00-00' ? 'NEVER' : $last_run;
echo sprintf('%-18ls - %-8ls %-13ls %-11ls %-13ls %-10ls', $identifier, $test_profile->test_installation->get_installed_version(), $test_profile->test_installation->get_install_date(), $last_run, $avg_time, $test_profile->test_installation->get_run_count()) . PHP_EOL;
}
}
}
}
示例3: render_page_process
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = '<h1>Phoromatic</h1>';
$main .= phoromatic_systems_needing_attention();
$main .= '<p>Phoromatic is the remote management and test orchestration component to the <a href="http://www.phoronix-test-suite.com/">Phoronix Test Suite</a>. Phoromatic allows you to take advantage of the Phoronix Test Suite\'s vast feature-set across multiple systems over the LAN/WAN, manage entire test farms of systems for benchmarking via a centralized interface, centrally collect test results, and carry out other enteprise-focused tasks.</p>';
$main_page_message = phoromatic_server::read_setting('main_page_message');
if (!PHOROMATIC_USER_IS_VIEWER) {
$main .= '<p>To get started with your new account, the basic steps to get started include:</p>
<ol>
<li>Connect/sync the Phoronix Test Suite client systems (the systems to be benchmarked) to this account. In the simplest form, you just need to run the following command on the test systems: <strong>phoronix-test-suite phoromatic.connect ' . phoromatic_web_socket_server_addr() . '</strong>. For more information view the instructions on the <a href="?systems">systems page</a>.</li>
<li>Configure your <a href="?settings">account settings</a>.</li>
<li><a href="?schedules">Create a test schedule</a>. A schedule is for running test(s) on selected system(s) on a routine, timed basis or whenever a custom trigger is passed to the Phoromatic server. A test schedule could be for running benchmarks on a daily basis, whenever a new Git commit is applied to a code-base, or other events occurred. You can also enrich the potential by adding pre/post-test hooks for ensuring the system is set to a proper state for benchmarking. Alternatively, you can <a href="?benchmark">create a benchmark ticket</a> for one-time testing on one or more systems.</li>
<li>View the automatically generated <a href="?results">test results</a>.</li>';
if (!empty($main_page_message)) {
$main .= '<li><strong>' . $main_page_message . '</strong></li>';
} else {
$main .= '<li><strong>If you are interested in Phoromatic and the Phoronix Test Suite for enterprise testing, please <a href="http://commercial.phoronix-test-suite.com/">contact us</a> for commercial support, custom test development, custom engineering services, and other professional services. It\'s not without corporate support and sponsorship that we can continue to develop this leading open-source Linux benchmarking software. If you run into any problems with our open-source software or would like to contribute patches, you can do so via our <a href="https://www.github.com/phoronix-test-suite/phoronix-test-suite">GitHub project</a>.</strong></li>
</ol>';
}
} else {
if (!empty($main_page_message)) {
$main .= '<p><strong>' . $main_page_message . '</strong></p>';
}
}
$main .= '<hr /><div id="phoromatic_fixed_main_table">';
$systems_needing_attention = phoromatic_server::systems_appearing_down($_SESSION['AccountID']);
$systems_idling = phoromatic_server::systems_idling($_SESSION['AccountID']);
$systems_shutdown = phoromatic_server::systems_shutdown($_SESSION['AccountID']);
$systems_running_tests = phoromatic_server::systems_running_tests($_SESSION['AccountID']);
$main .= '<div id="phoromatic_main_table_cell">
<h2>' . pts_strings::plural_handler(count($systems_running_tests), 'System') . ' Running Tests</h2>
<h2>' . pts_strings::plural_handler(count($systems_idling), 'System') . ' Idling</h2>
<h2>' . pts_strings::plural_handler(count($systems_shutdown), 'System') . ' Shutdown</h2>
<h2>' . pts_strings::plural_handler(count($systems_needing_attention), 'System') . ' Needing Attention</h2>';
$main .= '<hr /><h2>Systems Running Tests</h2>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 AND CurrentTask NOT LIKE \'%Idling%\' AND CurrentTask NOT LIKE \'%Shutdown%\' ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
while ($result && ($row = $result->fetchArray())) {
$main .= '<div class="phoromatic_overview_box">';
$main .= '<h1><a href="?systems/' . $row['SystemID'] . '">' . $row['Title'] . '</a></h1>';
$main .= $row['CurrentTask'] . '<br />';
if (!empty($row['CurrentProcessSchedule'])) {
$main .= '<a href="?schedules/' . $row['CurrentProcessSchedule'] . '">' . phoromatic_server::schedule_id_to_name($row['CurrentProcessSchedule']) . '</a><br />';
}
$time_remaining = phoromatic_compute_estimated_time_remaining($row['EstimatedTimeForTask'], $row['LastCommunication']);
if ($time_remaining) {
$main .= '<em>~ ' . pts_strings::plural_handler($time_remaining, 'Minute') . ' Remaining</em>';
}
$main .= '</div>';
}
$main .= '</div>';
$schedules_today = phoromatic_server::schedules_today($_SESSION['AccountID']);
$schedules_total = phoromatic_server::schedules_total($_SESSION['AccountID']);
$benchmark_tickets_today = phoromatic_server::benchmark_tickets_today($_SESSION['AccountID']);
$main .= '<div id="phoromatic_main_table_cell">
<h2>' . pts_strings::plural_handler(count($schedules_today), 'Schedule') . ' Active Today</h2>
<h2>' . pts_strings::plural_handler(count($schedules_total), 'Schedule') . ' In Total</h2>
<h2>' . pts_strings::plural_handler(count($benchmark_tickets_today), 'Active Benchmark Ticket') . '</h2>
<h2> </h2>';
$main .= '<hr /><h2>Today\'s Scheduled Tests</h2>';
foreach ($schedules_today as &$row) {
$systems_for_schedule = phoromatic_server::systems_associated_with_schedule($_SESSION['AccountID'], $row['ScheduleID']);
$extra_css = null;
if (empty($systems_for_schedule)) {
$extra_css = ' opacity: 0.4;';
}
list($h, $m) = explode('.', $row['RunAt']);
$main .= '<div style="' . $extra_css . '" class="phoromatic_overview_box">';
$main .= '<h1><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h1>';
if (!empty($systems_for_schedule)) {
if ($row['RunAt'] > date('H.i')) {
$run_in_future = true;
$main .= '<h3>Runs In ' . pts_strings::format_time($h * 60 + $m - (date('H') * 60 + date('i')), 'MINUTES') . '</h3>';
} else {
$run_in_future = false;
$main .= '<h3>Triggered ' . pts_strings::format_time(max(1, date('H') * 60 + date('i') - ($h * 60 + $m)), 'MINUTES') . ' Ago</h3>';
}
}
foreach ($systems_for_schedule as $system_id) {
$pprid = self::result_match($row['ScheduleID'], $system_id, date('Y-m-d'));
if ($pprid) {
$main .= '<a href="?result/' . $pprid . '">';
}
$main .= phoromatic_server::system_id_to_name($system_id);
if ($pprid) {
$main .= '</a>';
} else {
if (!$run_in_future) {
$sys_info = self::system_info($system_id);
$last_comm_diff = time() - strtotime($sys_info['LastCommunication']);
$main .= ' <sup><a href="?systems/' . $system_id . '">';
if ($last_comm_diff > 3600) {
$main .= '<strong>Last Communication: ' . pts_strings::format_time($last_comm_diff, 'SECONDS', true, 60) . ' Ago</strong>';
} else {
$main .= $sys_info['CurrentTask'];
}
$main .= '</a></sup>';
}
//.........这里部分代码省略.........
示例4: test_install_download_file
public function test_install_download_file($process, &$pts_test_file_download)
{
$expected_time = 0;
$progress_prefix = null;
switch ($process) {
case 'DOWNLOAD_FROM_CACHE':
$process_string = 'Downloading From Cache';
$progress_prefix = 'Downloading';
break;
case 'LINK_FROM_CACHE':
$process_string = 'Linking From Cache';
break;
case 'COPY_FROM_CACHE':
$process_string = 'Copying From Cache';
$progress_prefix = 'Copying';
break;
case 'FILE_FOUND':
$process_string = 'File Found';
break;
case 'DOWNLOAD':
$process_string = 'Downloading';
$progress_prefix = 'Downloading';
if (($avg_speed = pts_download_speed_manager::get_average_download_speed()) > 0 && ($this_size = $pts_test_file_download->get_filesize()) > 0) {
$expected_time = $this_size / $avg_speed;
}
break;
}
$expected_time = is_numeric($expected_time) && $expected_time > 0 ? pts_strings::format_time($expected_time, 'SECONDS', false, 60) : null;
// TODO: handle if file-name is too long for terminal width
$download_string = $this->tab . $this->tab . $process_string . ': ' . $pts_test_file_download->get_filename();
$download_size_string = $pts_test_file_download->get_filesize() > 0 ? ' [' . self::bytes_to_download_size($pts_test_file_download->get_filesize()) . 'MB]' : null;
$offset_length = pts_client::terminal_width() > 1 ? pts_client::terminal_width() : pts_test_file_download::$longest_file_name_length;
$offset_length = $offset_length - strlen($download_string) - strlen($download_size_string) - 2;
if ($offset_length < 2) {
$offset_length = 2;
}
$download_string .= str_repeat(' ', $offset_length - 2);
$download_string .= $download_size_string;
echo $download_string . PHP_EOL;
$this->progress_line_prefix = $expected_time != null ? 'Estimated Download Time: ' . $expected_time : $progress_prefix;
$this->progress_last_float = -1;
$this->progress_tab_count = 2;
$this->progress_string_length = strlen($download_string);
}
示例5: run
public static function run($args)
{
echo PHP_EOL;
if ($args[0] == 'pts/all') {
$args = pts_openbenchmarking::available_tests(false);
}
foreach ($args as $arg) {
$o = pts_types::identifier_to_object($arg);
if ($o instanceof pts_test_suite) {
pts_client::$display->generic_heading($o->get_title());
echo 'Run Identifier: ' . $o->get_identifier() . PHP_EOL;
echo 'Suite Version: ' . $o->get_version() . PHP_EOL;
echo 'Maintainer: ' . $o->get_maintainer() . PHP_EOL;
echo 'Suite Type: ' . $o->get_suite_type() . PHP_EOL;
echo 'Unique Tests: ' . $o->get_unique_test_count() . PHP_EOL;
echo 'Suite Description: ' . $o->get_description() . PHP_EOL;
echo PHP_EOL;
echo $o->pts_format_contained_tests_string();
echo PHP_EOL;
} else {
if ($o instanceof pts_test_profile) {
$test_title = $o->get_title();
$test_version = $o->get_app_version();
if (!empty($test_version)) {
$test_title .= ' ' . $test_version;
}
pts_client::$display->generic_heading($test_title);
echo 'Run Identifier: ' . $o->get_identifier() . PHP_EOL;
echo 'Profile Version: ' . $o->get_test_profile_version() . PHP_EOL;
echo 'Maintainer: ' . $o->get_maintainer() . PHP_EOL;
echo 'Test Type: ' . $o->get_test_hardware_type() . PHP_EOL;
echo 'Software Type: ' . $o->get_test_software_type() . PHP_EOL;
echo 'License Type: ' . $o->get_license() . PHP_EOL;
echo 'Test Status: ' . $o->get_status() . PHP_EOL;
echo 'Project Web-Site: ' . $o->get_project_url() . PHP_EOL;
if ($o->get_estimated_run_time() > 1) {
echo 'Estimated Run-Time: ' . $o->get_estimated_run_time() . ' Seconds' . PHP_EOL;
}
$download_size = $o->get_download_size();
if (!empty($download_size)) {
echo 'Download Size: ' . $download_size . ' MB' . PHP_EOL;
}
$environment_size = $o->get_environment_size();
if (!empty($environment_size)) {
echo 'Environment Size: ' . $environment_size . ' MB' . PHP_EOL;
}
echo PHP_EOL . 'Description: ' . $o->get_description() . PHP_EOL;
if ($o->test_installation != false) {
$last_run = $o->test_installation->get_last_run_date();
$last_run = $last_run == '0000-00-00' ? 'Never' : $last_run;
$avg_time = $o->test_installation->get_average_run_time();
$avg_time = !empty($avg_time) ? pts_strings::format_time($avg_time, 'SECONDS') : 'N/A';
$latest_time = $o->test_installation->get_latest_run_time();
$latest_time = !empty($latest_time) ? pts_strings::format_time($latest_time, 'SECONDS') : 'N/A';
echo PHP_EOL . 'Test Installed: Yes' . PHP_EOL;
echo 'Last Run: ' . $last_run . PHP_EOL;
if ($last_run != 'Never') {
if ($o->test_installation->get_run_count() > 1) {
echo 'Average Run-Time: ' . $avg_time . PHP_EOL;
}
echo 'Latest Run-Time: ' . $latest_time . PHP_EOL;
echo 'Times Run: ' . $o->test_installation->get_run_count() . PHP_EOL;
}
} else {
echo PHP_EOL . 'Test Installed: No' . PHP_EOL;
}
$dependencies = $o->get_external_dependencies();
if (!empty($dependencies) && !empty($dependencies[0])) {
echo PHP_EOL . 'Software Dependencies:' . PHP_EOL;
echo pts_user_io::display_text_list($o->get_dependency_names());
}
echo PHP_EOL;
} else {
if ($o instanceof pts_result_file) {
echo 'Title: ' . $o->get_title() . PHP_EOL . 'Identifier: ' . $o->get_identifier() . PHP_EOL;
echo PHP_EOL . 'Test Result Identifiers:' . PHP_EOL;
echo pts_user_io::display_text_list($o->get_system_identifiers());
$test_titles = array();
foreach ($o->get_result_objects() as $result_object) {
if ($result_object->test_profile->get_display_format() == 'BAR_GRAPH') {
array_push($test_titles, $result_object->test_profile->get_title());
}
}
if (count($test_titles) > 0) {
echo PHP_EOL . 'Contained Tests:' . PHP_EOL;
echo pts_user_io::display_text_list(array_unique($test_titles));
}
echo PHP_EOL;
} else {
if ($o instanceof pts_virtual_test_suite) {
pts_client::$display->generic_heading($o->get_title());
echo 'Virtual Suite Description: ' . $o->get_description() . PHP_EOL . PHP_EOL;
foreach ($o->get_contained_test_profiles() as $test_profile) {
echo '- ' . $test_profile . PHP_EOL;
}
echo PHP_EOL;
}
}
}
}
//.........这里部分代码省略.........
示例6: render_page_process
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = null;
if (!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['system_title']) && !empty($_POST['system_title']) && isset($_POST['system_description']) && isset($_POST['system_state'])) {
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Title = :title, Description = :description, State = :state, CurrentTask = \'Awaiting Task\', BlockPowerOffs = :block_power_offs WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$stmt->bindValue(':title', $_POST['system_title']);
$stmt->bindValue(':description', $_POST['system_description']);
$stmt->bindValue(':state', $_POST['system_state']);
$stmt->bindValue(':block_power_offs', $_POST['block_power_offs']);
$stmt->execute();
}
if (!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['maintenance_mode'])) {
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET MaintenanceMode = :maintenance_mode WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$stmt->bindValue(':maintenance_mode', $_POST['maintenance_mode']);
$stmt->execute();
}
if (!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['tick_thread_reboot'])) {
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET TickThreadEvent = :event WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$stmt->bindValue(':event', time() . ':reboot');
$stmt->execute();
}
if (!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['tick_thread_halt'])) {
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET TickThreadEvent = :event WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$stmt->bindValue(':event', time() . ':halt-testing');
$stmt->execute();
}
if (!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['system_var_names']) && isset($_POST['system_var_values'])) {
$vars = array();
foreach ($_POST['system_var_names'] as $i => $name) {
if (isset($_POST['system_var_values'][$i])) {
$name = pts_strings::keep_in_string(strtoupper($name), pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_UNDERSCORE);
$val = pts_strings::keep_in_string($_POST['system_var_values'][$i], pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE | pts_strings::CHAR_COMMA | pts_strings::CHAR_SLASH | pts_strings::CHAR_SPACE | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_PLUS | pts_strings::CHAR_EQUAL);
if ($name != null) {
$vars[$name] = $val;
}
}
}
$var_string = null;
foreach ($vars as $name => $val) {
$var_string .= $name . '=' . $val . ';';
}
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET SystemVariables = :system_variables WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$stmt->bindValue(':system_variables', $var_string);
$stmt->execute();
}
if (!empty($PATH[0])) {
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_systems WHERE AccountID = :account_id AND SystemID = :system_id ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $PATH[0]);
$result = $stmt->execute();
if (!empty($result)) {
$row = $result->fetchArray();
if (!PHOROMATIC_USER_IS_VIEWER && isset($PATH[1]) && $PATH[1] == 'edit') {
$main = '<h1>' . $row['Title'] . '</h1>';
$main .= '<form name="system_form" id="system_form" action="?systems/' . $PATH[0] . '" method="post" onsubmit="return phoromatic_system_edit(this);">
<p><div style="width: 200px; font-weight: bold; float: left;">System Title:</div> <input type="text" style="width: 400px;" name="system_title" value="' . $row['Title'] . '" /></p>
<p><div style="width: 200px; font-weight: bold; float: left;">System Description:</div> <textarea style="width: 400px;" name="system_description">' . $row['Description'] . '</textarea></p>
<p><div style="width: 200px; font-weight: bold; float: left;">System State:</div><select name="system_state" style="width: 200px;"><option value="-1">Disabled</option><option value="1" selected="selected">Enabled</option></select></p>
<p><div style="width: 200px; font-weight: bold; float: left;">Allow Phoromatic To Power Off System When Testing Complete:</div><select name="block_power_offs" style="width: 200px;"><option value="0">Permitted</option><option value="1">Block Power-Off Signaling For This System</option></select> <sup>Assuming the power-off setting is enabled from the account settings page.</sup></p>
<p><div style="width: 200px; font-weight: bold; float: left;"> </div> <input type="submit" value="Submit" /></p></form>';
} else {
$main = '<h1>' . $row['Title'] . '</h1><p><em>' . ($row['Description'] != null ? $row['Description'] : 'No system description.') . '</em></p>';
if (phoromatic_server::system_check_if_down($_SESSION['AccountID'], $row['SystemID'], $row['LastCommunication'], $row['CurrentTask'])) {
$main .= '<h3 style="text-align: center; color: red;">This system appears to be offline or inactive and there are pending tests scheduled to be run on this system that have yet to be completed. This system has not communicated with the Phoromatic Server in ' . pts_strings::format_time(time() - strtotime($row['LastCommunication']), 'SECONDS', true, 60) . '.</h3>';
}
if (!PHOROMATIC_USER_IS_VIEWER) {
$main .= '<p><a href="?systems/' . $PATH[0] . '/edit">Edit Task & Enable/Disable System</a></p>';
}
}
switch ($row['State']) {
case -1:
$state = 'Disabled';
break;
case 0:
$state = 'Connected; Awaiting Approval';
break;
case 1:
$state = 'Active';
break;
}
$main .= '<hr />';
$info_table = array('Status:' => $row['CurrentTask'], 'Last Communication:' => phoromatic_user_friendly_timedate($row['LastCommunication']), 'Estimated Time Left For Task: ' => phoromatic_compute_estimated_time_remaining_string($row['EstimatedTimeForTask'], $row['LastCommunication']), 'State:' => $state, 'Phoronix Test Suite Client:' => $row['ClientVersion'], 'Initial Creation:' => phoromatic_user_friendly_timedate($row['CreatedOn']), 'System ID:' => $row['SystemID'], 'Last IP:' => $row['LastIP'], 'MAC Address:' => $row['NetworkMAC'], 'Wake-On-LAN Information:' => empty($row['NetworkWakeOnLAN']) ? 'N/A' : $row['NetworkWakeOnLAN'], 'Power-Off Sequence Permitted: ' => $row['BlockPowerOffs'] == 1 ? 'Blocked' : 'Permitted');
$main .= '<h2>System State</h2>' . pts_webui::r2d_array_to_table($info_table, 'auto');
if (!PHOROMATIC_USER_IS_VIEWER) {
if ($row['MaintenanceMode'] == 1) {
$mm_str = 'Disable Maintenance Mode';
$mm_val = 0;
$mm_onclick = 'return true;';
} else {
//.........这里部分代码省略.........
示例7: render_page_process
public static function render_page_process($PATH)
{
$test_version = self::$test_profile->get_app_version();
$test_title = self::$test_profile->get_title() . ($test_version != null ? ' ' . $test_version : null);
echo '<h1>' . $test_title . '</h1>';
echo '<div id="test_main_area">';
echo '<p>' . self::$test_profile->get_description() . '</p>';
echo '<h4 style="margin-top: 60px;">Run This Test</h4>';
echo '<div id="pts_add_test_area">';
$test_settings = array();
$test_options = self::$test_profile->get_test_option_objects();
$identifiers = array();
for ($i = 0; $i < count($test_options); $i++) {
$o = $test_options[$i];
$option_count = $o->option_count();
$test_prefix = 'test_option_';
$option_name = $o->get_name();
if ($option_count == 0) {
$option_value = '<input type="text" id="' . $test_prefix . $o->get_identifier() . '" />';
} else {
$option_value = '<select id="' . $test_prefix . $o->get_identifier() . '">';
for ($j = 0; $j < $option_count; $j++) {
$option_value .= '<option value="' . $o->format_option_value_from_input($o->get_option_value($j)) . '">' . $o->get_option_name($j) . '</option>';
}
$option_value .= '</select>';
}
$identifiers[] = $o->get_identifier();
echo '<input id="' . $test_prefix . $o->get_identifier() . '_title" type="hidden" value="' . $option_name . '" />';
$test_settings[] = array($option_name, $option_value);
}
$test_settings[] = array('<input type="Submit" value="Add Test To Run Queue" onclick="test_add_to_queue(\'' . (isset($test_prefix) ? $test_prefix : "") . '\', \'' . implode(':', $identifiers) . '\', \'' . self::$test_profile->get_identifier() . '\', \'' . base64_encode(json_encode(self::$test_profile->to_json())) . '\'); return false;" />');
echo pts_webui::r2d_array_to_table($test_settings);
echo '</div>';
echo '</div>';
echo '<div id="test_side_area">';
$tabular_info = array(array('Test Profile', self::$test_profile->get_identifier()), array('Maintainer', self::$test_profile->get_maintainer()), array('Test Type', self::$test_profile->get_test_hardware_type()), array('Software Type', self::$test_profile->get_test_software_type()), array('License Type', self::$test_profile->get_license()), array('Test Status', self::$test_profile->get_status()));
$project_url = self::$test_profile->get_project_url();
$project_url = parse_url($project_url);
if ($project_url != null && isset($project_url['host'])) {
$tabular_info[] = array('Project Site', '<a href="' . self::$test_profile->get_project_url() . '" target="_blank">' . $project_url['host'] . '</a>');
}
echo '<h4>Test Profile Information</h4>';
echo pts_webui::r2d_array_to_table($tabular_info);
$tabular_info = array();
if (self::$test_profile->get_estimated_run_time() > 1) {
$tabular_info[] = array('Estimated Test Run-Time', pts_strings::plural_handler(ceil(self::$test_profile->get_estimated_run_time() / 60), 'Minute'));
}
$download_size = self::$test_profile->get_download_size();
if (!empty($download_size)) {
$tabular_info[] = array('Download Size', $download_size . ' MB');
}
$environment_size = self::$test_profile->get_environment_size();
if (!empty($environment_size)) {
$tabular_info[] = array('Environment Size', $environment_size . ' MB');
}
if (self::$test_profile->test_installation != false) {
$last_run = self::$test_profile->test_installation->get_last_run_date();
$last_run = $last_run == '0000-00-00' ? 'Never' : date('j F Y', strtotime($last_run));
$avg_time = self::$test_profile->test_installation->get_average_run_time();
$avg_time = !empty($avg_time) ? pts_strings::format_time($avg_time, 'SECONDS') : null;
$latest_time = self::$test_profile->test_installation->get_latest_run_time();
$latest_time = !empty($latest_time) ? pts_strings::format_time($latest_time, 'SECONDS') : 'N/A';
$tabular_info[] = array('Last Local Run', $last_run);
if ($last_run != 'Never') {
if (self::$test_profile->test_installation->get_run_count() > 1) {
$tabular_info[] = array('Average Local Run-Time', $avg_time);
}
if ($latest_time != null) {
$tabular_info[] = array('Latest Local Run-Time', $latest_time);
}
if (self::$test_profile->test_installation->get_run_count() > 0) {
$tabular_info[] = array('Times Run Locally', self::$test_profile->test_installation->get_run_count());
}
}
}
echo '<h4>Installation Data</h4>';
echo pts_webui::r2d_array_to_table($tabular_info);
$dependencies = self::$test_profile->get_dependency_names();
if (!empty($dependencies) && !empty($dependencies[0])) {
array_unshift($dependencies, 'Test Dependencies');
pts_webui::r1d_array_to_table($dependencies);
}
if (self::$test_profile->test_installation == false) {
$files = pts_test_install_request::read_download_object_list(self::$test_profile);
if (count($files) > 0) {
$download_files = array('Test Files');
foreach ($files as &$file) {
$download_files[] = $file->get_filename() . ' [' . max(0.1, round($file->get_filesize() / 1048576, 1)) . 'MB]';
}
pts_webui::r1d_array_to_table($download_files);
}
}
echo '</div>';
}
示例8: render_page_process
//.........这里部分代码省略.........
<h3>Test Run Identifier:</h3>
<p>The test run identifier is the per-system name for the system(s) being benchmarked. The following variables may be used: <strong>.SYSTEM</strong>, <strong>.GROUP</strong>. Any custom per-user system variables set via the individual system pages can also be used.</p>
<p><input type="text" name="benchmark_identifier" value="' . (!$is_new ? $e_schedule['Identifier'] : null) . '" /></p>
<h3>Test Suite To Run:</h3>
<p><a href="?build_suite">Build a suite</a> to add/select more tests to run or <a href="?local_suites">view local suites</a> for more information on a particular suite. A test suite is a set of test profiles to run in a pre-defined manner.</p>';
$main .= '<p><select name="suite_to_run">';
foreach ($local_suites as $xml_path) {
$id = basename(dirname($xml_path));
$test_suite = new pts_test_suite($xml_path);
$main .= '<option value="' . $id . '">' . $test_suite->get_title() . ' - ' . $id . '</option>';
}
$main .= '</select></p>';
$main .= '<h3>Description:</h3>
<p>The description is an optional way to add more details about the intent or objective of this test run.</p>
<p><textarea name="benchmark_description" id="benchmark_description" cols="50" rows="3">' . (!$is_new ? $e_schedule['Description'] : null) . '</textarea></p>
<hr /><h3>System Targets:</h3>
<p>Select the systems that should be benchmarked at their next earliest convenience.</p>
<p style="white-space: nowrap;">';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if (!$is_new) {
$e_schedule['RunTargetSystems'] = explode(',', $e_schedule['RunTargetSystems']);
$e_schedule['RunTargetGroups'] = explode(',', $e_schedule['RunTargetGroups']);
}
if ($row = $result->fetchArray()) {
$main .= '<h4>Systems: ';
do {
$main .= '<input type="checkbox" name="run_on_systems[]" value="' . $row['SystemID'] . '" ' . (!$is_new && in_array($row['SystemID'], $e_schedule['RunTargetSystems']) ? 'checked="checked" ' : null) . '/> ' . $row['Title'] . ' ';
} while ($row = $result->fetchArray());
$main .= '</h4>';
}
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if ($row = $result->fetchArray()) {
$main .= '<h4>Groups: ';
do {
$main .= '<input type="checkbox" name="run_on_groups[]" value="' . $row['GroupName'] . '" ' . (!$is_new && in_array($row['GroupName'], $e_schedule['RunTargetGroups']) ? 'checked="checked" ' : null) . '/> ' . $row['GroupName'] . ' ';
} while ($row = $result->fetchArray());
$main .= '</h4>';
}
$main .= '</p>
<hr /><h3>Environment Options</h3>
<h4>Stress Testing</h4>
<p>If you wish to test systems for stability/reliability rather than performance, use this option and specify the number of tests to run concurrently (two or more) and (optionally) for the total period of time to continue looping the benchmarks. These options are intended to just stress the system and will not record any benchmark results. From the command-line this testing mode can be used via the <em>phoronix-test-suite stress-run</em> sub-command.</p>
<p><strong>Concurrent Number Of Test Processes:</strong> <select name="PTS_CONCURRENT_TEST_RUNS"><option value="0">Disabled</option>';
for ($i = 2; $i <= 24; $i++) {
$main .= '<option value="' . $i . '">' . $i . '</option>';
}
$main .= '</select></p>
<p><strong>Force Loop Time:</strong> <select name="TOTAL_LOOP_TIME"><option value="0">Disabled</option>';
$s = true;
for ($i = 60; $i <= 60 * 24 * 90; $i += 60) {
if ($i > 10080) {
// 7 days
if ($i % 1440 != 0) {
continue;
}
} else {
if ($i > 480) {
$s = !$s;
if (!$s) {
continue;
}
}
}
$main .= '<option value="' . $i . '">' . pts_strings::format_time($i, 'MINUTES') . '</option>';
}
$main .= '</select></p>
<h4>System Monitoring</h4>
<p>The Phoronix Test Suite system monitor module allows for select hardware/software sensors to be logged in real-time while running the selected test suite. The supported sensors are then shown within the result file upon the test\'s completion.</p>';
foreach (phodevi::available_sensors() as $sensor) {
$main .= '<input type="checkbox" name="MONITOR" value="' . phodevi::sensor_identifier($sensor) . '" /> ' . phodevi::sensor_name($sensor) . ' ';
}
$main .= '<hr /><p align="left"><input name="submit" value="' . ($is_new ? 'Run' : 'Edit') . ' Benchmark" type="submit" onclick="return pts_rmm_validate_schedule();" /></p>
</form>';
}
}
}
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_benchmark_tickets WHERE AccountID = :account_id AND State >= 0 AND TicketIssueTime > :time_cutoff ORDER BY TicketIssueTime DESC LIMIT 30');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':time_cutoff', time() - 60 * 60 * 24 * 14);
$result = $stmt->execute();
$right = '<ul><li>Benchmark Tickets</li>';
if ($result) {
$row = $result->fetchArray();
if (!empty($row)) {
do {
$right .= '<li><a href="?benchmark/' . $row['TicketID'] . '">' . $row['Title'] . '</a></li>';
} while ($row = $result->fetchArray());
}
}
$right .= '<li><em><a href="?benchmark/all">View All Past Tickets</a></em></li>';
$right .= '</ul>';
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
echo phoromatic_webui_footer();
}
示例9: test_run_start
public function test_run_start(&$test_run_manager, &$test_result)
{
echo PHP_EOL . PHP_EOL . $test_result->test_profile->get_title() . ($test_result->test_profile->get_app_version() != null ? ' ' . $test_result->test_profile->get_app_version() : null) . ':' . PHP_EOL . $this->tab . $test_result->test_profile->get_identifier();
if (($test_description = $test_result->get_arguments_description()) != false) {
echo ' [' . pts_client::swap_variables($test_description, array('pts_client', 'environmental_variables')) . ']';
}
echo PHP_EOL;
echo $this->tab . 'Test ' . $test_run_manager->get_test_run_position() . ' of ' . $test_run_manager->get_test_run_count_reported() . PHP_EOL;
$this->trial_run_count_current = 0;
$this->expected_trial_run_count = $test_result->test_profile->get_times_to_run();
$remaining_length = $test_run_manager->get_estimated_run_time();
$estimated_length = $test_result->test_profile->get_estimated_run_time();
$display_table = array();
array_push($display_table, array($this->tab . 'Estimated Trial Run Count:', $this->expected_trial_run_count));
if ($estimated_length > 1 && $estimated_length != $remaining_length) {
array_push($display_table, array($this->tab . 'Estimated Test Run-Time:', pts_strings::format_time($estimated_length, 'SECONDS', true, 60)));
}
if ($remaining_length > 1) {
array_push($display_table, array($this->tab . 'Estimated Time To Completion:', pts_strings::format_time($remaining_length, 'SECONDS', true, 60)));
}
echo pts_user_io::display_text_table($display_table);
}