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


PHP phodevi::is_bsd方法代码示例

本文整理汇总了PHP中phodevi::is_bsd方法的典型用法代码示例。如果您正苦于以下问题:PHP phodevi::is_bsd方法的具体用法?PHP phodevi::is_bsd怎么用?PHP phodevi::is_bsd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phodevi的用法示例。


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

示例1: 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

示例2: 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);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:30,代码来源:phodevi_network.php

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

示例4: 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');
     }
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:8,代码来源:memory_usage.php

示例5: read_sensor

 public static function read_sensor()
 {
     // Read the processor temperature
     $temp_c = -1;
     if (phodevi::is_bsd()) {
         $cpu_temp = phodevi_bsd_parser::read_sysctl(array('hw.sensors.acpi_tz0.temp0', 'dev.cpu.0.temperature', 'hw.sensors.cpu0.temp0'));
         if ($cpu_temp != false) {
             if (($end = strpos($cpu_temp, 'degC')) || ($end = strpos($cpu_temp, 'C')) > 0) {
                 $cpu_temp = substr($cpu_temp, 0, $end);
             }
             if (is_numeric($cpu_temp)) {
                 $temp_c = $cpu_temp;
             }
         } else {
             $acpi = phodevi_bsd_parser::read_sysctl('hw.acpi.thermal.tz0.temperature');
             if (($end = strpos($acpi, 'C')) > 0) {
                 $acpi = substr($acpi, 0, $end);
             }
             if (is_numeric($acpi)) {
                 $temp_c = $acpi;
             }
         }
     } else {
         if (phodevi::is_linux()) {
             // Try hwmon interface
             $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp1_input', 'POSITIVE_NUMERIC', array('name' => 'coretemp'));
             if ($raw_temp == -1) {
                 $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp1_input', 'POSITIVE_NUMERIC', array('name' => 'k10temp'));
             }
             if ($raw_temp == -1) {
                 // Try ACPI thermal
                 // Assuming the system thermal sensor comes 2nd to the ACPI CPU temperature
                 // It appears that way on a ThinkPad T60, but TODO find a better way to validate
                 $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/thermal/thermal_zone*/temp', 'POSITIVE_NUMERIC', null, 2);
             }
             if ($raw_temp != -1) {
                 if ($raw_temp > 1000) {
                     $raw_temp = $raw_temp / 1000;
                 }
                 $temp_c = pts_math::set_precision($raw_temp, 2);
             }
             if ($temp_c == -1) {
                 // Try LM_Sensors
                 $sensors = phodevi_linux_parser::read_sensors(array('CPU Temp', 'Core 0', 'Core0 Temp', 'Core1 Temp'));
                 if ($sensors != false && is_numeric($sensors) && $sensors > 0) {
                     $temp_c = $sensors;
                 }
             }
             if (pts_client::executable_in_path('ipmitool')) {
                 $ipmi = phodevi_linux_parser::read_ipmitool_sensor('Temp 0');
                 if ($ipmi > 0 && is_numeric($ipmi)) {
                     $temp_c = $ipmi;
                 }
             }
         }
     }
     return $temp_c;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:58,代码来源:cpu_temp.php

示例6: read_sensor

 public function read_sensor()
 {
     $sys_temp = -1;
     if (phodevi::is_linux()) {
         $sys_temp = $this->sys_temp_linux();
     } elseif (phodevi::is_bsd()) {
         $sys_temp = $this->sys_temp_bsd();
     }
     return $sys_temp;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:10,代码来源:sys_temp.php

示例7: read_sensor

 public static function read_sensor()
 {
     // Reads the system's temperature
     $temp_c = -1;
     if (phodevi::is_linux()) {
         $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp3_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
         if ($raw_temp == -1) {
             $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp2_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
         }
         if ($raw_temp == -1) {
             $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp1_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
         }
         if ($raw_temp == -1) {
             $raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/temp1_input', 'POSITIVE_NUMERIC');
         }
         if ($raw_temp != -1) {
             if ($raw_temp > 1000) {
                 $raw_temp = $raw_temp / 1000;
             }
             $temp_c = pts_math::set_precision($raw_temp, 2);
         }
         if ($temp_c == -1) {
             $acpi = phodevi_linux_parser::read_acpi(array('/thermal_zone/THM1/temperature', '/thermal_zone/TZ00/temperature', '/thermal_zone/TZ01/temperature'), 'temperature');
             if (($end = strpos($acpi, ' ')) > 0) {
                 $temp_c = substr($acpi, 0, $end);
             }
         }
         if ($temp_c == -1) {
             $sensors = phodevi_linux_parser::read_sensors(array('Sys Temp', 'Board Temp'));
             if ($sensors != false && is_numeric($sensors)) {
                 $temp_c = $sensors;
             }
         }
         if ($temp_c == -1 && is_file('/sys/class/thermal/thermal_zone0/temp')) {
             $temp_c = pts_file_io::file_get_contents('/sys/class/thermal/thermal_zone0/temp');
             if ($temp_c > 1000) {
                 $temp_c = pts_math::set_precision($temp_c / 1000, 1);
             }
         }
     } else {
         if (phodevi::is_bsd()) {
             $acpi = phodevi_bsd_parser::read_sysctl(array('hw.sensors.acpi_tz1.temp0', 'hw.acpi.thermal.tz1.temperature'));
             if (($end = strpos($acpi, ' degC')) > 0 || ($end = strpos($acpi, 'C')) > 0) {
                 $acpi = substr($acpi, 0, $end);
                 if (is_numeric($acpi)) {
                     $temp_c = $acpi;
                 }
             }
         }
     }
     return $temp_c;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:52,代码来源:sys_temp.php

示例8: read_sensor

 public function read_sensor()
 {
     // Read the processor temperature
     $temp_c = -1;
     if (phodevi::is_bsd()) {
         $temp_c = $this->cpu_temp_bsd();
     } else {
         if (phodevi::is_linux()) {
             $temp_c = $this->cpu_temp_linux();
         }
     }
     return $temp_c;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:13,代码来源:cpu_temp.php

示例9: audio_processor_string

 public static function audio_processor_string()
 {
     $audio = null;
     if (phodevi::is_macosx()) {
         // TODO: implement
     } else {
         if (phodevi::is_bsd()) {
             foreach (array('dev.hdac.0.%desc') as $dev) {
                 $dev = phodevi_bsd_parser::read_sysctl($dev);
                 if (!empty($dev)) {
                     $audio = $dev;
                 }
             }
         } else {
             if (phodevi::is_windows()) {
                 // TODO: implement
             } else {
                 if (phodevi::is_linux()) {
                     foreach (pts_file_io::glob('/sys/class/sound/card*/hwC0D*/vendor_name') as $vendor_name) {
                         $card_dir = dirname($vendor_name) . '/';
                         if (!is_readable($card_dir . 'chip_name')) {
                             continue;
                         }
                         $vendor_name = pts_file_io::file_get_contents($vendor_name);
                         $chip_name = pts_file_io::file_get_contents($card_dir . 'chip_name');
                         $audio = $vendor_name . ' ' . $chip_name;
                         if (strpos($chip_name, 'HDMI') !== false || strpos($chip_name, 'DP') !== false) {
                             // If HDMI is in the audio string, likely the GPU-provided audio, so try to find the mainboard otherwise
                             $audio = null;
                         } else {
                             break;
                         }
                     }
                     if ($audio == null) {
                         $audio = phodevi_linux_parser::read_pci('Multimedia audio controller');
                     }
                     if ($audio == null) {
                         $audio = phodevi_linux_parser::read_pci('Audio device');
                     }
                 }
             }
         }
     }
     return $audio;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:45,代码来源:phodevi_audio.php

示例10: read_sensor

 public static function read_sensor()
 {
     // Determine the current processor frequency
     $cpu_core = 0;
     // TODO: for now just monitoring the first core
     $info = 0;
     if (phodevi::is_linux()) {
         // First, the ideal way, with modern CPUs using CnQ or EIST and cpuinfo reporting the current
         if (is_file('/sys/devices/system/cpu/cpu' . $cpu_core . '/cpufreq/scaling_cur_freq')) {
             $info = pts_file_io::file_get_contents('/sys/devices/system/cpu/cpu' . $cpu_core . '/cpufreq/scaling_cur_freq');
             $info = intval($info) / 1000;
         } else {
             if (is_file('/proc/cpuinfo')) {
                 $cpu_speeds = phodevi_linux_parser::read_cpuinfo('cpu MHz');
                 if (isset($cpu_speeds[0])) {
                     $cpu_core = isset($cpu_speeds[$cpu_core]) ? $cpu_core : 0;
                     $info = intval($cpu_speeds[$cpu_core]);
                 }
             }
         }
     } else {
         if (phodevi::is_solaris()) {
             $info = shell_exec('psrinfo -v | grep MHz');
             $info = substr($info, strrpos($info, 'at') + 3);
             $info = trim(substr($info, 0, strpos($info, 'MHz')));
         } else {
             if (phodevi::is_bsd()) {
                 $info = phodevi_bsd_parser::read_sysctl('dev.cpu.0.freq');
             } else {
                 if (phodevi::is_macosx()) {
                     $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'ProcessorSpeed');
                     if (($cut_point = strpos($info, ' ')) > 0) {
                         $info = substr($info, 0, $cut_point);
                         $info = str_replace(',', '.', $info);
                     }
                     if ($info < 100) {
                         $info *= 1000;
                     }
                 }
             }
         }
     }
     return pts_math::set_precision($info, 2);
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:44,代码来源:cpu_freq.php

示例11: read_sensor

 public function read_sensor()
 {
     // Determine the current processor frequency
     $frequency = 0;
     if (phodevi::is_linux()) {
         $frequency = $this->cpu_freq_linux();
     } else {
         if (phodevi::is_solaris()) {
             $frequency = $this->cpu_freq_solaris();
         } else {
             if (phodevi::is_bsd()) {
                 $frequency = $this->cpu_freq_bsd();
             } else {
                 if (phodevi::is_macosx()) {
                     $frequency = $this->cpu_freq_macosx();
                 }
             }
         }
     }
     return pts_math::set_precision($frequency, 2);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:21,代码来源:cpu_freq.php

示例12: is_test_platform_supported

 public function is_test_platform_supported()
 {
     // Check if the system's OS is supported by a test
     $supported = true;
     $platforms = $this->get_supported_platforms();
     if (!empty($platforms) && !in_array(phodevi::operating_system(), $platforms)) {
         if (phodevi::is_bsd() && in_array('Linux', $platforms) && (pts_client::executable_in_path('kldstat') && strpos(shell_exec('kldstat -n linux 2>&1'), 'linux.ko') != false)) {
             // The OS is BSD but there is Linux API/ABI compatibility support loaded
             $supported = true;
         } else {
             if (phodevi::is_hurd() && in_array('Linux', $platforms) && in_array('BSD', $platforms)) {
                 // For now until test profiles explicity express Hurd support, just list as supported the tests that work on both BSD and Linux
                 // TODO: fill in Hurd support for test profiles / see what works
                 $supported = true;
             } else {
                 $supported = false;
             }
         }
     }
     return $supported;
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:21,代码来源:pts_test_profile.php

示例13: cpu_model

 public static function cpu_model()
 {
     // Returns the processor name / frequency information
     $info = null;
     if (isset(phodevi::$vfs->cpuinfo)) {
         $physical_cpu_ids = phodevi_linux_parser::read_cpuinfo('physical id');
         $physical_cpu_count = count(array_unique($physical_cpu_ids));
         $cpu_strings = phodevi_linux_parser::read_cpuinfo(array('model name', 'Processor', 'cpu', 'cpu model'));
         $cpu_strings_unique = array_unique($cpu_strings);
         if ($physical_cpu_count == 1 || empty($physical_cpu_count)) {
             // Just one processor
             if (isset($cpu_strings[0]) && ($cut = strpos($cpu_strings[0], ' (')) !== false) {
                 $cpu_strings[0] = substr($cpu_strings[0], 0, $cut);
             }
             $info = isset($cpu_strings[0]) ? $cpu_strings[0] : null;
             if (strpos($info, 'ARM') !== false) {
                 if (is_dir('/sys/devices/system/exynos-core/') && stripos($info, 'Exynos') === false) {
                     $info = 'Exynos ' . $info;
                 }
             }
         } else {
             if ($physical_cpu_count > 1 && count($cpu_strings_unique) == 1) {
                 // Multiple processors, same model
                 $info = $physical_cpu_count . ' x ' . $cpu_strings[0];
             } else {
                 if ($physical_cpu_count > 1 && count($cpu_strings_unique) > 1) {
                     // Multiple processors, different models
                     $current_id = -1;
                     $current_string = $cpu_strings[0];
                     $current_count = 0;
                     $cpus = array();
                     for ($i = 0; $i < count($physical_cpu_ids); $i++) {
                         if ($current_string != $cpu_strings[$i] || $i == count($physical_cpu_ids) - 1) {
                             array_push($cpus, $current_count . ' x ' . $current_string);
                             $current_string = $cpu_strings[$i];
                             $current_count = 0;
                         }
                         if ($physical_cpu_ids[$i] != $current_id) {
                             $current_count++;
                             $current_id = $physical_cpu_ids[$i];
                         }
                     }
                     $info = implode(', ', $cpus);
                 }
             }
         }
     } else {
         if (phodevi::is_solaris()) {
             $dmi_cpu = phodevi_solaris_parser::read_sun_ddu_dmi_info('CPUType', '-C');
             if (count($dmi_cpu) == 0) {
                 $dmi_cpu = phodevi_solaris_parser::read_sun_ddu_dmi_info('ProcessorName');
             }
             if (count($dmi_cpu) > 0) {
                 $info = $dmi_cpu[0];
             } else {
                 $info = trim(shell_exec('dmesg 2>&1 | grep cpu0'));
                 $info = trim(substr($info, strrpos($info, 'cpu0:') + 6));
                 if (empty($info)) {
                     $info = array_pop(phodevi_solaris_parser::read_sun_ddu_dmi_info('ProcessorManufacturer'));
                 }
             }
             //TODO: Add in proper support for reading multiple CPUs, similar to the code from above
             $physical_cpu_count = count(phodevi_solaris_parser::read_sun_ddu_dmi_info('ProcessorSocketType'));
             if ($physical_cpu_count > 1 && !empty($info)) {
                 // TODO: For now assuming when multiple CPUs are installed, that they are of the same type
                 $info = $physical_cpu_count . ' x ' . $info;
             }
         } else {
             if (phodevi::is_bsd()) {
                 $info = phodevi_bsd_parser::read_sysctl('hw.model');
             } else {
                 if (phodevi::is_macosx()) {
                     $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'ProcessorName');
                 } else {
                     if (phodevi::is_windows()) {
                         $info = phodevi_windows_parser::read_cpuz('Processor 1', 'Name');
                         if (!$info) {
                             $info = getenv('PROCESSOR_IDENTIFIER');
                         }
                     }
                 }
             }
         }
     }
     if (empty($info)) {
         $info = 'Unknown';
     } else {
         if (($strip_point = strpos($info, '@')) > 0) {
             $info = trim(substr($info, 0, $strip_point));
             // stripping out the reported freq, since the CPU could be overclocked, etc
         }
         $info = pts_strings::strip_string($info);
         // It seems Intel doesn't report its name when reporting Pentium hardware
         if (strpos($info, 'Pentium') !== false && strpos($info, 'Intel') === false) {
             $info = 'Intel ' . $info;
         }
         if (substr($info, 0, 5) == 'Intel') {
             $cpu_words = explode(' ', $info);
             $cpu_words_count = count($cpu_words);
             // Convert strings like 'Intel Core i7 M 620' -> 'Intel Core i7 620M' and 'Intel Core i7 X 990' -> 'Intel Core i7 990X' to better reflect Intel product marketing names
//.........这里部分代码省略.........
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:101,代码来源:phodevi_cpu.php

示例14: cpu_load_array

 private function cpu_load_array()
 {
     // CPU load array
     $load = array();
     if (phodevi::is_linux() && is_file('/proc/stat')) {
         $stat = file_get_contents('/proc/stat');
         if ($this->cpu_to_monitor === "summary") {
             $start_line = 0;
         } else {
             if (($l = strpos($stat, $this->cpu_to_monitor)) !== false) {
                 $start_line = $l;
             } else {
                 return -1;
             }
         }
         $stat_line = substr($stat, $start_line, strpos($stat, "\n"));
         $stat_break = preg_split('/\\s+/', $stat_line);
         for ($i = 1; $i < 10; $i++) {
             array_push($load, $stat_break[$i]);
         }
     } else {
         if (phodevi::is_bsd()) {
             $load = explode(' ', phodevi_bsd_parser::read_sysctl('kern.cp_time'));
         }
     }
     return $load;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:27,代码来源:cpu_usage.php

示例15: cpu_load_array

 private static function cpu_load_array($read_core = -1)
 {
     // CPU load array
     $load = array();
     if (phodevi::is_linux() && is_file('/proc/stat')) {
         $stat = file_get_contents('/proc/stat');
         if ($read_core > -1 && ($l = strpos($stat, 'cpu' . $read_core)) !== false) {
             $start_line = $l;
         } else {
             $start_line = 0;
         }
         $stat = substr($stat, $start_line, strpos($stat, "\n"));
         $stat_break = explode(' ', $stat);
         for ($i = 1; $i < 6; $i++) {
             array_push($load, $stat_break[$i]);
         }
     } else {
         if (phodevi::is_bsd()) {
             $load = explode(' ', phodevi_bsd_parser::read_sysctl('kern.cp_time'));
         }
     }
     return $load;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:23,代码来源:cpu_usage.php


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