本文整理汇总了PHP中pts_file_io类的典型用法代码示例。如果您正苦于以下问题:PHP pts_file_io类的具体用法?PHP pts_file_io怎么用?PHP pts_file_io使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pts_file_io类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($r)
{
$result = $r[0];
$result_file = new pts_result_file($result);
$result_file_identifiers = $result_file->get_system_identifiers();
if (count($result_file_identifiers) < 2) {
echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
return false;
}
$remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true));
$keep_identifiers = array();
foreach ($result_file_identifiers as $identifier) {
if (!in_array($identifier, $remove_identifiers)) {
array_push($keep_identifiers, $identifier);
}
}
foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) {
foreach ($remove_identifiers as $remove_identifier) {
if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier)) {
pts_file_io::delete(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier, null, true);
}
}
}
$extract_select = new pts_result_merge_select($result, $keep_identifiers);
$extract_result = pts_merge::merge_test_results($extract_select);
pts_client::save_test_result($r[0] . '/composite.xml', $extract_result);
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html');
}
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:28,代码来源:remove_from_result_file.php
示例2: run
public static function run($r)
{
pts_client::$display->generic_heading('Available Tests');
$test_count = 0;
foreach (pts_openbenchmarking::available_tests(false) as $identifier) {
$repo = substr($identifier, 0, strpos($identifier, '/'));
$id = substr($identifier, strlen($repo) + 1);
$repo_index = pts_openbenchmarking::read_repository_index($repo);
if (!in_array(phodevi::operating_system(), $repo_index['tests'][$id]['supported_platforms']) || empty($repo_index['tests'][$id]['title'])) {
// Don't show unsupported tests
continue;
}
echo sprintf('%-30ls - %-35ls %-9ls', $identifier, $repo_index['tests'][$id]['title'], $repo_index['tests'][$id]['test_type']) . PHP_EOL;
$test_count++;
}
foreach (pts_file_io::glob(PTS_TEST_PROFILE_PATH . 'local/*/test-definition.xml') as $path) {
$test_profile = new pts_test_profile('local/' . basename(dirname($path)));
if ($test_profile->get_title() != null && $test_profile->is_supported(false)) {
echo sprintf('%-30ls - %-35ls %-9ls', $test_profile->get_identifier(), $test_profile->get_title(), $test_profile->get_test_hardware_type()) . PHP_EOL;
$test_count++;
}
}
if ($test_count == 0) {
echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
}
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:26,代码来源:list_available_tests.php
示例3: render_page_process
public static function render_page_process($PATH)
{
$suite_dir = phoromatic_server::phoromatic_account_suite_path($_SESSION['AccountID']);
$main = '<h1>Local Suites</h1><p>These are test suites created by you or another account within your group. Suites are an easy collection of test profiles. New suits can be trivially made via the <a href="/?build_suite">build suite</a> page.</p>';
$suite_count = 0;
foreach (pts_file_io::glob($suite_dir . '*/suite-definition.xml') as $xml_path) {
$suite_count++;
$id = basename(dirname($xml_path));
$test_suite = new pts_test_suite($xml_path);
$main .= '<a name="' . $id . '"></a><h1>' . $test_suite->get_title() . ' [' . $id . ']</h1>';
$main .= '<p><strong>' . $test_suite->get_maintainer() . '</strong></p>';
$main .= '<p><em>' . $test_suite->get_description() . '</em></p>';
$main .= '<div style="max-height: 200px; overflow-y: scroll;">';
foreach ($test_suite->get_contained_test_result_objects() as $tro) {
$main .= '<h3>' . $tro->test_profile->get_title() . ' [' . $tro->test_profile->get_identifier() . ']</h3>';
$main .= '<p>' . $tro->get_arguments_description() . '</p>';
}
$main .= '</div>';
$main .= '<hr />';
}
if ($suite_count == 0) {
$main .= '<h1>No Test Suites Found</h1>';
}
echo phoromatic_webui_header_logged_in();
echo '<div id="pts_phoromatic_main_area">' . $main . '</div>';
echo phoromatic_webui_footer();
}
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:27,代码来源:phoromatic_local_suites.php
示例4: client_commands_array
public static function client_commands_array()
{
$options = array('Test Installation' => array(), 'Testing' => array(), 'Batch Testing' => array(), 'OpenBenchmarking.org' => array(), 'System' => array(), 'Information' => array(), 'Asset Creation' => array(), 'Result Management' => array(), 'Result Analytics' => array(), 'Other' => array());
foreach (pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php_file) {
$option_php = basename($option_php_file, '.php');
$name = str_replace('_', '-', $option_php);
if (!in_array(pts_strings::first_in_string($name, '-'), array('dump', 'task'))) {
include_once $option_php_file;
$reflect = new ReflectionClass($option_php);
$constants = $reflect->getConstants();
$doc_description = isset($constants['doc_description']) ? constant($option_php . '::doc_description') : 'No summary is available.';
$doc_section = isset($constants['doc_section']) ? constant($option_php . '::doc_section') : 'Other';
$name = isset($constants['doc_use_alias']) ? constant($option_php . '::doc_use_alias') : $name;
$skip = isset($constants['doc_skip']) ? constant($option_php . '::doc_skip') : false;
$doc_args = array();
if ($skip) {
continue;
}
if (method_exists($option_php, 'argument_checks')) {
$doc_args = call_user_func(array($option_php, 'argument_checks'));
}
if (!empty($doc_section) && !isset($options[$doc_section])) {
$options[$doc_section] = array();
}
array_push($options[$doc_section], array($name, $doc_args, $doc_description));
}
}
return $options;
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:29,代码来源:pts_documentation.php
示例5: delete
public static function delete($object, $ignore_files = null, $remove_root_directory = false)
{
// Delete files and/or directories
if ($object == false) {
return false;
}
if (is_dir($object)) {
$object = pts_strings::add_trailing_slash($object);
}
foreach (pts_file_io::glob($object . '*') as $to_remove) {
if (is_file($to_remove) || is_link($to_remove)) {
if (is_array($ignore_files) && in_array(basename($to_remove), $ignore_files)) {
continue;
// Don't remove the file
} else {
unlink($to_remove);
}
} else {
if (is_dir($to_remove)) {
self::delete($to_remove, $ignore_files, true);
}
}
}
if ($remove_root_directory && is_dir($object) && count(pts_file_io::glob($object . '/*')) == 0) {
rmdir($object);
}
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:27,代码来源:pts_file_io.php
示例6: get_vendors_list
public function get_vendors_list()
{
$package_files = pts_file_io::glob(PTS_EXDEP_PATH . 'xml/*-packages.xml');
foreach ($package_files as &$file) {
$file = basename(substr($file, 0, strpos($file, '-packages.xml')));
}
return $package_files;
}
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:8,代码来源:pts_exdep_generic_parser.php
示例7: run
public static function run($r)
{
pts_file_io::unlink(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/web-server-launcher');
if (PHP_VERSION_ID < 50400) {
echo 'Running an unsupported PHP version. PHP 5.4+ is required to use this feature.' . PHP_EOL . PHP_EOL;
return false;
}
$server_launcher = '#!/bin/sh' . PHP_EOL;
$web_port = 0;
$remote_access = pts_config::read_user_config('PhoronixTestSuite/Options/Server/RemoteAccessPort', 'FALSE');
$remote_access = is_numeric($remote_access) && $remote_access > 1 ? $remote_access : false;
$blocked_ports = array(2049, 3659, 4045, 6000);
if ($remote_access) {
// ALLOWING SERVER TO BE REMOTELY ACCESSIBLE
$server_ip = '0.0.0.0';
$fp = false;
$errno = null;
$errstr = null;
if (($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false) {
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
fclose($fp);
return false;
} else {
$web_port = $remote_access;
$web_socket_port = pts_config::read_user_config('PhoronixTestSuite/Options/Server/WebSocketPort', '');
if ($web_socket_port == null || !is_numeric($web_socket_port)) {
$web_socket_port = $web_port - 1;
}
}
} else {
echo PHP_EOL . PHP_EOL . 'You must first configure the remote GUI/WEBUI settings via:' . pts_config::get_config_file_location() . PHP_EOL . PHP_EOL;
return false;
}
// WebSocket Server Setup
$server_launcher .= 'export PTS_WEBSOCKET_PORT=' . $web_socket_port . PHP_EOL;
$server_launcher .= 'export PTS_WEBSOCKET_SERVER=GUI' . PHP_EOL;
$server_launcher .= 'cd ' . getenv('PTS_DIR') . ' && PTS_MODE="CLIENT" ' . getenv('PHP_BIN') . ' pts-core/phoronix-test-suite.php start-ws-server &' . PHP_EOL;
$server_launcher .= 'websocket_server_pid=$!' . PHP_EOL;
// HTTP Server Setup
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 false;
} else {
$server_launcher .= getenv('PHP_BIN') . ' -S ' . $server_ip . ':' . $web_port . ' -t ' . PTS_CORE_PATH . 'web-interface/ 2> /dev/null &' . PHP_EOL;
//2> /dev/null
}
$server_launcher .= 'http_server_pid=$!' . PHP_EOL;
$server_launcher .= 'sleep 1' . PHP_EOL;
$server_launcher .= 'echo "The Web Interface Is Accessible At: http://localhost:' . $web_port . '"' . PHP_EOL;
$server_launcher .= PHP_EOL . 'echo -n "Press [ENTER] to kill server..."' . PHP_EOL . 'read var_name';
// Shutdown / Kill Servers
$server_launcher .= PHP_EOL . 'kill $http_server_pid';
$server_launcher .= PHP_EOL . 'kill $websocket_server_pid';
$server_launcher .= PHP_EOL . 'rm -f ~/.phoronix-test-suite/run-lock*';
file_put_contents(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/web-server-launcher', $server_launcher);
}
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:56,代码来源:start_remote_gui_server.php
示例8: run
public static function run($r)
{
$identifier = $r[0];
$test_xml_files = pts_file_io::glob(PTS_SAVE_RESULTS_PATH . $identifier . '/test-*.xml');
if (count($test_xml_files) == 0) {
echo PHP_EOL . 'No test XML data was found.' . PHP_EOL;
return false;
}
pts_client::save_test_result($identifier . '/composite.xml', pts_merge::merge_test_results_array($test_xml_files));
pts_client::regenerate_graphs($identifier, 'The ' . $identifier . ' result file XML has been rebuilt.');
}
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:11,代码来源:rebuild_composite_xml.php
示例9: run
public static function run($r)
{
$options = array();
foreach (pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php) {
$name = str_replace('_', '-', basename($option_php, '.php'));
if (!in_array(pts_strings::first_in_string($name, '-'), array('dump', 'debug', 'task'))) {
array_push($options, $name);
}
}
$is_true = isset($r[0]) && $r[0] == 'TRUE';
echo implode($is_true ? ' ' : PHP_EOL, $options) . ($is_true ? null : PHP_EOL);
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:12,代码来源:dump_possible_options.php
示例10: read_sensor
public static function read_sensor()
{
// Reads the system's temperature
$temp_c = -1;
if (phodevi::is_linux()) {
$raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp3_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
if ($raw_temp == -1) {
$raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp2_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
}
if ($raw_temp == -1) {
$raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/device/temp1_input', 'POSITIVE_NUMERIC', array('name' => '!coretemp,!radeon,!nouveau'));
}
if ($raw_temp == -1) {
$raw_temp = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/temp1_input', 'POSITIVE_NUMERIC');
}
if ($raw_temp != -1) {
if ($raw_temp > 1000) {
$raw_temp = $raw_temp / 1000;
}
$temp_c = pts_math::set_precision($raw_temp, 2);
}
if ($temp_c == -1) {
$acpi = phodevi_linux_parser::read_acpi(array('/thermal_zone/THM1/temperature', '/thermal_zone/TZ00/temperature', '/thermal_zone/TZ01/temperature'), 'temperature');
if (($end = strpos($acpi, ' ')) > 0) {
$temp_c = substr($acpi, 0, $end);
}
}
if ($temp_c == -1) {
$sensors = phodevi_linux_parser::read_sensors(array('Sys Temp', 'Board Temp'));
if ($sensors != false && is_numeric($sensors)) {
$temp_c = $sensors;
}
}
if ($temp_c == -1 && is_file('/sys/class/thermal/thermal_zone0/temp')) {
$temp_c = pts_file_io::file_get_contents('/sys/class/thermal/thermal_zone0/temp');
if ($temp_c > 1000) {
$temp_c = pts_math::set_precision($temp_c / 1000, 1);
}
}
} else {
if (phodevi::is_bsd()) {
$acpi = phodevi_bsd_parser::read_sysctl(array('hw.sensors.acpi_tz1.temp0', 'hw.acpi.thermal.tz1.temperature'));
if (($end = strpos($acpi, ' degC')) > 0 || ($end = strpos($acpi, 'C')) > 0) {
$acpi = substr($acpi, 0, $end);
if (is_numeric($acpi)) {
$temp_c = $acpi;
}
}
}
}
return $temp_c;
}
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:52,代码来源:sys_temp.php
示例11: get_supported_devices
public static function get_supported_devices()
{
if (phodevi::is_linux()) {
$blockdev_dir = '/sys/block/';
$glob_regex = '{[shvm]d*,nvme*,mmcblk*}';
$disk_array = pts_file_io::glob($blockdev_dir . $glob_regex, GLOB_BRACE);
$supported = array();
foreach ($disk_array as $check_disk) {
$stat_path = $check_disk . '/stat';
if (is_file($stat_path) && pts_file_io::file_get_contents($stat_path) != null) {
array_push($supported, basename($check_disk));
}
}
return $supported;
}
return NULL;
}
开发者ID:numerant,项目名称:phoronix-test-suite,代码行数:17,代码来源:hdd_read_speed.php
示例12: read_sensor
public static function read_sensor()
{
$iowait = -1;
if (phodevi::is_linux() && is_file('/proc/stat')) {
$start_stat = pts_file_io::file_get_contents('/proc/stat');
sleep(1);
$end_stat = pts_file_io::file_get_contents('/proc/stat');
$start_stat = explode(' ', substr($start_stat, 0, strpos($start_stat, "\n")));
$end_stat = explode(' ', substr($end_stat, 0, strpos($end_stat, "\n")));
for ($i = 2, $diff_cpu_total = 0; $i < 9; $i++) {
$diff_cpu_total += $end_stat[$i] - $start_stat[$i];
}
$diff_iowait = $end_stat[6] - $start_stat[6];
$iowait = pts_math::set_precision(1000 * $diff_iowait / $diff_cpu_total / 10, 2);
}
return $iowait;
}
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:17,代码来源:sys_iowait.php
示例13: get_supported_devices
public static function get_supported_devices()
{
if (phodevi::is_linux()) {
$disk_list = shell_exec("ls -1 /sys/class/block | grep '^[shv]d[a-z]\$'");
// TODO make this native PHP
$disk_array = explode("\n", $disk_list);
$supported = array();
foreach ($disk_array as $check_disk) {
$stat_path = '/sys/class/block/' . $check_disk . '/stat';
if (is_file($stat_path) && pts_file_io::file_get_contents($stat_path) != null) {
array_push($supported, $check_disk);
}
}
return $supported;
}
return NULL;
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:17,代码来源:hdd_write_speed.php
示例14: 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
示例15: read_sensor
public static function read_sensor()
{
// speed in MB/s
$speed = -1;
if (phodevi::is_linux()) {
static $sys_disk = null;
if ($sys_disk == null) {
foreach (pts_file_io::glob('/sys/class/block/sd*/stat') as $check_disk) {
if (pts_file_io::file_get_contents($check_disk) != null) {
$sys_disk = $check_disk;
break;
}
}
}
$speed = phodevi_linux_parser::read_sys_disk_speed($sys_disk, 'READ');
}
return $speed;
}
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:18,代码来源:hdd_read_speed.php
示例16: read_sensor
public static function read_sensor()
{
// Report graphics processor temperature
$temp_c = -1;
if (phodevi::is_nvidia_graphics()) {
$temp_c = phodevi_parser::read_nvidia_extension('GPUCoreTemp');
} else {
if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
$temp_c = phodevi_linux_parser::read_ati_overdrive('Temperature');
} else {
foreach (array_merge(array('/sys/class/drm/card0/device/temp1_input'), pts_file_io::glob('/sys/class/drm/card0/device/hwmon/hwmon*/temp1_input')) as $temp_input) {
// This works for at least Nouveau driver with Linux 2.6.37 era DRM
if (is_readable($temp_input) == false) {
continue;
}
$temp_input = pts_file_io::file_get_contents($temp_input);
if (is_numeric($temp_input)) {
if ($temp_input > 1000) {
$temp_input /= 1000;
}
$temp_c = $temp_input;
break;
}
}
if ($temp_c == -1 && is_readable('/sys/kernel/debug/dri/0/i915_emon_status')) {
// Intel thermal
$i915_emon_status = file_get_contents('/sys/kernel/debug/dri/0/i915_emon_status');
$temp = strpos($i915_emon_status, 'GMCH temp: ');
if ($temp !== false) {
$temp = substr($i915_emon_status, $temp + 11);
$temp = substr($temp, 0, strpos($temp, PHP_EOL));
if (is_numeric($temp) && $temp > 0) {
$temp_c = $temp;
}
}
}
}
}
if ($temp_c > 1000 || $temp_c < 9) {
// Invalid data
return -1;
}
return $temp_c;
}
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:44,代码来源:gpu_temp.php
示例17: 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
示例18: run
public static function run($r)
{
if (pts_openbenchmarking_client::user_name() == false) {
echo PHP_EOL . 'You must first be logged into an OpenBenchmarking.org account.' . PHP_EOL;
echo PHP_EOL . 'Create An Account: http://openbenchmarking.org/';
echo PHP_EOL . 'Log-In Command: phoronix-test-suite openbenchmarking-setup' . PHP_EOL . PHP_EOL;
return false;
}
foreach (pts_types::identifiers_to_test_profile_objects($r, true, true) as $test_profile) {
// validate_test_profile
if (pts_validation::validate_test_profile($test_profile)) {
pts_client::$display->generic_heading($test_profile);
$zip_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $test_profile->get_identifier_base_name() . '-' . $test_profile->get_test_profile_version() . '.zip';
$zip_created = pts_compression::zip_archive_create($zip_file, pts_file_io::glob($test_profile->get_resource_dir() . '*'));
if ($zip_created == false) {
echo PHP_EOL . 'Failed to create zip file.' . PHP_EOL;
return false;
}
if (filesize($zip_file) > 104857) {
echo PHP_EOL . 'The test profile package is too big.' . PHP_EOL;
return false;
}
$commit_description = pts_user_io::prompt_user_input('Enter a test commit description', false);
echo PHP_EOL;
$server_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_profile', array('tp_identifier' => $test_profile->get_identifier_base_name(), 'tp_sha1' => sha1_file($zip_file), 'tp_zip' => base64_encode(file_get_contents($zip_file)), 'tp_zip_name' => basename($zip_file), 'commit_description' => $commit_description));
echo PHP_EOL;
$json = json_decode($server_response, true);
if (isset($json['openbenchmarking']['upload']['error']) && !empty($json['openbenchmarking']['upload']['error'])) {
echo 'ERROR: ' . $json['openbenchmarking']['upload']['error'] . PHP_EOL;
}
if (isset($json['openbenchmarking']['upload']['id']) && !empty($json['openbenchmarking']['upload']['id'])) {
echo 'Command: phoronix-test-suite benchmark ' . $json['openbenchmarking']['upload']['id'] . PHP_EOL;
}
if (isset($json['openbenchmarking']['upload']['url']) && !empty($json['openbenchmarking']['upload']['url'])) {
pts_openbenchmarking::refresh_repository_lists(null, true);
echo 'URL: ' . $json['openbenchmarking']['upload']['url'] . PHP_EOL;
}
echo PHP_EOL;
// TODO: chmod +x the .sh files, appropriate permissions elsewhere
unlink($zip_file);
}
}
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:43,代码来源:upload_test_profile.php
示例19: cpu_freq_linux
private function cpu_freq_linux()
{
$frequency = -1;
// First, the ideal way, with modern CPUs using CnQ or EIST and cpuinfo reporting the current frequency.
if (is_file('/sys/devices/system/cpu/' . $this->cpu_to_monitor . '/cpufreq/scaling_cur_freq')) {
$frequency = pts_file_io::file_get_contents('/sys/devices/system/cpu/' . $this->cpu_to_monitor . '/cpufreq/scaling_cur_freq');
$frequency = intval($frequency) / 1000;
} else {
if (is_file('/proc/cpuinfo')) {
$cpu_speeds = phodevi_linux_parser::read_cpuinfo('cpu MHz');
$cpu_number = intval(substr($this->cpu_to_monitor, 3));
//cut 'cpu' from the beginning
if (!isset($cpu_speeds[$cpu_number])) {
return -1;
}
$frequency = intval($cpu_speeds[$cpu_number]);
}
}
return $frequency;
}
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:20,代码来源:cpu_freq.php
示例20: run
public static function run($r)
{
$result_file = new pts_result_file($r[0]);
$result_file_identifiers = $result_file->get_system_identifiers();
if (count($result_file_identifiers) < 2) {
echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
return false;
}
$remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true));
$result_file->remove_run($remove_identifiers);
$result_dir = dirname($result_file->get_file_location()) . '/';
foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) {
foreach ($remove_identifiers as $remove_identifier) {
if (is_dir($result_dir . $dir_name . '/' . $remove_identifier)) {
pts_file_io::delete($result_dir . $dir_name . '/' . $remove_identifier, null, true);
}
}
}
pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml());
pts_client::display_web_page($result_dir . '/index.html');
}
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:21,代码来源:remove_from_result_file.php
注:本文中的pts_file_io类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论