当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_client类代码示例

本文整理汇总了PHP中pts_client的典型用法代码示例。如果您正苦于以下问题:PHP pts_client类的具体用法?PHP pts_client怎么用?PHP pts_client使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了pts_client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: read_osx_system_profiler

 public static function read_osx_system_profiler($data_type, $object, $multiple_objects = false, $ignore_values = array())
 {
     $value = $multiple_objects ? array() : false;
     if (pts_client::executable_in_path('system_profiler')) {
         $info = trim(shell_exec('system_profiler ' . $data_type . ' 2>&1'));
         $lines = explode("\n", $info);
         for ($i = 0; $i < count($lines) && ($value == false || $multiple_objects); $i++) {
             $line = pts_strings::colon_explode($lines[$i]);
             if (isset($line[0]) == false) {
                 continue;
             }
             $line_object = str_replace(' ', null, $line[0]);
             if (($cut_point = strpos($line_object, '(')) > 0) {
                 $line_object = substr($line_object, 0, $cut_point);
             }
             if (strtolower($line_object) == strtolower($object) && isset($line[1])) {
                 $this_value = trim($line[1]);
                 if (!empty($this_value) && !in_array($this_value, $ignore_values)) {
                     if ($multiple_objects) {
                         array_push($value, $this_value);
                     } else {
                         $value = $this_value;
                     }
                 }
             }
         }
     }
     return $value;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:29,代码来源:phodevi_osx_parser.php

示例2: run

 public static function run($args)
 {
     $result_file = new pts_result_file($args[0]);
     $result_file_identifiers = $result_file->get_system_identifiers();
     if (count($result_file_identifiers) < 2) {
         echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
         return false;
     }
     echo PHP_EOL . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL;
     $sorted_identifiers = array();
     do {
         $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers);
         $sorted_identifiers[] = $extract_identifier;
         $old_identifiers = $result_file_identifiers;
         $result_file_identifiers = array();
         foreach ($old_identifiers as $identifier) {
             if ($identifier != $extract_identifier) {
                 $result_file_identifiers[] = $identifier;
             }
         }
     } while (count($result_file_identifiers) > 0);
     $result_file->reorder_runs($sorted_identifiers);
     pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml());
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html');
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:25,代码来源:reorder_result_file.php

示例3: 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;
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:29,代码来源:debug_self_test.php

