本文整理汇总了PHP中phodevi::read_property方法的典型用法代码示例。如果您正苦于以下问题:PHP phodevi::read_property方法的具体用法?PHP phodevi::read_property怎么用?PHP phodevi::read_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phodevi
的用法示例。
在下文中一共展示了phodevi::read_property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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;
}
}
}
}
}
示例2: 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));
}
示例3: __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);
}
示例4: device_notes
public static function device_notes()
{
$notes = array();
if (($disk_scheduler = phodevi::read_property('disk', 'scheduler')) != null) {
array_push($notes, 'Disk Scheduler: ' . $disk_scheduler);
}
return $notes;
}
示例5: cpu_string
public static function cpu_string()
{
$model = phodevi::read_property('cpu', 'model');
// Append the processor frequency to string
if (($freq = phodevi::read_property('cpu', 'default-frequency')) > 0) {
$model = str_replace($freq . 'GHz', null, $model);
// we'll replace it if it's already in the string
$model .= ' @ ' . $freq . 'GHz';
}
$core_count = phodevi::read_property('cpu', 'core-count');
return $model . ' (' . pts_strings::plural_handler($core_count, 'Core') . ')';
}
示例6: render_page_process
public static function render_page_process($PATH)
{
$component_modal = array('CPU' => array(phodevi::read_property('cpu', 'model'), phodevi::read_property('cpu', 'core-count') . ' Logical Cores - ' . phodevi::read_property('cpu', 'default-frequency') . ' GHz'), 'Motherboard' => array(phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('chipset', 'identifier')), 'Memory' => array(phodevi::read_property('memory', 'identifier'), null), 'Disk' => array(phodevi::read_property('disk', 'identifier'), phodevi::read_property('disk', 'scheduler')), 'Graphics' => array(phodevi::read_property('gpu', 'model'), phodevi::read_property('gpu', 'frequency') . ' - ' . phodevi::read_property('monitor', 'identifier')));
echo '<div style="overflow: hidden; text-align: center; height: inherit; vertical-align: center; margin: auto auto;">';
foreach ($component_modal as $component) {
echo '<div class="pts_system_component_bar"><h1>' . $component[0] . '</h1><p>' . $component[1] . '</p></div>';
}
echo '</div>';
echo '<div id="large_svg_graphs" style="margin: 10px 0; text-align: center;"></div>';
echo '<div id="system_log_viewer"><select id="log_viewer_selector" onchange="javascript:log_viewer_change(); return true;"></select><div id="system_log_display"></div></div>';
echo '<script text="text/javascript">
pts_web_socket.submit_event("available-system-logs", "available_system_logs", "update_system_log_viewer");
pts_web_socket.submit_event("user-large-svg-system-graphs", "large_svg_graphs", "update_large_svg_graph_space");
setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-large-svg-system-graphs"); }},1000);
</script>';
}
示例7: read_sun_ddu_dmi_info
public static function read_sun_ddu_dmi_info($find_objects, $args = null)
{
// Read Sun's Device Driver Utility for OpenSolaris
$values = array();
if (in_array(phodevi::read_property('system', 'kernel-architecture'), array('i686', 'x86_64'))) {
$dmi_info = '/usr/ddu/bin/i386/dmi_info';
} else {
$dmi_info = '/usr/ddu/bin/sparc/dmi_info';
}
if (is_executable($dmi_info) || is_executable($dmi_info = '/usr/ddu/bin/dmi_info')) {
$info = shell_exec($dmi_info . ' ' . $args . ' 2>&1');
$lines = explode("\n", $info);
$find_objects = pts_arrays::to_array($find_objects);
for ($i = 0; $i < count($find_objects) && count($values) == 0; $i++) {
$objects = pts_strings::comma_explode($find_objects[$i]);
$this_section = null;
if (count($objects) == 2) {
$section = $objects[0];
$object = $objects[1];
} else {
$section = null;
$object = $objects[0];
}
foreach ($lines as $line) {
$line = pts_strings::colon_explode($line);
$line_object = isset($line[0]) ? str_replace(' ', null, $line[0]) : null;
$this_value = count($line) > 1 ? $line[1] : null;
if (empty($this_value) && !empty($section)) {
$this_section = $line_object;
}
if ($line_object == $object && ($this_section == $section || pts_strings::proximity_match($section, $this_section)) && !empty($this_value) && $this_value != 'Unknown') {
array_push($values, $this_value);
}
}
}
}
return $values;
}
示例8: init
public static function init()
{
self::$flags = 0;
self::$os_identifier_sha1 = sha1(phodevi::read_property('system', 'vendor-identifier'));
self::$is_live_cd = 1 << 1;
self::$no_network_communication = 1 << 2;
self::$no_openbenchmarking_reporting = 1 << 3;
self::$user_agreement_skip = 1 << 4;
self::$skip_md5_checks = 1 << 5;
self::$remove_test_on_completion = 1 << 6;
self::$no_phodevi_cache = 1 << 7;
self::$no_external_dependencies = 1 << 8;
self::$upload_to_openbenchmarking = 1 << 9;
switch (self::$os_identifier_sha1) {
case 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc':
// Moscow 2011-04 client
self::$flags = self::$is_live_cd | self::$no_network_communication | self::$no_openbenchmarking_reporting | self::$user_agreement_skip | self::$skip_md5_checks | self::$remove_test_on_completion;
break;
}
if (pts_client::read_env('NO_FILE_HASH_CHECKS') != false || pts_client::read_env('NO_MD5_CHECKS') != false) {
self::$flags |= self::$skip_md5_checks;
}
if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/RemoveTestInstallOnCompletion', 'FALSE')) {
self::$flags |= self::$remove_test_on_completion;
}
if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/AlwaysUploadResultsToOpenBenchmarking', 'FALSE')) {
self::$flags |= self::$upload_to_openbenchmarking;
}
if (pts_client::read_env('NO_PHODEVI_CACHE') != false) {
self::$flags |= self::$no_phodevi_cache;
}
if (pts_client::read_env('NO_EXTERNAL_DEPENDENCIES') != false || pts_client::read_env('SKIP_EXTERNAL_DEPENDENCIES') == 1) {
// NO_EXTERNAL_DEPENDENCIES was deprecated in PTS 3.6 and replaced by more versatile SKIP_EXTERNAL_DEPENDENCIES
self::$flags |= self::$no_external_dependencies;
}
}
示例9: memory_string
//.........这里部分代码省略.........
} else {
if (phodevi::is_linux()) {
$mem_size = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Size', false, array('Not Installed', 'No Module Installed', 'Undefined'));
$mem_speed = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Speed', true, array('Unknown', 'Undefined'));
$mem_type = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Type', true, array('Unknown', 'Other', 'Flash', 'Undefined'));
$mem_manufacturer = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Manufacturer', true, array('Unknown', 'Undefined'));
$mem_part = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Part Number', true, array('Unknown', 'Undefined'));
}
}
}
}
if (is_array($mem_type)) {
$mem_type = array_pop($mem_type);
}
if ($mem_size != false && (!is_array($mem_size) || count($mem_size) != 0)) {
for ($i = 0; $i < count($mem_size); $i++) {
switch (substr($mem_size[$i], -1)) {
case 'K':
// looks like sometimes Solaris now reports flash chip as memory. its string ends with K
unset($mem_size[$i]);
unset($mem_speed[$i]);
unset($mem_type[$i]);
break;
case 'M':
// report megabytes as MB, just not M, as on Solaris
$mem_size[$i] .= 'B';
break;
case 'B':
if (strtolower(substr($mem_size[$i], -2, 1)) == 'k') {
// some hardware on Linux via dmidecode reports flash chips
unset($mem_size[$i]);
//unset($mem_speed[$i]);
//unset($mem_type[$i]);
}
break;
}
}
foreach ($mem_size as $i => $mem_stick) {
if (!is_numeric(substr($mem_stick, 0, 3)) && stripos($mem_stick, 'GB') == false) {
// If the memory size isn't at least three digits (basically 128MB+), chances are something is wrong, i.e. reporting flash chip from dmidecode, so get rid of it.
unset($mem_size[$i]);
}
}
$mem_count = count($mem_size);
if (!empty($mem_type)) {
if (($cut = strpos($mem_type, ' ')) > 0) {
$mem_type = substr($mem_type, 0, $cut);
}
if (!in_array($mem_type, array('Other')) && (pts_strings::keep_in_string($mem_type, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER) == $mem_type || phodevi::is_windows())) {
$mem_prefix = $mem_type;
}
} else {
$mem_prefix = null;
}
if (!empty($mem_speed)) {
if (($cut = strpos($mem_speed, ' (')) > 0) {
$mem_speed = substr($mem_speed, 0, $cut);
}
if (!empty($mem_prefix)) {
$mem_prefix .= '-';
}
$mem_prefix .= str_replace(' ', null, $mem_speed);
}
// TODO: Allow a combination of both functions below, so like 2 x 2GB + 3 x 1GB DDR2-800
if ($mem_count > 1 && count(array_unique($mem_size)) > 1) {
$mem_string = implode(' + ', $mem_size) . ' ' . $mem_prefix;
} else {
if ($mem_count * $mem_size[0] != phodevi::read_property('memory', 'capacity') && phodevi::read_property('memory', 'capacity') % $mem_size[0] == 0) {
// This makes sure the correct number of RAM modules is reported...
// On at least Linux with dmidecode on an AMD Opteron multi-socket setup it's only showing the data for one socket
if ($mem_size[0] < 1024) {
$mem_size[0] *= 1024;
}
$mem_count = phodevi::read_property('memory', 'capacity') / $mem_size[0];
}
$product_string = null;
if (isset($mem_manufacturer[2]) && ctype_alpha($mem_manufacturer[0]) && stripos($mem_manufacturer, 'manufacturer') === false && stripos($mem_manufacturer, 'part') === false && stripos($mem_manufacturer, 'module') === false && stripos($mem_manufacturer, 'dimm') === false && isset($mem_manufacturer[2]) && ctype_alpha($mem_manufacturer)) {
$product_string .= ' ' . $mem_manufacturer;
}
if (isset($mem_part[2]) && stripos($mem_part, 'part') === false && stripos($mem_part, 'module') === false && stripos($mem_part, 'dimm') === false && substr($mem_part, 0, 2) != '0x' && !isset($mem_part[24]) && ctype_alnum($mem_part)) {
$product_string .= ' ' . $mem_part;
}
if (is_numeric($mem_size[0]) && stripos($mem_size[0], 'b') === false) {
if ($mem_size >= 1024) {
$mem_size[0] .= ' MB';
} else {
$mem_size[0] .= ' GB';
}
}
$mem_string = $mem_count . ' x ' . $mem_size[0] . ' ' . $mem_prefix . $product_string;
}
}
if (empty($mem_string)) {
$mem_string = phodevi::read_property('memory', 'capacity');
if ($mem_string != null) {
$mem_string .= 'MB';
}
}
return trim($mem_string);
}
示例10: run
//.........这里部分代码省略.........
http {
client_body_temp_path /tmp/client_body;
fastcgi_temp_path /tmp/fastcgi_temp;
proxy_temp_path /tmp/proxy_temp;
scgi_temp_path /tmp/scgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 180;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
index index.php;
server {
listen ' . $web_port . ';
listen [::]:' . $web_port . ' default ipv6only=on;
access_log /tmp/access.log;
error_log /tmp/error.log;
root ' . PTS_CORE_PATH . 'phoromatic/public_html;
index index.php;
try_files $uri $uri/ /index.php;
location / {
autoindex on;
}
location ~ \\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_split_path_info ^(.+\\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
}';
$nginx_conf_file = tempnam(PTS_USER_PATH, 'nginx_conf_');
file_put_contents($nginx_conf_file, $nginx_conf);
$server_launcher .= 'nginx -c ' . $nginx_conf_file . PHP_EOL . 'rm -f ' . $nginx_conf_file . PHP_EOL;
} else {
if (($mongoose = pts_client::executable_in_path('mongoose')) && ($php_cgi = pts_client::executable_in_path('php-cgi'))) {
// Mongoose Embedded Web Server
$server_launcher .= $mongoose . ' -p ' . $web_port . ' -r ' . PTS_CORE_PATH . 'phoromatic/public_html/ -I ' . $php_cgi . ' -i index.php > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL;
//2> /dev/null
} else {
if (strpos(getenv('PHP_BIN'), 'hhvm')) {
echo PHP_EOL . 'Unfortunately, the HHVM built-in web server has abandoned upstream. Users will need to use the PHP binary or other alternatives.' . PHP_EOL . PHP_EOL;
return;
} else {
// PHP Web Server
$server_launcher .= getenv('PHP_BIN') . ' -S ' . $server_ip . ':' . $web_port . ' -t ' . PTS_CORE_PATH . 'phoromatic/public_html/ > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL;
//2> /dev/null
}
}
}
$server_launcher .= 'http_server_pid=$!' . PHP_EOL;
$server_launcher .= 'sleep 1' . PHP_EOL;
$server_launcher .= 'echo "The Phoromatic Web Interface Is Accessible At: http://localhost:' . $web_port . '"' . PHP_EOL;
$pts_logger->log('Starting HTTP process @ http://localhost:' . $web_port);
// Avahi for zeroconf network discovery support
if (pts_config::read_user_config('PhoronixTestSuite/Options/Server/AdvertiseServiceZeroConf', 'TRUE')) {
if (is_dir('/etc/avahi/services') && is_writable('/etc/avahi/services')) {
file_put_contents('/etc/avahi/services/phoromatic-server.service', '<?xml version="1.0" standalone=\'no\'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">phoromatic-server-%h</name>
<service>
<type>_http._tcp</type>
<port>' . $web_port . '</port>
</service>
</service-group>');
} else {
if (pts_client::executable_in_path('avahi-publish')) {
$hostname = phodevi::read_property('system', 'hostname');
$hostname = $hostname == null ? rand(0, 99) : $hostname;
$server_launcher .= 'avahi-publish -s phoromatic-server-' . $hostname . ' _http._tcp ' . $web_port . ' "Phoronix Test Suite Phoromatic" > /dev/null 2> /dev/null &' . PHP_EOL;
$server_launcher .= 'avahi_publish_pid=$!' . PHP_EOL;
}
}
}
// Wait for input to shutdown process..
if (!PTS_IS_DAEMONIZED_SERVER_PROCESS) {
$server_launcher .= PHP_EOL . 'echo -n "Press [ENTER] to kill server..."' . PHP_EOL;
$server_launcher .= PHP_EOL . 'read var_name';
} else {
$server_launcher .= PHP_EOL . 'while [ ! -f "/var/lib/phoronix-test-suite/end-phoromatic-server" ];';
$server_launcher .= PHP_EOL . 'do';
$server_launcher .= PHP_EOL . 'sleep 1';
$server_launcher .= PHP_EOL . 'done';
$server_launcher .= PHP_EOL . 'rm -f /var/lib/phoronix-test-suite/end-phoromatic-server' . PHP_EOL;
}
// Shutdown / Kill Servers
$server_launcher .= PHP_EOL . 'kill $http_server_pid';
$server_launcher .= PHP_EOL . 'kill $websocket_server_pid';
$server_launcher .= PHP_EOL . 'kill $event_server_pid';
if (is_writable('/etc/avahi/services') && is_file('/etc/avahi/services/phoromatic-server.service')) {
$server_launcher .= PHP_EOL . 'rm -f /etc/avahi/services/phoromatic-server.service';
} else {
$server_launcher .= PHP_EOL . 'kill $avahi_publish_pid';
}
$server_launcher .= PHP_EOL . 'rm -f ~/.phoronix-test-suite/run-lock*';
file_put_contents(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/phoromatic-server-launcher', $server_launcher);
}
示例11: 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;
}
示例12: run
public static function run($r)
{
pts_openbenchmarking::refresh_repository_lists();
pts_client::$display->generic_heading('Interactive Benchmarking');
echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
$reboot_on_exit = false;
do {
$options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
if (count(pts_client::saved_test_results()) > 0) {
$options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
}
$options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
$response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
switch ($response) {
case 'RUN_TEST':
$supported_tests = pts_openbenchmarking::available_tests();
$supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
$longest_title_length = 0;
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile->get_title() == null) {
unset($supported_tests[$i]);
continue;
}
$longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
}
$t = array();
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile instanceof pts_test_profile) {
$t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
}
}
$supported_tests = $t;
asort($supported_tests);
$tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
$tests_to_run = explode(',', $tests_to_run);
pts_test_installer::standard_install($tests_to_run);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($tests_to_run);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'RUN_SUITE':
$possible_suites = pts_openbenchmarking::available_suites();
foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
array_push($possible_suites, 'pts/' . $subsystem);
}
$suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
foreach (explode(',', $suites_to_run) as $suite_to_run) {
pts_test_installer::standard_install($suite_to_run);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($suite_to_run);
}
break;
case 'SELECT_DRIVE_MOUNT':
self::select_drive_mount();
break;
case 'RUN_SYSTEM_TEST':
pts_client::$display->generic_heading('System Test');
$system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
pts_test_installer::standard_install($system_tests);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($system_tests);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'SHOW_INFO':
pts_client::$display->generic_heading('System Software / Hardware Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
break;
case 'SHOW_SENSORS':
pts_client::$display->generic_heading('Detected System Sensors');
foreach (phodevi::supported_sensors() as $sensor) {
echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
}
break;
case 'SET_RUN_COUNT':
$run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false);
putenv('FORCE_TIMES_TO_RUN=' . trim($run_count));
break;
case 'BACKUP_RESULTS_TO_USB':
pts_client::$display->generic_heading('Backing Up Test Results');
foreach (pts_file_io::glob('/media/*') as $media_dir) {
if (!is_writable($media_dir)) {
echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL;
continue;
}
echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL;
pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/');
break;
}
break;
}
echo PHP_EOL . PHP_EOL;
} while ($response != 'EXIT');
if ($reboot_on_exit) {
if (is_dir('/media/pts-auto-mount')) {
pts_file_io::delete('/media/pts-auto-mount/pts', null, true);
//.........这里部分代码省略.........
示例13: sw_display_driver
public static function sw_display_driver($with_version = true)
{
if (phodevi::is_windows()) {
return null;
}
$display_driver = phodevi::read_property('system', 'dri-display-driver');
if (empty($display_driver)) {
if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
$display_driver = 'fglrx';
} else {
if (phodevi::is_nvidia_graphics() || is_file('/proc/driver/nvidia/version')) {
$display_driver = 'nvidia';
} else {
if ((phodevi::is_mesa_graphics() || phodevi::is_bsd()) && stripos(phodevi::read_property('gpu', 'model'), 'NVIDIA') !== false) {
if (is_file('/sys/class/drm/version')) {
// If there's DRM loaded and NVIDIA, it should be Nouveau
$display_driver = 'nouveau';
} else {
// The dead xf86-video-nv doesn't use any DRM
$display_driver = 'nv';
}
} else {
// Fallback to hopefully detect the module, takes the first word off the GPU string and sees if it is the module
// This works in at least the case of the Cirrus driver
$display_driver = strtolower(pts_strings::first_in_string(phodevi::read_property('gpu', 'model')));
}
}
}
}
if (!empty($display_driver)) {
$driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
if ($driver_version == false || $driver_version == '1.0.0') {
switch ($display_driver) {
case 'amd':
// See if it's radeon driver
$driver_version = phodevi_parser::read_xorg_module_version('radeon_drv');
if ($driver_version != false) {
$display_driver = 'radeon';
}
break;
case 'vmwgfx':
// See if it's VMware driver
$driver_version = phodevi_parser::read_xorg_module_version('vmware_drv');
if ($driver_version != false) {
$display_driver = 'vmware';
}
break;
case 'radeon':
// RadeonHD driver also reports DRI driver as 'radeon', so try reading that instead
$driver_version = phodevi_parser::read_xorg_module_version('radeonhd_drv');
if ($driver_version != false) {
$display_driver = 'radeonhd';
}
break;
case 'nvidia':
case 'NVIDIA':
case 'nouveau':
// NVIDIA's binary driver usually ends up reporting 1.0.0
if ($nvs_value = phodevi_parser::read_nvidia_extension('NvidiaDriverVersion')) {
$display_driver = 'NVIDIA';
$driver_version = $nvs_value;
} else {
// NVIDIA's binary driver appends their driver version on the end of the OpenGL version string
$glxinfo = phodevi_parser::software_glxinfo_version();
if (($pos = strpos($glxinfo, 'NVIDIA ')) != false) {
$display_driver = 'NVIDIA';
$driver_version = substr($glxinfo, $pos + 7);
}
}
break;
default:
if (is_readable('/sys/class/graphics/fb0/name')) {
// This path works for at least finding NVIDIA Tegra 2 DDX (via tegra_fb)
$display_driver = file_get_contents('/sys/class/graphics/fb0/name');
$display_driver = str_replace(array('drm', '_fb'), null, $display_driver);
$driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
}
break;
}
}
if ($driver_version == false) {
// If the version is empty, chances are the DDX driver string is incorrect
$display_driver = null;
// See if the VESA or fbdev driver is in use
foreach (array('modesetting', 'fbdev', 'vesa') as $drv) {
$drv_version = phodevi_parser::read_xorg_module_version($drv . '_drv');
if ($drv_version) {
$display_driver = $drv;
$driver_version = $drv_version;
break;
}
}
}
if (!empty($driver_version) && $with_version && $driver_version != '0.0.0') {
$display_driver .= ' ' . $driver_version;
// XXX: The below check is disabled since the Catalyst Version no longer seems reliably reported (circa Catalyst 13.x)
if (false && phodevi::is_ati_graphics() && strpos($display_driver, 'fglrx') !== false) {
$catalyst_version = phodevi_linux_parser::read_amd_pcsdb('AMDPCSROOT/SYSTEM/LDC,Catalyst_Version');
if ($catalyst_version != null && $catalyst_version > 10.1 && $catalyst_version != 10.5 && $catalyst_version != 11.8) {
// This option was introduced around Catalyst 10.5 but seems to not be updated properly until Catalyst 10.11/10.12
//.........这里部分代码省略.........
示例14: render_page_process
public static function render_page_process($PATH)
{
$COMPONENT = trim(str_replace('%20', ' ', $PATH[0]));
switch ($COMPONENT) {
case 'CPU':
$model = phodevi::read_property('cpu', 'model');
$ob_type = 'Processor';
$sensor_flag = 'all.cpu';
$cpu_flags = phodevi_cpu::get_cpu_flags();
$features = array(array('Frequency', phodevi::read_property('cpu', 'mhz-default-frequency') . ' MHz'), array('Core Count', phodevi_cpu::cpuinfo_core_count()), array('Thread Count', phodevi_cpu::cpuinfo_thread_count()), array('Cache Size', phodevi_cpu::cpuinfo_cache_size() . ' KB'), array('Instruction Set Extensions', phodevi_cpu::instruction_set_extensions()), array('AES Encryption', $cpu_flags & phodevi_cpu::get_cpu_feature_constant('aes') ? 'YES' : 'NO'), array('Energy Performance Bias', $cpu_flags & phodevi_cpu::get_cpu_feature_constant('epb') ? 'YES' : 'NO'), array('Virtualization', phodevi_cpu::virtualization_technology() ? phodevi_cpu::virtualization_technology() : 'NO'), array('Scaling Governor', phodevi::read_property('cpu', 'scaling-governor')));
$software_features = array();
break;
case 'GPU':
$model = phodevi::read_property('gpu', 'model');
$ob_type = 'Graphics';
$sensor_flag = 'all.gpu';
$features = array(array('Frequency', implode(' / ', phodevi::read_property('gpu', 'stock-frequency')) . ' MHz'), array('vRAM Capacity', phodevi::read_property('gpu', 'memory-capacity') . ' MB'), array('Compute Cores', phodevi::read_property('gpu', 'compute-cores')), array('Screen Resolution', phodevi::read_property('gpu', 'screen-resolution-string')), array('2D Acceleration', phodevi::read_property('gpu', '2d-acceleration')));
$software_features = array(array('Video Driver', phodevi::read_property('system', 'display-driver-string')), array('OpenGL Driver', phodevi::read_property('system', 'opengl-driver')), array('Kernel', phodevi::read_property('system', 'kernel')), array('Video Drivers', phodevi::read_property('system', 'display-driver-string')), array('Display Server', phodevi::read_property('system', 'display-server')));
break;
case 'Motherboard':
$model = phodevi::read_property('motherboard', 'identifier');
$ob_type = 'System';
$sensor_flag = 'all.sys';
$features = array(array('Chipset', phodevi::read_property('chipset', 'identifier')), array('Serial Number', phodevi::read_property('motherboard', 'serial-number')), array('Network', phodevi::read_property('network', 'identifier')), array('Audio', phodevi::read_property('audio', 'identifier')));
$software_features = array();
break;
case 'Disk':
$model = phodevi::read_property('disk', 'identifier');
$ob_type = 'Disk';
$sensor_flag = 'all.hdd';
$mo = phodevi::read_property('disk', 'mount-options');
$mo = isset($mo['mount-options']) ? $mo['mount-options'] : null;
$features = array(array('I/O Scheduler', phodevi::read_property('disk', 'scheduler')), array('Mount Options', $mo), array('File-System', phodevi::read_property('system', 'filesystem')));
$software_features = array();
break;
case 'Memory':
$model = phodevi::read_property('memory', 'identifier');
$ob_type = 'Memory';
$sensor_flag = 'all.memory';
$features = array();
$software_features = array();
break;
case 'Software':
$model = phodevi::read_property('system', 'operating-system');
$ob_type = '';
$sensor_flag = 'all.sys';
$features = array(array('Kernel', phodevi::read_property('system', 'kernel-string')), array('Compiler', phodevi::read_property('system', 'compiler')), array('Desktop', phodevi::read_property('system', 'desktop-environment')), array('Display Server', phodevi::read_property('system', 'display-server')), array('Display Driver', phodevi::read_property('system', 'display-driver-string')), array('OpenGL Driver', phodevi::read_property('system', 'opengl-driver')), array('File-System', phodevi::read_property('system', 'filesystem')), array('System Layer', phodevi::read_property('system', 'system-layer')));
$software_features = array(array('Kernel Parameters', phodevi::read_property('system', 'kernel-parameters')), array('Hostname', phodevi::read_property('system', 'hostname')), array('Local IP Address', $_SERVER['HTTP_HOST']));
break;
}
echo '<h1>' . $model . '</h1>';
echo '<div id="pts_side_pane" style="max-width: 30%;">';
if (!empty($features)) {
echo '<h2>' . $COMPONENT . ' Features</h2>';
echo '<ul>';
foreach ($features as $feature) {
if (isset($feature[1])) {
$feature[0] .= ':';
if ($feature[1] == null) {
$feature[1] = 'N/A';
}
}
$feature[0] = '<strong>' . $feature[0] . '</strong>';
echo '<li>' . implode(' ', $feature) . '</li>' . PHP_EOL;
}
echo '</ul>';
echo '<hr />';
}
if (!empty($software_features)) {
echo '<h2>' . $COMPONENT . ' Software Features</h2>';
echo '<ul>';
foreach ($software_features as $feature) {
if (isset($feature[1])) {
$feature[0] .= ':';
if ($feature[1] == null) {
$feature[1] = 'N/A';
}
}
$feature[0] = '<strong>' . $feature[0] . '</strong>';
echo '<li>' . implode(' ', $feature) . '</li>' . PHP_EOL;
}
echo '</ul>';
echo '<hr />';
}
echo '<div class="pts_pane_window">Log-in to OpenBenchmarking.org to gain access to more functionality.</div>';
echo '</div>';
echo '<div id="svg_graphs" style="margin: 10px 0; text-align: right;"></div>';
echo '<div id="tests_by_popularity" style="margin: 10px 0; text-align: left;"></div>';
echo '<div id="system_log_viewer"><select id="log_viewer_selector" onchange="javascript:log_viewer_change(); return true;"></select><div id="system_log_display"></div></div>';
echo '<script text="text/javascript">
pts_web_socket.submit_event("user-svg-system-graphs ' . $sensor_flag . '", "svg_graphs", "update_svg_graph_space");
pts_web_socket.submit_event("available-system-logs System ' . $COMPONENT . '", "available_system_logs", "update_system_log_viewer");
pts_web_socket.submit_event("tests-by-popularity 6 ' . $ob_type . '", "tests_by_popularity", "tests_by_popularity_display");
setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-svg-system-graphs ' . $sensor_flag . '"); }},1000);
</script>';
}
示例15: run
public static function run($r)
{
$is_moscow = pts_flags::os_identifier_hash() == 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc';
if ($is_moscow) {
// Auto mount?
$drives = pts_file_io::glob('/dev/sda*');
sort($drives);
if (false && count($drives) > 0 && !is_dir('/media/pts-auto-mount') && is_writable('/media/')) {
$last_drive = array_pop($drives);
echo PHP_EOL . 'Attempting to auto-mount drive: ' . $last_drive . PHP_EOL;
mkdir('/media/pts-auto-mount');
exec('mount ' . $last_drive . ' /media/pts-auto-mount');
putenv('PTS_TEST_INSTALL_ROOT_PATH=/media/pts-auto-mount/');
}
// Auto save results
$test_results_name = phodevi::read_property('motherboard', 'serial-number');
if ($test_results_name == null) {
$test_results_name = phodevi::read_name('motherboard');
}
if ($test_results_name == null) {
$test_results_name = phodevi::read_property('system', 'vendor-identifier');
}
putenv('TEST_RESULTS_NAME=' . str_replace(' ', null, $test_results_name));
putenv('TEST_RESULTS_IDENTIFIER=' . $test_results_name);
putenv('TEST_RESULTS_DESCRIPTION=Tests using ' . phodevi::read_property('system', 'operating-system') . ' on ' . date('d F Y') . ' of ' . $test_results_name . '.');
self::select_drive_mount();
}
pts_openbenchmarking::refresh_repository_lists();
pts_client::$display->generic_heading('Interactive Benchmarking');
echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
$reboot_on_exit = pts_flags::is_live_cd() && pts_client::user_home_directory() == '/root/';
do {
$options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
if ($is_moscow) {
unset($options['RUN_SUITE']);
// $options['SELECT_DRIVE_MOUNT'] = 'Select Disk Drive To Use For Testing';
}
if (count(pts_client::saved_test_results()) > 0) {
$options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
}
$options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
$response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
switch ($response) {
case 'RUN_TEST':
$supported_tests = pts_openbenchmarking::available_tests();
$supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
$longest_title_length = 0;
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile->get_title() == null || pts_test_run_manager::test_profile_system_compatibility_check($test_profile) == false) {
unset($supported_tests[$i]);
continue;
}
if ($is_moscow && pts_test_install_request::test_files_available_locally($test_profile) == false) {
// Don't show tests where files need to be downloaded
unset($supported_tests[$i]);
continue;
}
$longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
}
$t = array();
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile instanceof pts_test_profile) {
$t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
}
}
$supported_tests = $t;
asort($supported_tests);
$tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
$tests_to_run = explode(',', $tests_to_run);
pts_test_installer::standard_install($tests_to_run);
$run_manager = pts_test_run_manager::standard_run($tests_to_run, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'RUN_SUITE':
$possible_suites = pts_openbenchmarking::available_suites();
foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
array_push($possible_suites, 'pts/' . $subsystem);
}
$suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
foreach (explode(',', $suites_to_run) as $suite_to_run) {
pts_test_installer::standard_install($suite_to_run);
pts_test_run_manager::standard_run($suite_to_run, pts_c::defaults_mode | pts_c::auto_mode);
}
break;
case 'SELECT_DRIVE_MOUNT':
self::select_drive_mount();
break;
case 'RUN_SYSTEM_TEST':
pts_client::$display->generic_heading('System Test');
$system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
pts_test_installer::standard_install($system_tests);
$run_manager = pts_test_run_manager::standard_run($system_tests, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'SHOW_INFO':
pts_client::$display->generic_heading('System Software / Hardware Information');
//.........这里部分代码省略.........