本文整理汇总了PHP中phodevi::clear_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP phodevi::clear_cache方法的具体用法?PHP phodevi::clear_cache怎么用?PHP phodevi::clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phodevi
的用法示例。
在下文中一共展示了phodevi::clear_cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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;
}
示例2: run
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;
}
示例3: run_connection
//.........这里部分代码省略.........
pts_suite_nye_XmlReader::set_temporary_suite('pre-seed', $json['phoromatic']['test_suite']);
pts_test_installer::standard_install('pre-seed');
break;
case 'benchmark':
// Make sure all latest tests are available
pts_openbenchmarking::refresh_repository_lists(null, true);
$benchmark_timer = time();
self::$is_running_as_phoromatic_node = true;
$test_flags = pts_c::auto_mode | pts_c::batch_mode;
$suite_identifier = sha1(time() . rand(2, 1000));
pts_suite_nye_XmlReader::set_temporary_suite($suite_identifier, $json['phoromatic']['test_suite']);
self::$p_save_identifier = $json['phoromatic']['trigger_id'];
$phoromatic_results_identifier = self::$p_save_identifier;
$phoromatic_save_identifier = $json['phoromatic']['save_identifier'];
self::$p_schedule_id = isset($json['phoromatic']['schedule_id']) ? $json['phoromatic']['schedule_id'] : false;
self::$p_trigger_id = self::$p_save_identifier;
$benchmark_ticket_id = isset($json['phoromatic']['benchmark_ticket_id']) ? $json['phoromatic']['benchmark_ticket_id'] : null;
phoromatic::update_system_status('Running Benchmarks For: ' . $phoromatic_save_identifier);
if (pts_strings::string_bool($json['phoromatic']['settings']['RunInstallCommand'])) {
if (isset($json['phoromatic']['pre_install_set_context'])) {
phoromatic::set_user_context($json['phoromatic']['pre_install_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'PRE_INSTALL');
}
if (pts_strings::string_bool($json['phoromatic']['settings']['ForceInstallTests'])) {
$test_flags |= pts_c::force_install;
}
pts_client::set_test_flags($test_flags);
pts_test_installer::standard_install($suite_identifier);
if (isset($json['phoromatic']['post_install_set_context'])) {
phoromatic::set_user_context($json['phoromatic']['post_install_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'POST_INSTALL');
}
}
$env_vars = isset($json['phoromatic']['environment_variables']) ? pts_strings::parse_value_string_vars($json['phoromatic']['environment_variables']) : array();
// Do the actual running
phodevi::clear_cache();
if (pts_test_run_manager::initial_checks($suite_identifier, 0, 'SHORT')) {
self::$test_run_manager = new pts_test_run_manager($test_flags);
pts_test_run_manager::set_batch_mode(array('UploadResults' => isset($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']) && pts_strings::string_bool($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']), 'SaveResults' => true, 'RunAllTestCombinations' => false, 'OpenBrowser' => false));
// Load the tests to run
if (self::$test_run_manager->load_tests_to_run($suite_identifier)) {
phoromatic::update_system_status('Tests In Run Queue: ' . implode(', ', self::$test_run_manager->get_tests_to_run_identifiers()));
if (isset($json['phoromatic']['pre_run_set_context'])) {
phoromatic::set_user_context($json['phoromatic']['pre_run_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'PRE_RUN');
}
if (isset($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']) && pts_strings::string_bool($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking'])) {
self::$test_run_manager->auto_upload_to_openbenchmarking();
pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', pts_strings::string_bool($json['phoromatic']['settings']['UploadSystemLogs']));
}
// Save results?
// Run the actual tests
if (isset($env_vars['PTS_CONCURRENT_TEST_RUNS']) && $env_vars['PTS_CONCURRENT_TEST_RUNS'] > 1) {
$total_loop_time = isset($env_vars['TOTAL_LOOP_TIME']) ? $env_vars['TOTAL_LOOP_TIME'] : false;
pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION STARTED @ ' . date('Y-m-d H:i:s'));
pts_client::$pts_logger->log('CONCURRENT RUNS = ' . $env_vars['PTS_CONCURRENT_TEST_RUNS'] . ' TOTAL LOOP TIME = ' . $total_loop_time);
$r = self::$test_run_manager->multi_test_stress_run_execute($env_vars['PTS_CONCURRENT_TEST_RUNS'], $total_loop_time);
if ($r == false) {
return;
}
pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION ENDED @ ' . date('Y-m-d H:i:s'));
} else {
self::$test_run_manager->auto_save_results($phoromatic_save_identifier, $phoromatic_results_identifier, isset($json['phoromatic']['test_description']) ? $json['phoromatic']['test_description'] : 'A Phoromatic run.');
self::$test_run_manager->pre_execution_process();
self::$test_run_manager->call_test_runs();
}
phoromatic::update_system_status('Benchmarks Completed For: ' . $phoromatic_save_identifier);
self::$test_run_manager->post_execution_process();
$elapsed_benchmark_time = time() - $benchmark_timer;