本文整理汇总了PHP中phodevi类的典型用法代码示例。如果您正苦于以下问题:PHP phodevi类的具体用法?PHP phodevi怎么用?PHP phodevi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了phodevi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($new_values = null)
{
if (PTS_IS_DAEMONIZED_SERVER_PROCESS || is_file('/etc/phoronix-test-suite.xml') && is_writable('/etc/phoronix-test-suite.xml')) {
$file = '/etc/phoronix-test-suite.xml';
} else {
if (PTS_IS_CLIENT && is_file(pts_config::get_config_file_location())) {
$file = pts_config::get_config_file_location();
} else {
if (PTS_USER_PATH . 'user-config.xml' != pts_config::get_config_file_location() && is_file(PTS_USER_PATH . 'user-config.xml')) {
$file = PTS_USER_PATH . 'user-config.xml';
} else {
if (PTS_IS_CLIENT && is_file($t = PTS_CORE_STATIC_PATH . phodevi::read_property('system', 'vendor-identifier') . '-user-config-template.xml')) {
$file = $t;
} else {
if (is_file(PTS_CORE_STATIC_PATH . 'user-config-template.xml')) {
$file = PTS_CORE_STATIC_PATH . 'user-config-template.xml';
} else {
if (is_file(PTS_CORE_STATIC_PATH . 'user-config-defaults.xml')) {
$file = PTS_CORE_STATIC_PATH . 'user-config-defaults.xml';
} else {
$file = null;
}
}
}
}
}
}
$this->override_values = is_array($new_values) ? $new_values : false;
parent::__construct($file);
}
示例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
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;
}
示例4: run
public static function run($r)
{
pts_client::$display->generic_heading('Available Tests');
$test_count = 0;
foreach (pts_openbenchmarking::available_tests(false) as $identifier) {
$repo = substr($identifier, 0, strpos($identifier, '/'));
$id = substr($identifier, strlen($repo) + 1);
$repo_index = pts_openbenchmarking::read_repository_index($repo);
if (!in_array(phodevi::operating_system(), $repo_index['tests'][$id]['supported_platforms']) || empty($repo_index['tests'][$id]['title'])) {
// Don't show unsupported tests
continue;
}
echo sprintf('%-30ls - %-35ls %-9ls', $identifier, $repo_index['tests'][$id]['title'], $repo_index['tests'][$id]['test_type']) . PHP_EOL;
$test_count++;
}
foreach (pts_file_io::glob(PTS_TEST_PROFILE_PATH . 'local/*/test-definition.xml') as $path) {
$test_profile = new pts_test_profile('local/' . basename(dirname($path)));
if ($test_profile->get_title() != null && $test_profile->is_supported(false)) {
echo sprintf('%-30ls - %-35ls %-9ls', $test_profile->get_identifier(), $test_profile->get_title(), $test_profile->get_test_hardware_type()) . PHP_EOL;
$test_count++;
}
}
if ($test_count == 0) {
echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
}
}
示例5: 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]);
}
}
}
示例6: network_device_string
public static function network_device_string()
{
$network = array();
if (phodevi::is_macosx()) {
// TODO: implement
} else {
if (phodevi::is_bsd()) {
foreach (array('dev.em.0.%desc', 'dev.wpi.0.%desc', 'dev.mskc.0.%desc') as $controller) {
$pci = phodevi_bsd_parser::read_sysctl($controller);
if (!empty($pci)) {
array_push($network, $pci);
}
}
} else {
if (phodevi::is_windows()) {
// TODO: implement
} else {
if (phodevi::is_linux()) {
foreach (array('Ethernet controller', 'Network controller') as $controller) {
$pci = phodevi_linux_parser::read_pci($controller);
if (!empty($pci)) {
array_push($network, $pci);
}
}
}
}
}
}
return implode(' + ', $network);
}
示例7: init_files
public static function init_files()
{
// Don't let the process run multiple times...
if (pts_config::$init_process_ran) {
return false;
}
pts_config::$init_process_ran = true;
// The main PTS user client config
pts_config::user_config_generate();
// Generate the graph config
$json_pre = null;
if (is_file(PTS_USER_PATH . 'graph-config.json')) {
$json_pre = file_get_contents(PTS_USER_PATH . 'graph-config.json');
} else {
if (PTS_IS_CLIENT && is_file($t = PTS_CORE_STATIC_PATH . 'graph-config-template-' . phodevi::read_property('system', 'vendor-identifier') . '.json')) {
$json_pre = file_get_contents($t);
} else {
if (is_file(PTS_CORE_STATIC_PATH . 'graph-config-template.json')) {
$json_pre = file_get_contents(PTS_CORE_STATIC_PATH . 'graph-config-template.json');
}
}
}
$json_graph = array();
pts_Graph::set_default_graph_values($json_graph);
if ($json_pre != null) {
$json_pre = json_decode($json_pre, true);
if (is_array($json_pre)) {
$json_graph = array_merge($json_graph, $json_pre);
}
}
pts_Graph::init_graph_config($json_graph);
file_put_contents(PTS_USER_PATH . 'graph-config.json', pts_arrays::json_encode_pretty_string($json_graph));
}
示例8: __construct
public function __construct($identifier = null)
{
$this->struct = array('external-dependencies' => array('name' => null, 'package_manager' => null, 'aliases' => array(), 'packages' => array()));
if (PTS_IS_CLIENT) {
$xml = PTS_EXDEP_PATH . 'xml/' . $identifier . '-packages.xml';
$xml_parser = new nye_XmlReader($xml);
$this->struct['external-dependencies']['name'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Name');
$this->struct['external-dependencies']['package_manager'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/PackageManager');
$generic_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
$distro_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PackageName');
$file_check = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
$arch_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/ArchitectureSpecific');
$os_version_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/VersionSpecific');
$os_version = phodevi::read_property('system', 'os-version');
foreach (array_keys($generic_package) as $i) {
if (empty($generic_package[$i])) {
continue;
}
$os_version_compliant = empty($os_version_specific[$i]) || in_array($os_version, pts_strings::comma_explode($os_version_specific[$i]));
if ($os_version_compliant == false) {
continue;
}
$this->struct['external-dependencies']['packages'][$generic_package[$i]] = $this->get_package_format($distro_package[$i], $file_check[$i], $arch_specific[$i]);
}
$aliases = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Aliases');
if ($aliases != null) {
$aliases = pts_strings::trim_explode(',', $aliases);
foreach ($aliases as $alias) {
if ($alias != null) {
$this->struct['external-dependencies']['aliases'][] = $alias;
}
}
}
}
}
示例9: mem_usage
private function mem_usage()
{
if (phodevi::is_linux()) {
return self::mem_usage_linux();
} elseif (phodevi::is_macosx() || phodevi::is_bsd()) {
return self::mem_usage_bsd('MEMORY', 'USED');
}
}
示例10: read_sensor
public function read_sensor()
{
$fan_speed = -1;
if (phodevi::is_linux()) {
$fan_speed = $this->sys_fanspeed_linux();
}
return $fan_speed;
}
示例11: read_sensor
public function read_sensor()
{
if (phodevi::is_linux()) {
return $this->cpu_power_linux();
}
return -1;
// TODO make -1 a named constant
}
示例12: read_sensor
public function read_sensor()
{
$write_speed = -1;
if (phodevi::is_linux()) {
$write_speed = $this->hdd_write_speed_linux();
}
return pts_math::set_precision($write_speed, 2);
}
示例13: read_sensor
public function read_sensor()
{
$temp = -1;
if (phodevi::is_linux()) {
$temp = $this->hdd_temp_linux();
}
return pts_math::set_precision($temp, 2);
}
示例14: read_sensor
public function read_sensor()
{
$net_speed = -1;
if (phodevi::is_bsd() || phodevi::is_macosx()) {
$net_speed = $this->network_usage_bsd();
}
return pts_math::set_precision($net_speed, 2);
}
示例15: read_sensor
public function read_sensor()
{
$swap_usage = -1;
if (phodevi::is_linux()) {
$swap_usage = self::swap_usage_linux();
}
return $swap_usage;
}