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);
 }
 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;
 }
 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;
 }
 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;
     }
 }
 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]);
         }
     }
 }
 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);
 }
 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));
 }
 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;
                 }
             }
         }
     }
 }
 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');
     }
 }
 public function read_sensor()
 {
     $fan_speed = -1;
     if (phodevi::is_linux()) {
         $fan_speed = $this->sys_fanspeed_linux();
     }
     return $fan_speed;
 }
 public function read_sensor()
 {
     if (phodevi::is_linux()) {
         return $this->cpu_power_linux();
     }
     return -1;
     // TODO make -1 a named constant
 }
 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);
 }
Example #13
0
 public function read_sensor()
 {
     $temp = -1;
     if (phodevi::is_linux()) {
         $temp = $this->hdd_temp_linux();
     }
     return pts_math::set_precision($temp, 2);
 }
 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);
 }
 public function read_sensor()
 {
     $swap_usage = -1;
     if (phodevi::is_linux()) {
         $swap_usage = self::swap_usage_linux();
     }
     return $swap_usage;
 }
 public function read_sensor()
 {
     $voltage = -1;
     if (phodevi::is_linux()) {
         $voltage = $this->cpu_voltage_linux();
     }
     return $voltage;
 }
 public function read_sensor()
 {
     $iowait = -1;
     if (phodevi::is_linux()) {
         $iowait = $this->sys_iowait_linux();
     }
     return $iowait;
 }
 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;
 }
Example #19
0
 public static function read_sensor()
 {
     if (phodevi::is_linux()) {
         $sensor = phodevi_linux_parser::read_sensors(array('V5', '+5V'));
     } else {
         $sensor = -1;
     }
     return $sensor;
 }
 public function needs_updated_install()
 {
     foreach (pts_types::identifiers_to_test_profile_objects($this->get_identifier(), false, true) as $test_profile) {
         if ($test_profile->test_installation == false || $test_profile->test_installation->get_installed_system_identifier() != phodevi::system_id_string() || pts_c::$test_flags & pts_c::force_install) {
             return true;
         }
     }
     return false;
 }
 private static function print_sensor($sensor, $device)
 {
     if ($sensor[0] === 'cgroup') {
         echo '- ' . phodevi::sensor_name($sensor) . PHP_EOL;
     } else {
         $sensor_object = new $sensor[2](0, $device);
         echo '- ' . phodevi::sensor_object_name($sensor_object) . ': ' . phodevi::read_sensor($sensor_object) . ' ' . phodevi::read_sensor_object_unit($sensor_object) . PHP_EOL;
     }
 }
 public static function read_sensor()
 {
     if (phodevi::is_linux()) {
         $sensor = phodevi_linux_parser::read_sensors('VCore');
     } else {
         $sensor = -1;
     }
     return $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;
 }
 public static function __run_manager_setup(&$test_run_manager)
 {
     // Verify LINUX_PERF is set, `perf` can be found, and is Linux
     if (getenv('LINUX_PERF') == 0 || !pts_client::executable_in_path('perf') || !phodevi::is_linux()) {
         return pts_module::MODULE_UNLOAD;
         // This module doesn't have anything else to do
     }
     echo PHP_EOL . 'Linux PERF Monitoring Enabled.' . PHP_EOL . PHP_EOL;
     // This module won't be too useful if you're not saving the results to see the graphs
     $test_run_manager->force_results_save();
 }
 public static function run($r)
 {
     pts_client::$display->generic_heading('Supported Sensors');
     foreach (phodevi::supported_sensors() as $sensor) {
         echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
     }
     pts_client::$display->generic_heading('Unsupported Sensors');
     foreach (phodevi::unsupported_sensors() as $sensor) {
         echo '- ' . phodevi::sensor_name($sensor) . PHP_EOL;
     }
     echo PHP_EOL;
 }
 public function restore_cache($storage_dir = null, $client_version = null)
 {
     $restore_cache = null;
     if (($this->storage_dir == $storage_dir || $storage_dir == null) && $this->client_version == $client_version) {
         if ($this->phodevi_time > time() - phodevi::system_uptime()) {
             if (md5(serialize($this->phodevi_cache)) == $this->phodevi_cs) {
                 $restore_cache = $this->phodevi_cache;
             }
         }
     }
     return $restore_cache;
 }
 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;
 }
Example #28
0
 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;
 }
 public function read_sensor()
 {
     $sensor = -1;
     if (phodevi::is_linux()) {
         if ($this->voltage_to_monitor == '12v') {
             $sensor = phodevi_linux_parser::read_sensors(array('V12', '+12V'));
         } elseif ($this->voltage_to_monitor == '5v') {
             $sensor = phodevi_linux_parser::read_sensors(array('V5', '+5V'));
         } elseif ($this->voltage_to_monitor == '3v') {
             $sensor = phodevi_linux_parser::read_sensors(array('V3.3', '+3.3V'));
         }
     }
     return $sensor;
 }
 public static function read_sensor()
 {
     $fan_speed = -1;
     if (phodevi::is_linux()) {
         $raw_fan = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/fan1_input', 'POSITIVE_NUMERIC');
         if ($raw_fan == -1) {
             $raw_fan = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/fan1_input', 'POSITIVE_NUMERIC');
         }
         if ($raw_fan != -1) {
             $fan_speed = $raw_fan;
         }
     }
     return $fan_speed;
 }