示例4: what_provides

 public static function what_provides($files_needed)
 {
     $packages_needed = array();
     foreach (pts_arrays::to_array($files_needed) as $file) {
         if (pts_client::executable_in_path('apt-file')) {
             if (!defined('APT_FILE_UPDATED')) {
                 shell_exec('apt-file update 2>&1');
                 define('APT_FILE_UPDATED', 1);
             }
             // Try appending common paths
             if (strpos($file, '.h') !== false) {
                 $apt_provides = self::run_apt_file_provides('/usr/include/' . $file);
                 if ($apt_provides != null) {
                     $packages_needed[$file] = $apt_provides;
                 }
             } else {
                 if (strpos($file, '.so') !== false) {
                     $apt_provides = self::run_apt_file_provides('/usr/lib/' . $file);
                     if ($apt_provides != null) {
                         $packages_needed[$file] = $apt_provides;
                     }
                 } else {
                     foreach (array('/usr/bin/', '/bin/', '/usr/sbin') as $possible_path) {
                         $apt_provides = self::run_apt_file_provides($possible_path . $file);
                         if ($apt_provides != null) {
                             $packages_needed[$file] = $apt_provides;
                             break;
                         }
                     }
                 }
             }
         }
     }
     return $packages_needed;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:35,代码来源:ubuntu_dependency_handler.php

示例5: net_counter

 private static function net_counter($IFACE = 'en0')
 {
     $net_counter = -1;
     if (pts_client::executable_in_path('netstat') != false) {
         $netstat_lines = explode("\n", shell_exec('netstat -ib 2>&1'));
         $ibytes_index = -1;
         $obytes_index = -1;
         $ibytes = -1;
         $obytes = -1;
         foreach ($netstat_lines as $line) {
             if (strtok($line, ' ') == 'Name') {
                 $ibytes_index = strpos($line, 'Ierrs') + 6;
                 $obytes_index = strpos($line, 'Oerrs') + 6;
                 continue;
             }
             //$netstat_data = pts_strings::trim_explode(' ', $line);
             /*
              * Sample output:
              * Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes    Opkts Oerrs     Obytes  Coll
              * en0   1500  <Link#4>    00:25:4b:c5:95:66    23350     0   19111634    13494     0    1632167     0
              */
             if (strtok($line, ' ') == $IFACE) {
                 $ibytes = strtok(substr($line, $ibytes_index), ' ');
                 $obytes = strtok(substr($line, $obytes_index), ' ');
                 $net_counter = $ibytes + $obytes;
             }
             if ($ibytes != -1 && $obytes != -1) {
                 break;
             }
         }
     }
     return $net_counter;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:33,代码来源:network_usage.php

示例6: 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;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:28,代码来源:debug_self_test.php

示例7: user_home_directory

 public static function user_home_directory()
 {
     // Gets the system user's home directory
     static $userhome = null;
     if ($userhome == null) {
         if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
             $userinfo = posix_getpwuid(posix_getuid());
             $userhome = $userinfo['dir'];
         } else {
             if ($home = pts_client::read_env('HOME')) {
                 $userhome = $home;
             } else {
                 if ($home = pts_client::read_env('HOMEPATH')) {
                     $userhome = pts_client::read_env('HOMEDRIVE') . $home;
                 } else {
                     if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
                         $userhome = PTS_USER_PATH;
                     } else {
                         if (!is_writable('/')) {
                             echo PHP_EOL . 'ERROR: Cannot find home directory.' . PHP_EOL;
                         }
                         $userhome = null;
                     }
                 }
             }
         }
         $userhome = pts_strings::add_trailing_slash($userhome);
     }
     return $userhome;
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:30,代码来源:pts-core.php

示例8: run

 public static function run($r)
 {
     $result = $r[0];
     $result_file = new pts_result_file($result);
     $result_file_identifiers = $result_file->get_system_identifiers();
     if (count($result_file_identifiers) < 2) {
         echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
         return false;
     }
     $remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true));
     $keep_identifiers = array();
     foreach ($result_file_identifiers as $identifier) {
         if (!in_array($identifier, $remove_identifiers)) {
             array_push($keep_identifiers, $identifier);
         }
     }
     foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) {
         foreach ($remove_identifiers as $remove_identifier) {
             if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier)) {
                 pts_file_io::delete(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier, null, true);
             }
         }
     }
     $extract_select = new pts_result_merge_select($result, $keep_identifiers);
     $extract_result = pts_merge::merge_test_results($extract_select);
     pts_client::save_test_result($r[0] . '/composite.xml', $extract_result);
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html');
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:28,代码来源:remove_from_result_file.php

