本文整理匯總了PHP中pts_openbenchmarking類的典型用法代碼示例。如果您正苦於以下問題:PHP pts_openbenchmarking類的具體用法?PHP pts_openbenchmarking怎麽用?PHP pts_openbenchmarking使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了pts_openbenchmarking類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
}
示例2: run
public static function run($r)
{
$available_suites = pts_openbenchmarking::available_suites(false);
pts_client::$display->generic_heading('Available Suites');
if (count($available_suites) > 0) {
$has_partially_supported_suite = false;
foreach ($available_suites as $identifier) {
$suite_info = new pts_test_suite($identifier);
$partially_supported = $suite_info->is_supported() == 1;
if (!$has_partially_supported_suite && $partially_supported) {
$has_partially_supported_suite = true;
}
if ($suite_info->is_supported()) {
$identifier_prefix = $partially_supported ? '*' : ' ';
if ($suite_info->get_title() != null) {
echo sprintf('%-34ls - %-32ls %s' . PHP_EOL, $identifier_prefix . ' ' . $identifier, $suite_info->get_title(), $suite_info->get_suite_type());
}
}
}
echo PHP_EOL;
if ($has_partially_supported_suite) {
echo '* Indicates a partially supported suite.' . PHP_EOL . PHP_EOL;
}
} else {
echo PHP_EOL . 'No suites found. Please check that you have Internet connectivity to download test suite 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;
}
}
示例3: run
public static function run($r)
{
echo PHP_EOL . 'OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
foreach (pts_openbenchmarking::linked_repositories() as $repo) {
if ($repo == 'local') {
// Skip local since it's a fake repository
continue;
}
$repo_index = pts_openbenchmarking::read_repository_index($repo);
$generated_time = date('F d H:i', $repo_index['main']['generated']);
$tab = ' ';
foreach (array('tests', 'suites') as $t) {
echo PHP_EOL . str_repeat('=', 40) . PHP_EOL . strtoupper($repo . ' ' . $t) . PHP_EOL . 'Generated: ' . $generated_time . PHP_EOL . str_repeat('=', 40) . PHP_EOL . PHP_EOL;
foreach ($repo_index[$t] as $identifier => $test) {
echo 'Identifier: ' . $identifier . PHP_EOL;
foreach ($test as $i => $j) {
echo sprintf('%-22ls', $i) . ': ';
if (is_array($j)) {
echo implode(', ', $j);
} else {
echo $j;
}
echo PHP_EOL;
}
echo PHP_EOL;
}
}
}
}
示例4: run
public static function run($r)
{
$result_file = pts_types::identifier_to_object($r[0]);
$upload_url = pts_openbenchmarking::upload_test_result($result_file);
if ($upload_url) {
pts_client::display_web_page($upload_url, 'Do you want to view the results on OpenBenchmarking.org', true);
} else {
echo PHP_EOL . 'Results Failed To Upload.' . PHP_EOL;
}
}
示例5: search_test_profiles
protected static function search_test_profiles($q)
{
$ret = null;
foreach (pts_openbenchmarking::available_tests() as $test) {
$tp = new pts_test_profile($test);
if (stripos($test, $q) !== false || stripos($tp->get_title(), $q) === 0) {
$ret .= '<h3>' . $tp->get_title() . '</h3><p>' . $tp->get_description() . '<br /><a href="http://openbenchmarking.org/test/' . $tp->get_identifier(false) . '">Learn More On OpenBenchmarking.org</a></p>';
}
}
return $ret;
}
示例6: __construct
public function __construct($identifier)
{
if (PTS_IS_CLIENT) {
$ob_identifier = pts_openbenchmarking::evaluate_string_to_qualifier($identifier, true, 'suite');
if ($ob_identifier != false) {
$identifier = $ob_identifier;
}
}
$this->identifier = $identifier;
$this->xml_parser = new pts_suite_nye_XmlReader($identifier);
}
示例7: run
public static function run($args)
{
$result_files = array();
foreach ($args as $id) {
$xml = pts_openbenchmarking::clone_openbenchmarking_result($id, true);
if ($xml) {
$result_file = new pts_result_file($xml);
pts_client::save_test_result($id . '/composite.xml', $result_file->get_xml(), true);
echo PHP_EOL . 'Result Saved To: ' . PTS_SAVE_RESULTS_PATH . $id . '/composite.xml' . PHP_EOL;
}
}
}
示例8: run
public static function run($args)
{
$result_files = array();
foreach ($args as $id) {
$xml = pts_openbenchmarking::clone_openbenchmarking_result($id, true);
array_push($result_files, new pts_result_file($xml));
}
$writer = new pts_result_file_writer(null);
pts_merge::merge_test_results_process($writer, $result_files);
pts_client::save_test_result($args[0] . '/composite.xml', $writer->get_xml(), true);
echo PHP_EOL . 'Result Saved To: ' . PTS_SAVE_RESULTS_PATH . $args[0] . '/composite.xml' . PHP_EOL;
}
示例9: run
public static function run($r)
{
pts_client::$display->generic_heading('Test Suite Creation');
$suite_name = pts_user_io::prompt_user_input('Enter name of suite');
$suite_test_type = pts_user_io::prompt_text_menu('Select test type', pts_types::subsystem_targets());
$suite_maintainer = pts_user_io::prompt_user_input('Enter suite maintainer name');
$suite_description = pts_user_io::prompt_user_input('Enter suite description');
$possible_suites = pts_openbenchmarking::available_suites();
$possible_tests = pts_openbenchmarking::available_tests();
$suite_writer = new pts_test_suite_writer();
$suite_writer->add_suite_information($suite_name, '1.0.0', $suite_maintainer, $suite_test_type, $suite_description);
foreach ($r as $test_object) {
$test_object = pts_types::identifier_to_object($test_object);
if ($test_object instanceof pts_test_profile) {
list($args, $description) = pts_test_run_options::prompt_user_options($test_object);
for ($i = 0; $i < count($args); $i++) {
// Not binding the test profile version to this suite, otherwise change false to true
$suite_writer->add_to_suite($test_object->get_identifier(false), $args[$i], $description[$i]);
}
} else {
if ($test_object instanceof pts_test_suite) {
$suite_writer->add_to_suite($test_object->get_identifier(), null, null);
}
}
}
$input_option = null;
do {
switch ($input_option) {
case 'Add Test':
$test_to_add = pts_user_io::prompt_text_menu('Enter test name', $possible_tests);
$test_profile = new pts_test_profile($test_to_add);
list($args, $description) = pts_test_run_options::prompt_user_options($test_profile);
for ($i = 0; $i < count($args); $i++) {
$suite_writer->add_to_suite($test_to_add, $args[$i], $description[$i]);
}
break;
case 'Add Sub-Suite':
$suite_to_add = pts_user_io::prompt_text_menu('Enter test suite', $possible_suites);
$suite_writer->add_to_suite($suite_to_add, null, null);
break;
}
echo PHP_EOL . 'Available Options:' . PHP_EOL;
$input_option = pts_user_io::prompt_text_menu('Select next operation', array('Add Test', 'Add Sub-Suite', 'Save & Exit'));
} while ($input_option != 'Save & Exit');
$suite_identifier = $suite_writer->clean_save_name_string($suite_name);
$save_to = PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml';
mkdir(dirname($save_to));
if ($suite_writer->save_xml($save_to) != false) {
echo PHP_EOL . PHP_EOL . 'Saved To: ' . $save_to . PHP_EOL . 'To run this suite, type: phoronix-test-suite benchmark ' . $suite_identifier . PHP_EOL . PHP_EOL;
}
}
示例10: __construct
public function __construct($read = null, $normal_init = true)
{
$this->overrides = array();
$this->tp_extends = null;
if ($normal_init == false) {
$this->identifier = $read;
return;
}
if (!isset($read[200]) && strpos($read, '<?xml version="1.0"?>') === false) {
if (PTS_IS_CLIENT && (!defined('PTS_TEST_PROFILE_PATH') || !is_file(PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml'))) {
$read = pts_openbenchmarking::evaluate_string_to_qualifier($read, true, 'test');
if ($read == false && pts_openbenchmarking::openbenchmarking_has_refreshed() == false) {
// Test profile might be brand new, so refresh repository and then check
// pts_openbenchmarking::refresh_repository_lists(null, true);
$read = pts_openbenchmarking::evaluate_string_to_qualifier($read, true, 'test');
}
}
}
if (!isset($read[64])) {
// Passed is not an identifier since it's too long
$this->identifier = $read;
}
if (!isset($read[512]) && !is_file($read)) {
if (defined('PTS_TEST_PROFILE_PATH') && is_file(PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml')) {
$read = PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml';
} else {
if (substr($read, -4) == '.zip' && is_file($read)) {
$zip = new ZipArchive();
if ($zip->open($read) === true) {
$read = $zip->getFromName('test-definition.xml');
$zip->close();
}
}
}
}
//$xml_options = 0;
//if(defined('LIBXML_COMPACT'))
//{
$xml_options = LIBXML_COMPACT | LIBXML_PARSEHUGE;
//}
if (is_file($read)) {
$this->file_location = $read;
$this->xml = simplexml_load_file($read, 'SimpleXMLElement', $xml_options);
} else {
$this->raw_xml = $read;
if (strpos($read, '<') !== false) {
$this->xml = simplexml_load_string($read, 'SimpleXMLElement', $xml_options);
}
}
}
示例11: run
public static function run($r)
{
pts_client::$display->generic_heading('Recommended OpenBenchmarking.org Test Profiles');
$test_count = 0;
$recommendation_index = pts_openbenchmarking::make_openbenchmarking_request('recommended_tests_index');
$recommendation_index = json_decode($recommendation_index, true);
foreach ($recommendation_index['recommended_tests'] as $subsystem => $tests) {
pts_client::$display->generic_heading($subsystem . ' Tests');
foreach ($tests as $test) {
echo sprintf('%-32ls - %-35ls', $test['test_profile'], $test['title']) . 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;
}
}
示例12: run
public static function run($r)
{
$installed_suites = array();
foreach (pts_openbenchmarking::available_suites() as $suite) {
$suite = new pts_test_suite($suite);
if ($suite->needs_updated_install() == false) {
$installed_suites[] = $suite;
}
}
pts_client::$display->generic_heading(count($installed_suites) . ' Suites Installed');
if (count($installed_suites) > 0) {
foreach ($installed_suites as $identifier) {
$test_suite = new pts_test_suite($identifier);
echo '- ' . $test_suite->get_title() . PHP_EOL;
}
echo PHP_EOL;
}
}
示例13: __construct
public function __construct($identifier = null)
{
if (strpos($identifier, '<?xml version="1.0"?>') === false) {
if (PTS_IS_CLIENT && (!defined('PTS_TEST_PROFILE_PATH') || !is_file(PTS_TEST_PROFILE_PATH . $identifier . '/test-definition.xml'))) {
$identifier = pts_openbenchmarking::evaluate_string_to_qualifier($identifier, true, 'test');
if ($identifier == false && pts_openbenchmarking::openbenchmarking_has_refreshed() == false) {
// Test profile might be brand new, so refresh repository and then check
// pts_openbenchmarking::refresh_repository_lists(null, true);
$identifier = pts_openbenchmarking::evaluate_string_to_qualifier($identifier, true, 'test');
}
}
}
$this->xml_parser = new pts_test_nye_XmlReader($identifier);
if (!isset($identifier[64])) {
// Passed is not an identifier since it's too long
$this->identifier = $identifier;
}
}
示例14: add_to_suite_from_reader
public function add_to_suite_from_reader(&$xml_reader)
{
$test_names = $xml_reader->getXMLArrayValues('PhoronixTestSuite/Execute/Test');
$sub_arguments = $xml_reader->getXMLArrayValues('PhoronixTestSuite/Execute/Arguments');
$sub_arguments_description = $xml_reader->getXMLArrayValues('PhoronixTestSuite/Execute/Description');
$sub_modes = $xml_reader->getXMLArrayValues('PhoronixTestSuite/Execute/Mode');
$override_test_options = $xml_reader->getXMLArrayValues('PhoronixTestSuite/Execute/OverrideTestOptions');
for ($i = 0; $i < count($test_names); $i++) {
$identifier = pts_openbenchmarking::evaluate_string_to_qualifier($test_names[$i]);
if (empty($identifier)) {
echo PHP_EOL . $test_names[$i] . ' fails.' . PHP_EOL;
exit;
}
$identifier = substr($identifier, 0, strrpos($identifier, '-'));
// strip the version for now
$this->add_to_suite($identifier, $sub_arguments[$i], $sub_arguments_description[$i], $sub_modes[$i], $override_test_options[$i]);
}
}
示例15: run
public static function run($r)
{
pts_client::$display->generic_heading('Unsupported Tests');
foreach (pts_openbenchmarking::available_tests() as $identifier) {
$unsupported = false;
$test_profile = new pts_test_profile($identifier);
if ($test_profile->is_test_architecture_supported() == false) {
$unsupported = 'UNSUPPORTED ARCHITECTURE';
} else {
if ($test_profile->is_test_platform_supported() == false) {
$unsupported = 'UNSUPPORTED PLATFORM';
}
}
if ($unsupported) {
echo sprintf('%-28ls - %-30ls %-9ls', $identifier, $unsupported, $repo_index['tests'][$id]['test_type']) . PHP_EOL;
}
}
}