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


PHP phodevi::is_macosx方法代码示例

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


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

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

示例2: read_sensor

 public static function read_sensor()
 {
     // Determine current percentage for processor usage
     if (phodevi::is_linux() || phodevi::is_bsd()) {
         $start_load = self::cpu_load_array(-1);
         sleep(1);
         $end_load = self::cpu_load_array(-1);
         for ($i = 0; $i < count($end_load); $i++) {
             $end_load[$i] -= $start_load[$i];
         }
         $percent = ($sum = array_sum($end_load)) == 0 ? 0 : 100 - $end_load[count($end_load) - 1] * 100 / $sum;
     } else {
         if (phodevi::is_solaris()) {
             // TODO: Add support for monitoring load on a per-core basis (through mpstat maybe?)
             $info = explode(' ', pts_strings::trim_spaces(pts_arrays::last_element(explode("\n", trim(shell_exec('sar -u 1 1 2>&1'))))));
             $percent = $info[1] + $info[2];
         } else {
             if (phodevi::is_macosx()) {
                 // CPU usage for user
                 $top = shell_exec('top -n 1 -l 1 2>&1');
                 $top = substr($top, strpos($top, 'CPU usage: ') + 11);
                 $percent = substr($top, 0, strpos($top, '%'));
             } else {
                 $percent = null;
             }
         }
     }
     if (!is_numeric($percent) || $percent < 0 || $percent > 100) {
         $percent = -1;
     }
     return pts_math::set_precision($percent, 2);
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:32,代码来源:cpu_usage.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: 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

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

示例7: read_sensor

 public function read_sensor()
 {
     // Determine current percentage for core usage
     // Default core to read is the first one (number 0)
     if (phodevi::is_linux() || phodevi::is_bsd()) {
         $percent = $this->cpu_usage_linux_bsd();
     } else {
         if (phodevi::is_solaris()) {
             $percent = $this->cpu_usage_solaris();
         } else {
             if (phodevi::is_macosx()) {
                 $percent = $this->cpu_usage_macosx();
             }
         }
     }
     if (!isset($percent) || !is_numeric($percent) || $percent < 0 || $percent > 100) {
         $percent = -1;
     }
     return pts_math::set_precision($percent, 2);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:20,代码来源:cpu_usage.php

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

示例9: sw_operating_system

 public static function sw_operating_system()
 {
     if (!PTS_IS_CLIENT) {
         // TODO: Figure out why this function is sometimes called from OpenBenchmarking.org....
         return false;
     }
     // Determine the operating system release
     if (phodevi::is_linux()) {
         $vendor = phodevi_linux_parser::read_lsb_distributor_id();
         if ($vendor == null) {
             if (is_readable('/etc/os-release')) {
                 $os_release = parse_ini_file('/etc/os-release');
             } else {
                 if (is_readable('/usr/lib/os-release')) {
                     $os_release = parse_ini_file('/usr/lib/os-release');
                 } else {
                     $os_release = null;
                 }
             }
             if (isset($os_release['PRETTY_NAME']) && !empty($os_release['PRETTY_NAME'])) {
                 $vendor = $os_release['PRETTY_NAME'];
             } else {
                 if (isset($os_release['NAME']) && !empty($os_release['NAME'])) {
                     $vendor = $os_release['NAME'];
                 }
             }
         }
     } else {
         if (phodevi::is_hurd()) {
             $vendor = php_uname('v');
         } else {
             $vendor = null;
         }
     }
     $version = phodevi::read_property('system', 'os-version');
     if (!$vendor) {
         $os = null;
         // Try to detect distro for those not supplying lsb_release
         $files = pts_file_io::glob('/etc/*-version');
         for ($i = 0; $i < count($files) && $os == null; $i++) {
             $file = file_get_contents($files[$i]);
             if (trim($file) != null) {
                 $os = substr($file, 0, strpos($file, "\n"));
             }
         }
         if ($os == null) {
             $files = pts_file_io::glob('/etc/*-release');
             for ($i = 0; $i < count($files) && $os == null; $i++) {
                 $file = file_get_contents($files[$i]);
                 if (trim($file) != null) {
                     $proposed_os = substr($file, 0, strpos($file, PHP_EOL));
                     if (strpos($proposed_os, '=') == false) {
                         $os = $proposed_os;
                     }
                 } else {
                     if ($i == count($files) - 1) {
                         $os = ucwords(substr($n = basename($files[$i]), 0, strpos($n, '-')));
                     }
                 }
             }
         }
         if ($os == null && is_file('/etc/release')) {
             $file = file_get_contents('/etc/release');
             $os = substr($file, 0, strpos($file, "\n"));
         }
         if ($os == null && is_file('/etc/palm-build-info')) {
             // Palm / webOS Support
             $os = phodevi_parser::parse_equal_delimited_file('/etc/palm-build-info', 'PRODUCT_VERSION_STRING');
         }
         if ($os == null) {
             if (phodevi::is_windows()) {
                 $os = trim(exec('ver'));
             }
             if (is_file('/etc/debian_version')) {
                 $os = 'Debian ' . php_uname('s') . ' ' . ucwords(pts_file_io::file_get_contents('/etc/debian_version'));
             } else {
                 $os = php_uname('s');
             }
         } else {
             if (strpos($os, ' ') === false) {
                 // The OS string is only one word, likely a problem...
                 if (is_file('/etc/arch-release') && stripos($os, 'Arch') === false) {
                     // On at least some Arch installs (ARM) the file is empty so would have missed above check
                     $os = trim('Arch Linux ' . $os);
                 }
             }
         }
     } else {
         if (stripos($vendor, $version) === false) {
             $os = $vendor . ' ' . $version;
         } else {
             $os = $vendor;
         }
     }
     if (($break_point = strpos($os, ':')) > 0) {
         $os = substr($os, $break_point + 1);
     }
     if (phodevi::is_macosx()) {
         $os = phodevi_osx_parser::read_osx_system_profiler('SPSoftwareDataType', 'SystemVersion');
     }
//.........这里部分代码省略.........
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:101,代码来源:phodevi_system.php

示例10: motherboard_string

 public static function motherboard_string()
 {
     // Returns the motherboard / system model name or number
     $info = null;
     if (phodevi::is_macosx()) {
         $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'ModelName');
     } else {
         if (phodevi::is_solaris()) {
             $manufacturer = phodevi_solaris_parser::read_sun_ddu_dmi_info(array('MotherBoardInformation,Manufacturer', 'SystemInformation,Manufacturer'));
             $product = phodevi_solaris_parser::read_sun_ddu_dmi_info(array('MotherBoardInformation,Product', 'SystemInformation,Product', 'SystemInformation,Model'));
             if (count($manufacturer) == 1 && count($product) == 1) {
                 $info = $manufacturer[0] . ' ' . $product[0];
             }
         } else {
             if (phodevi::is_bsd()) {
                 $vendor = phodevi_bsd_parser::read_kenv('smbios.system.maker');
                 $product = phodevi_bsd_parser::read_kenv('smbios.system.product');
                 $version = phodevi_bsd_parser::read_kenv('smbios.system.version');
                 // for at least Lenovo ThinkPads this is where it displays ThinkPad model
                 if ($vendor != null && ($product != null || $version != null)) {
                     $info = $vendor . ' ' . $product . ' ' . $version;
                 } else {
                     if (($vendor = phodevi_bsd_parser::read_sysctl('hw.vendor')) != false && ($version = phodevi_bsd_parser::read_sysctl(array('hw.version', 'hw.product'))) != false) {
                         $info = trim($vendor . ' ' . $version);
                     } else {
                         if (($acpi = phodevi_bsd_parser::read_sysctl('dev.acpi.0.%desc')) != false) {
                             $info = trim($acpi);
                         }
                     }
                 }
             } else {
                 if (phodevi::is_linux()) {
                     $vendor = phodevi_linux_parser::read_sys_dmi(array('board_vendor', 'sys_vendor'));
                     $name = phodevi_linux_parser::read_sys_dmi(array('board_name', 'product_name'));
                     $version = phodevi_linux_parser::read_sys_dmi(array('board_version', 'product_version'));
                     if ($vendor != false && $name != false) {
                         $info = strpos($name . ' ', $vendor . ' ') === false ? $vendor . ' ' : null;
                         $info .= $name;
                         if ($version != false && strpos($info, $version) === false && pts_strings::string_only_contains($version, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL)) {
                             $info .= (substr($version, 0, 1) == 'v' ? ' ' : ' v') . $version;
                         }
                     }
                     if (empty($info)) {
                         if ($info == null) {
                             $hw_string = phodevi_linux_parser::read_cpuinfo('Hardware');
                             if (count($hw_string) == 1) {
                                 $info = $hw_string[0];
                             }
                         }
                         $bios_vendor = phodevi_linux_parser::read_sys_dmi('bios_vendor');
                         $bios_version = phodevi_linux_parser::read_sys_dmi('bios_version');
                         if ($bios_vendor != null) {
                             $info = $bios_vendor . ' ' . $bios_version;
                         }
                         if ($info == null) {
                             $hw_string = phodevi_linux_parser::read_cpuinfo('machine');
                             if (count($hw_string) == 1) {
                                 $info = $hw_string[0];
                             }
                         }
                     }
                     if (empty($info)) {
                         $info = phodevi_linux_parser::read_sys_dmi('product_name');
                     }
                     if (empty($info) && is_file('/sys/bus/soc/devices/soc0/machine')) {
                         $info = pts_file_io::file_get_contents('/sys/bus/soc/devices/soc0/machine');
                     }
                     if (empty($info)) {
                         // Works on the MIPS Creator CI20
                         $hardware = phodevi_linux_parser::read_cpuinfo('Hardware');
                         if (!empty($hardware)) {
                             $info = array_pop($hardware);
                         }
                     }
                 } else {
                     if (phodevi::is_windows()) {
                         $info = phodevi_windows_parser::read_cpuz('Mainboard Model', null);
                     }
                 }
             }
         }
     }
     if ((strpos($info, 'Mac ') !== false || strpos($info, 'MacBook') !== false) && strpos($info, 'Apple') === false) {
         $info = 'Apple ' . $info;
     }
     // ensure words aren't repeated (e.g. VMware VMware Virtual and MSI MSI X58M (MS-7593))
     $info = implode(' ', array_unique(explode(' ', $info)));
     return $info;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:89,代码来源:phodevi_motherboard.php

示例11: chipset_string

 public static function chipset_string()
 {
     $info = false;
     if (phodevi::is_macosx()) {
         $sb_vendor = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'Vendor');
         $sb_product = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'Product');
         if ($sb_product == 'SSD') {
             $sb_product = null;
         }
         if (($cut_point = strpos($sb_product, ' ')) > 0) {
             $sb_product = substr($sb_product, 0, $cut_point);
         }
         // TODO: Can't find Northbridge
         $info = $sb_vendor . ' ' . $sb_product;
     } else {
         if (phodevi::is_windows()) {
             $info = phodevi_windows_parser::read_cpuz('Northbridge', null);
             if ($info != null) {
                 if (($e = strpos($info, 'rev')) !== false) {
                     $info = substr($info, 0, $e);
                 }
                 $info = trim($info);
             }
         } else {
             if (phodevi::is_solaris()) {
                 // Vendor Detection
                 $vendor_possible_udis = array('/org/freedesktop/Hal/devices/pci_0_0/pci_ide_3_2_0', '/org/freedesktop/Hal/devices/pci_0_0/pci_ide_1f_1_1');
                 $info = phodevi_solaris_parser::read_hal_property($vendor_possible_udis, 'info.vendor');
                 // TODO: Northbridge and Southbridge Detection For Solaris
             } else {
                 if (phodevi::is_linux() || phodevi::is_hurd()) {
                     $info = phodevi_linux_parser::read_pci(array('RAM memory', 'Host bridge'));
                     if (count(explode(' ', $info)) == 1) {
                         $bridge = phodevi_linux_parser::read_pci(array('Bridge', 'PCI bridge'));
                         if (!empty($bridge)) {
                             $match = false;
                             $break_words = array('Ethernet', 'PCI', 'High', 'USB');
                             for ($i = 0; $i < count($break_words) && !$match; $i++) {
                                 if (($pos = strpos($bridge, $break_words[$i])) > 0) {
                                     $bridge = trim(substr($bridge, 0, $pos));
                                     $info = $bridge;
                                     $match = true;
                                 }
                             }
                         }
                     }
                     if (!isset($bridge) || !empty($bridge)) {
                         // Attempt to detect Southbridge (if applicable)
                         $southbridge = phodevi_linux_parser::read_pci(array('ISA bridge', 'SATA controller'), false);
                         $southbridge_clean = null;
                         if (($start_cut = strpos($southbridge, '(')) > 0 && ($end_cut = strpos($southbridge, ')', $start_cut + 1)) > 0) {
                             $southbridge_extract = substr($southbridge, $start_cut + 1, $end_cut - $start_cut - 1);
                             if (strpos($southbridge_extract, 'rev') === false) {
                                 $southbridge_extract = explode(' ', $southbridge_extract);
                                 $southbridge_clean = $southbridge_extract[0];
                             } else {
                                 if (($s = strpos($southbridge, 'ICH')) > 0) {
                                     $southbridge_extract = substr($southbridge, $s);
                                     $southbridge_clean = substr($southbridge_extract, 0, strpos($southbridge_extract, ' '));
                                 }
                             }
                         } else {
                             if (($start_cut = strpos($southbridge, 'SB')) !== false) {
                                 $southbridge_extract = substr($southbridge, $start_cut);
                                 $southbridge_clean = substr($southbridge_extract, 0, strpos($southbridge_extract, ' '));
                             }
                         }
                         if (!empty($southbridge_clean) && $southbridge_clean != 'SB') {
                             $info .= ' + ' . $southbridge_clean;
                         }
                     }
                 }
             }
         }
     }
     return $info;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:77,代码来源:phodevi_chipset.php

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

示例13: __startup

 public static function __startup()
 {
     $halt_screensaver = pts_module::read_variable('HALT_SCREENSAVER');
     if (!empty($halt_screensaver) && !pts_strings::string_bool($halt_screensaver) || phodevi::read_property('system', 'display-server') == null) {
         return pts_module::MODULE_UNLOAD;
     }
     if (phodevi::is_macosx()) {
         // Right now there doesn't appear to be a better way to disable OS X screensaver automatically...
         return pts_module::MODULE_UNLOAD;
     }
     // GNOME Screensaver?
     if (($gt = pts_client::executable_in_path('gconftool')) != false || ($gt = pts_client::executable_in_path('gconftool-2')) != false) {
         self::$gnome_gconftool = $gt;
     }
     if (self::$gnome_gconftool != false) {
         $is_gnome_screensaver_enabled = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-screensaver/idle_activation_enabled 2>&1'));
         if ($is_gnome_screensaver_enabled == 'true') {
             // Stop the GNOME Screensaver
             shell_exec(self::$gnome_gconftool . ' --type bool --set /apps/gnome-screensaver/idle_activation_enabled false 2>&1');
             self::$gnome2_screensaver_halted = true;
         }
         $sleep_display_ac = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-power-manager/timeout/sleep_display_ac 2>&1'));
         if ($sleep_display_ac != 0) {
             // Don't sleep the display when on AC power
             shell_exec(self::$gnome_gconftool . ' --type int --set /apps/gnome-power-manager/timeout/sleep_display_ac 0 2>&1');
             self::$sleep_display_ac = $sleep_display_ac;
         }
     }
     if (pts_client::executable_in_path('qdbus')) {
         // KDE Screensaver?
         $is_kde_screensaver_enabled = trim(shell_exec('qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive 2>&1'));
         if ($is_kde_screensaver_enabled == 'true') {
             // Stop the KDE Screensaver
             shell_exec('qdbus org.freedesktop.ScreenSaver  /ScreenSaver SimulateUserActivity 2>&1');
             self::$kde_screensaver_halted = true;
         }
     }
     if (self::$gnome2_screensaver_halted == false && pts_client::executable_in_path('gsettings')) {
         // GNOME 3.x Screensaver?
         $is_gnome3_screensaver_enabled = trim(shell_exec('gsettings get org.gnome.desktop.session idle-delay 2>&1'));
         if (stripos($is_gnome3_screensaver_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_screensaver_enabled) > 0) {
             // Stop the GNOME 3.x Screensaver
             shell_exec('gsettings set org.gnome.desktop.session idle-delay 0 2>&1');
             self::$gnome3_screensaver_halted = pts_strings::last_in_string($is_gnome3_screensaver_enabled);
         }
         // GNOME 3.x Lock-Screen
         $is_gnome3_lockscreen_enabled = trim(shell_exec('gsettings get org.gnome.desktop.lockdown disable-lock-screen 2>&1'));
         if (stripos($is_gnome3_lockscreen_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_lockscreen_enabled) == 'false') {
             // Stop the GNOME 3.x Lock Screen
             shell_exec('gsettings set org.gnome.desktop.lockdown disable-lock-screen true 2>&1');
             self::$gnome3_lockscreen_disabled = true;
         }
         // This GNOME3 GSettings method is deprecated on distributions like GNOME 3.8 with Fedora 19
         $is_gnome3_screensaver_enabled_old = trim(shell_exec('gsettings get org.gnome.desktop.screensaver idle-activation-enabled 2>&1'));
         if ($is_gnome3_screensaver_enabled_old == 'true') {
             // Stop the GNOME 3.x Screensaver
             shell_exec('gsettings set org.gnome.desktop.screensaver idle-activation-enabled false 2>&1');
             self::$gnome3_screensaver_halted_old = true;
         }
         // GNOME 3.x Sleep Dispaly?
         $is_gnome3_sleep = trim(shell_exec('gsettings get org.gnome.settings-daemon.plugins.power sleep-display-ac 2>&1'));
         if ($is_gnome3_sleep > 0) {
             // Stop the GNOME 3.x Display Sleep
             shell_exec('gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac 0 2>&1');
             self::$sleep_display_ac = $is_gnome3_sleep;
         }
     }
     if (pts_client::executable_in_path('xfconf-query')) {
         $is_xfce_screensaver_enabled = stripos(shell_exec('xfconf-query -c xfce4-session -p /startup/screensaver/enabled 2>&1'), 'false') !== false;
         if ($is_xfce_screensaver_enabled) {
             shell_exec('xfconf-query -c xfce4-session -n -t bool -p /startup/screensaver/enabled -s false 2>&1');
             self::$xfce_screensaver_halted = true;
         }
     }
     if (getenv('DISPLAY') != false && (self::$xset = pts_client::executable_in_path('xset'))) {
         shell_exec('xset s off 2>&1');
     } else {
         if (getenv('DISPLAY') == false && pts_client::executable_in_path('setterm')) {
             shell_exec('setterm -powersave off -blank 0 2>&1');
         }
     }
     if (self::$gnome2_screensaver_halted || self::$gnome3_screensaver_halted || self::$gnome3_screensaver_halted_old || self::$kde_screensaver_halted || self::$xfce_screensaver_halted) {
         self::$screensaver_halted = true;
     }
     if (($xdg = pts_client::executable_in_path('xdg-screensaver')) == false) {
         self::$xdg_screensaver_available = $xdg;
     }
     if ($xscreensaver = pts_client::executable_in_path('xscreensaver-command')) {
         shell_exec($xscreensaver . ' -exit 2>&1');
     }
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:91,代码来源:toggle_screensaver.php

示例14: memory_capacity

 public static function memory_capacity()
 {
     // Returns physical memory capacity
     if (isset(phodevi::$vfs->meminfo)) {
         $info = phodevi::$vfs->meminfo;
         $info = substr($info, strpos($info, 'MemTotal:') + 9);
         $info = intval(trim(substr($info, 0, strpos($info, 'kB'))));
         $info = floor($info / 1024);
         if (is_numeric($info) && $info > 950) {
             if ($info > 4608) {
                 $info = ceil($info / 1024) * 1024;
             } else {
                 if ($info > 1536) {
                     $info = ceil($info / 512) * 512;
                 } else {
                     $info = ceil($info / 256) * 256;
                 }
             }
         }
     } else {
         if (phodevi::is_solaris()) {
             $info = shell_exec('prtconf 2>&1 | grep Memory');
             $info = substr($info, strpos($info, ':') + 2);
             $info = substr($info, 0, strpos($info, 'Megabytes'));
         } else {
             if (phodevi::is_bsd()) {
                 $mem_size = phodevi_bsd_parser::read_sysctl('hw.physmem');
                 if ($mem_size == false) {
                     $mem_size = phodevi_bsd_parser::read_sysctl('hw.realmem');
                 }
                 $info = ceil(floor($mem_size / 1048576) / 256) * 256;
             } else {
                 if (phodevi::is_macosx()) {
                     $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'Memory');
                     $info = explode(' ', $info);
                     $info = isset($info[1]) && $info[1] == 'GB' ? $info[0] * 1024 : $info[0];
                 } else {
                     if (phodevi::is_windows()) {
                         $info = phodevi_windows_parser::read_cpuz('Memory Size', null);
                         if ($info != null) {
                             if (($e = strpos($info, ' MBytes')) !== false) {
                                 $info = substr($info, 0, $e);
                             }
                             $info = trim($info);
                         }
                     } else {
                         $info = null;
                     }
                 }
             }
         }
     }
     return $info;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:54,代码来源:phodevi_memory.php

示例15: test_profile_system_compatibility_check

 public static function test_profile_system_compatibility_check(&$test_profile, $report_errors = false)
 {
     $valid_test_profile = true;
     $test_type = $test_profile->get_test_hardware_type();
     $skip_tests = pts_client::read_env('SKIP_TESTS') ? pts_strings::comma_explode(pts_client::read_env('SKIP_TESTS')) : false;
     $skip_test_subsystems = pts_client::read_env('SKIP_TESTING_SUBSYSTEMS') ? pts_strings::comma_explode(strtolower(pts_client::read_env('SKIP_TESTING_SUBSYSTEMS'))) : false;
     $display_driver = phodevi::read_property('system', 'display-driver');
     $gpu = phodevi::read_name('gpu');
     if ($test_profile->is_supported(false) == false) {
         $valid_test_profile = false;
     } else {
         if ($test_type == 'Graphics' && pts_client::read_env('DISPLAY') == false && pts_client::read_env('WAYLAND_DISPLAY') == false && phodevi::is_windows() == false && phodevi::is_macosx() == false) {
             $report_errors && pts_client::$display->test_run_error('No display server was found, cannot run ' . $test_profile);
             $valid_test_profile = false;
         } else {
             if ($test_type == 'Graphics' && in_array($display_driver, array('vesa', 'nv', 'cirrus')) && stripos($gpu, 'LLVM') === false) {
                 // These display drivers end up being in known configurations without 3D hardware support so unless an LLVM-based string is reported as the GPU, don't advertise 3D tests
                 $report_errors && pts_client::$display->test_run_error('3D acceleration support not available, cannot run ' . $test_profile);
                 $valid_test_profile = false;
             } else {
                 if ($test_type == 'Disk' && stripos(phodevi::read_property('system', 'filesystem'), 'SquashFS') !== false) {
                     $report_errors && pts_client::$display->test_run_error('Running on a RAM-based live file-system, cannot run ' . $test_profile);
                     $valid_test_profile = false;
                 } else {
                     if (pts_client::read_env('NO_' . strtoupper($test_type) . '_TESTS') || $skip_tests && (in_array($test_profile, $skip_tests) || in_array($test_type, $skip_tests) || in_array($test_profile->get_identifier(false), $skip_tests) || in_array($test_profile->get_identifier_base_name(), $skip_tests))) {
                         $report_errors && pts_client::$display->test_run_error('Due to a pre-set environmental variable, skipping ' . $test_profile);
                         $valid_test_profile = false;
                     } else {
                         if ($skip_test_subsystems && in_array(strtolower($test_profile->get_test_hardware_type()), $skip_test_subsystems)) {
                             $report_errors && pts_client::$display->test_run_error('Due to a pre-set environmental variable, skipping ' . $test_profile);
                             $valid_test_profile = false;
                         } else {
                             if ($test_profile->is_root_required() && $this->batch_mode && phodevi::is_root() == false) {
                                 $report_errors && pts_client::$display->test_run_error('Cannot run ' . $test_profile . ' in batch mode as root access is required.');
                                 $valid_test_profile = false;
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($valid_test_profile == false && pts_client::read_env('SKIP_ALL_TEST_SUPPORT_CHECKS')) {
         $report_errors && pts_client::$display->test_run_error('SKIP_ALL_TEST_SUPPORT_CHECKS is set for ' . $test_profile . '.');
         $valid_test_profile = true;
     }
     return $valid_test_profile;
 }
开发者ID:Jeni4,项目名称:phoronix-test-suite,代码行数:48,代码来源:pts_test_run_manager.php


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