public static function run($r) { $commands = array('detailed_system_info' => null, 'list_available_tests' => null, 'list_available_suites' => null, 'info' => array('xonotic'), 'clone_openbenchmarking_result' => array('1107247-LI-MESACOMMI48'), 'result_file_to_text' => array('1107247-LI-MESACOMMI48'), 'diagnostics' => null, 'dump_possible_options' => null); $individual_times = array(); phodevi::clear_cache(); $start = microtime(true); foreach ($commands as $command => $args) { echo PHP_EOL . '### ' . $command . ' ###' . PHP_EOL; $individual_times[$command] = array(); for ($i = 0; $i < 3; $i++) { $c_start = microtime(true); pts_client::execute_command($command, $args); $c_finish = microtime(true); array_push($individual_times[$command], $c_finish - $c_start); } } $finish = microtime(true); echo PHP_EOL . PHP_EOL . '### OVERALL DATA ###' . PHP_EOL . PHP_EOL; echo 'PHP: ' . PTS_PHP_VERSION . PHP_EOL; $longest_c = max(array_map('strlen', array_keys($individual_times))); foreach ($individual_times as $component => $times) { echo strtoupper($component) . ': ' . str_repeat(' ', $longest_c - strlen($component)) . pts_math::set_precision(round(array_sum($times) / count($times), 3), 3) . ' seconds' . PHP_EOL; } echo PHP_EOL . 'ELAPSED TIME: ' . str_repeat(' ', $longest_c - strlen('ELAPSED TIME')) . round($finish - $start, 3) . ' seconds'; echo PHP_EOL . 'PEAK MEMORY USAGE: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE')) . round(memory_get_peak_usage(true) / 1048576, 3) . ' MB'; echo PHP_EOL . 'PEAK MEMORY USAGE (emalloc): ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE (emalloc)')) . round(memory_get_peak_usage() / 1048576, 3) . ' MB'; echo PHP_EOL; }
public static function run($r) { define('PHOROMATIC_PROCESS', true); $commands = array('detailed_system_info' => null, 'list_available_tests' => null, 'list_available_suites' => null, 'info' => array('pts/all'), 'clone_openbenchmarking_result' => array('1107247-LI-MESACOMMI48', '1509040-HA-GCCINTELS17', '1508201-HA-GTX95073337', '1508233-HA-INTELSKYL16'), 'refresh_graphs' => array('1107247-LI-MESACOMMI48'), 'result_file_to_text' => array('1107247-LI-MESACOMMI48'), 'merge_results' => array('1107247-LI-MESACOMMI48', '1509040-HA-GCCINTELS17', '1508201-HA-GTX95073337', '1508233-HA-INTELSKYL16'), 'diagnostics' => null, 'dump_possible_options' => null, 'debug_render_test' => null); $individual_times = array(); phodevi::clear_cache(); $start = microtime(true); foreach ($commands as $command => $args) { echo PHP_EOL . '### ' . $command . ' ###' . PHP_EOL; $individual_times[$command] = array(); for ($i = 0; $i < 3; $i++) { $c_start = microtime(true); pts_client::execute_command($command, $args); $c_finish = microtime(true); $individual_times[$command][] = $c_finish - $c_start; } } $finish = microtime(true); echo PHP_EOL . PHP_EOL . '### OVERALL DATA ###' . PHP_EOL . PHP_EOL; echo 'PHP: ' . PTS_PHP_VERSION . PHP_EOL; $longest_c = max(array_map('strlen', array_keys($individual_times))); foreach ($individual_times as $component => $times) { echo strtoupper($component) . ': ' . str_repeat(' ', $longest_c - strlen($component)) . pts_math::set_precision(round(array_sum($times) / count($times), 3), 3) . ' seconds' . PHP_EOL; } echo PHP_EOL . 'TOTAL ELAPSED TIME: ' . str_repeat(' ', $longest_c - strlen('ELAPSED TIME')) . round($finish - $start, 3) . ' seconds'; echo PHP_EOL . 'PEAK MEMORY USAGE: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE')) . round(memory_get_peak_usage(true) / 1048576, 3) . ' MB'; echo PHP_EOL . 'PEAK MEMORY USAGE EMALLOC: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE (emalloc)')) . round(memory_get_peak_usage() / 1048576, 3) . ' MB'; echo PHP_EOL; }
if ($replaced == false) { // Show help command, since there are no valid commands $sent_command = 'help'; } } pts_define('PTS_USER_LOCK', function_exists('posix_getpid') ? PTS_USER_PATH . 'run-lock-' . posix_getpid() : tempnam(PTS_USER_PATH, 'run-lock-')); if (QUICK_START == false) { if (pts_client::create_lock(PTS_USER_LOCK) == false) { //trigger_error('It appears that the Phoronix Test Suite is already running.' . PHP_EOL . 'For proper results, only run one instance at a time.', E_USER_WARNING); } register_shutdown_function(array('pts_client', 'process_shutdown_tasks')); //pcntl_signal(SIGTERM, array('pts_client', 'exit_client')); if (pts_client::read_env('PTS_IGNORE_MODULES') == false) { pts_client::module_framework_init(); // Initialize the PTS module system } } // Read passed arguments for ($i = 2; $i < $argc && isset($argv[$i]); $i++) { $pass_args[] = $argv[$i]; } if (QUICK_START == false) { pts_client::user_agreement_check($sent_command); // OpenBenchmarking.org pts_openbenchmarking::refresh_repository_lists(); } pts_client::execute_command($sent_command, $pass_args); // Run command if (QUICK_START == false) { pts_client::release_lock(PTS_USER_LOCK); }
public static function run($r) { pts_openbenchmarking::refresh_repository_lists(); pts_client::$display->generic_heading('Interactive Benchmarking'); echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL; $reboot_on_exit = false; do { $options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition'); if (count(pts_client::saved_test_results()) > 0) { $options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage'; } $options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit'; $response = pts_user_io::prompt_text_menu('Select Task', $options, false, true); switch ($response) { case 'RUN_TEST': $supported_tests = pts_openbenchmarking::available_tests(); $supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true); $longest_title_length = 0; foreach ($supported_tests as $i => &$test_profile) { if ($test_profile->get_title() == null) { unset($supported_tests[$i]); continue; } $longest_title_length = max($longest_title_length, strlen($test_profile->get_title())); } $t = array(); foreach ($supported_tests as $i => &$test_profile) { if ($test_profile instanceof pts_test_profile) { $t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type()); } } $supported_tests = $t; asort($supported_tests); $tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true); $tests_to_run = explode(',', $tests_to_run); pts_test_installer::standard_install($tests_to_run); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($tests_to_run); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'RUN_SUITE': $possible_suites = pts_openbenchmarking::available_suites(); foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) { $possible_suites[] = 'pts/' . $subsystem; } $suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true); foreach (explode(',', $suites_to_run) as $suite_to_run) { pts_test_installer::standard_install($suite_to_run); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($suite_to_run); } break; case 'SELECT_DRIVE_MOUNT': self::select_drive_mount(); break; case 'RUN_SYSTEM_TEST': pts_client::$display->generic_heading('System Test'); $system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark'); pts_test_installer::standard_install($system_tests); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($system_tests); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'SHOW_INFO': pts_client::$display->generic_heading('System Software / Hardware Information'); echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL; echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL; break; case 'SHOW_SENSORS': pts_client::execute_command('system_sensors'); break; case 'SET_RUN_COUNT': $run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false); putenv('FORCE_TIMES_TO_RUN=' . trim($run_count)); break; case 'BACKUP_RESULTS_TO_USB': pts_client::$display->generic_heading('Backing Up Test Results'); foreach (pts_file_io::glob('/media/*') as $media_dir) { if (!is_writable($media_dir)) { echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL; continue; } echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL; pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/'); break; } break; } echo PHP_EOL . PHP_EOL; } while ($response != 'EXIT'); if ($reboot_on_exit) { if (is_dir('/media/pts-auto-mount')) { pts_file_io::delete('/media/pts-auto-mount/pts', null, true); exec('umount /media/pts-auto-mount 2>&1'); } exec('reboot'); } }