示例9: generate_download_object_list

 public function generate_download_object_list($do_file_checks = true)
 {
     $download_xml_file = $this->test_profile->get_file_download_spec();
     if ($download_xml_file != null) {
         $xml_parser = new pts_test_downloads_nye_XmlReader($download_xml_file);
         $package_url = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/URL');
         $package_md5 = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/MD5');
         $package_sha256 = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/SHA256');
         $package_filename = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/FileName');
         $package_filesize = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/FileSize');
         $package_platform = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/PlatformSpecific');
         $package_architecture = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/ArchitectureSpecific');
         foreach (array_keys($package_url) as $i) {
             if (!empty($package_platform[$i]) && $do_file_checks) {
                 $platforms = pts_strings::comma_explode($package_platform[$i]);
                 if (!in_array(phodevi::operating_system(), $platforms) && !(phodevi::is_bsd() && in_array('Linux', $platforms) && (pts_client::executable_in_path('kldstat') && strpos(shell_exec('kldstat -n linux 2>&1'), 'linux.ko') != false))) {
                     // This download does not match the operating system
                     continue;
                 }
             }
             if (!empty($package_architecture[$i]) && $do_file_checks) {
                 $architectures = pts_strings::comma_explode($package_architecture[$i]);
                 if (phodevi::cpu_arch_compatible($architectures) == false) {
                     // This download does not match the CPU architecture
                     continue;
                 }
             }
             $this->test_files[] = new pts_test_file_download($package_url[$i], $package_filename[$i], $package_filesize[$i], $package_md5[$i], $package_sha256[$i], $package_platform[$i], $package_architecture[$i]);
         }
     }
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:31,代码来源:pts_test_install_request.php

示例10: run

 public static function run($args)
 {
     $result = $args[0];
     $result_file = new pts_result_file($result);
     $result_file_identifiers = $result_file->get_system_identifiers();
     if (count($result_file_identifiers) < 2) {
         echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
         return false;
     }
     $extract_selects = array();
     echo PHP_EOL . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL;
     do {
         $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers);
         array_push($extract_selects, new pts_result_merge_select($result, $extract_identifier));
         $old_identifiers = $result_file_identifiers;
         $result_file_identifiers = array();
         foreach ($old_identifiers as $identifier) {
             if ($identifier != $extract_identifier) {
                 array_push($result_file_identifiers, $identifier);
             }
         }
     } while (count($result_file_identifiers) > 0);
     $ordered_result = pts_merge::merge_test_results_array($extract_selects);
     pts_client::save_test_result($args[0] . '/composite.xml', $ordered_result);
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html');
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:26,代码来源:reorder_result_file.php

示例11: set_amd_pcsdb

 public static function set_amd_pcsdb($attribute, $value)
 {
     // Sets a value for AMD's PCSDB, Persistent Configuration Store Database
     if (phodevi::is_ati_graphics() && phodevi::is_linux() && !empty($value)) {
         $DISPLAY = substr(pts_client::read_env("DISPLAY"), 1, 1);
         $info = shell_exec("DISPLAY=:" . $DISPLAY . " aticonfig --set-pcs-val=" . $attribute . "," . $value . "  2>&1");
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:8,代码来源:graphics_override.php

示例12: run

 public static function run($r)
 {
     $URL = PTS_SAVE_RESULTS_PATH . $r[0];
     if (!is_dir($URL . '/result-graphs/')) {
         pts_client::generate_result_file_graphs($r[0], PTS_SAVE_RESULTS_PATH . $r[0] . '/');
     }
     pts_client::display_web_page($URL . '/index.html', null, false, true);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:8,代码来源:show_result.php

示例13: run

 public static function run($r)
 {
     // Make sure you're debugging the latest test script...
     pts_test_installer::standard_install($r);
     // For debugging, usually running just once is sufficient, unless FORCE_TIMES_TO_RUN is preset
     pts_client::pts_set_environment_variable('FORCE_TIMES_TO_RUN', 1);
     // Run the test(s) in debug mode
     pts_test_run_manager::standard_run($r, pts_c::debug_mode);
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:9,代码来源:debug_benchmark.php

示例14: run

 public static function run($r)
 {
     $result_file = new pts_result_file($r[0]);
     $result_output = pts_result_file_output::result_file_to_csv($result_file);
     // To save the result:
     $file = pts_client::user_home_directory() . $r[0] . '.csv';
     file_put_contents($file, $result_output);
     echo $result_output;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:9,代码来源:result_file_to_csv.php

示例15: __construct

 public function __construct($script, $env_vars = null, $set_current_path = null)
 {
     if (!isset($env_vars['HOME'])) {
         $env_vars['HOME'] = $set_current_path;
     }
     $this->environmental_variables = $env_vars == null ? pts_client::environmental_variables() : array_merge(pts_client::environmental_variables(), $env_vars);
     $this->script_file = is_file($script) ? $script : null;
     $this->var_current_directory = $set_current_path;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:9,代码来源:pts_phoroscript_interpreter.php


注:本文中的pts_client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。