How to use get_system_hardware method of pts_result_file class

Best Phoronix-test-suite code snippet using pts_result_file.get_system_hardware

pts_result_file.php

Source:pts_result_file.php Github

copy

Full Screen

...164 public function get_systems()165 {166 return $this->systems;167 }168 public function get_system_hardware()169 {170 // XXX this is deprecated171 $hw = array();172 foreach($this->get_systems() as $s)173 {174 $hw[] = $s->get_hardware();175 }176 return $hw;177 }178 public function get_system_software()179 {180 // XXX this is deprecated181 $sw = array();182 foreach($this->get_systems() as $s)183 {184 $sw[] = $s->get_software();185 }186 return $sw;187 }188 public function get_system_identifiers()189 {190 // XXX this is deprecated191 $ids = array();192 foreach($this->get_systems() as $s)193 {194 $ids[] = $s->get_identifier();195 }196 return $ids;197 }198 public function is_system_identifier_in_result_file($identifier)199 {200 foreach($this->get_systems() as $s)201 {202 if($s->get_identifier() == $identifier)203 {204 return true;205 }206 }207 return false;208 }209 public function get_system_count()210 {211 return count($this->systems);212 }213 public function set_title($new_title)214 {215 if($new_title != null)216 {217 $this->title = $new_title;218 }219 }220 public function get_title()221 {222 return $this->title;223 }224 public function set_description($new_description)225 {226 if($new_description != null)227 {228 $this->description = $new_description;229 }230 }231 public function get_description()232 {233 return $this->description;234 }235 public function set_notes($notes)236 {237 if($notes != null)238 {239 $this->notes = $notes;240 }241 }242 public function get_notes()243 {244 return $this->notes;245 }246 public function set_internal_tags($tags)247 {248 if($tags != null)249 {250 $this->internal_tags = $tags;251 }252 }253 public function get_internal_tags()254 {255 return $this->internal_tags;256 }257 public function set_reference_id($new_reference_id)258 {259 if($new_reference_id != null)260 {261 $this->reference_id = $new_reference_id;262 }263 }264 public function get_reference_id()265 {266 return $this->reference_id;267 }268 public function set_preset_environment_variables($env)269 {270 if($env != null)271 {272 $this->preset_environment_variables = $env;273 }274 }275 public function get_preset_environment_variables()276 {277 return $this->preset_environment_variables;278 }279 public function get_test_count()280 {281 return count($this->get_result_objects());282 }283 public function has_matching_test_and_run_identifier(&$test_result, $run_identifier_to_check)284 {285 $found_match = false;286 $hash_to_check = $test_result->get_comparison_hash();287 foreach($this->get_result_objects() as $result_object)288 {289 if($hash_to_check == $result_object->get_comparison_hash())290 {291 if(in_array($run_identifier_to_check, $result_object->test_result_buffer->get_identifiers()))292 {293 $found_match = true;294 }295 break;296 }297 }298 return $found_match;299 }300 public function get_contained_tests_hash($raw_output = true)301 {302 $result_object_hashes = $this->get_result_object_hashes();303 sort($result_object_hashes);304 return sha1(implode(',', $result_object_hashes), $raw_output);305 }306 public function get_result_object_hashes()307 {308 $object_hashes = array();309 foreach($this->get_result_objects() as $result_object)310 {311 $object_hashes[] = $result_object->get_comparison_hash();312 }313 return $object_hashes;314 }315 public function is_results_tracker()316 {317 // If there are more than five results and the only changes in the system identifier names are numeric changes, assume it's a tracker318 // i.e. different dates or different versions of a package being tested319 if($this->is_tracker === -1)320 {321 $identifiers = $this->get_system_identifiers();322 if(isset($identifiers[5]))323 {324 // dirty SHA1 hash check325 $is_sha1_hash = strlen($identifiers[0]) == 40 && strpos($identifiers[0], ' ') === false;326 $has_sha1_shorthash = false;327 foreach($identifiers as $i => &$identifier)328 {329 $has_sha1_shorthash = ($i == 0 || $has_sha1_shorthash) && isset($identifier[7]) && pts_strings::string_only_contains(substr($identifier, -8), pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER) && strpos($identifier, ' ') === false;330 $identifier = pts_strings::remove_from_string($identifier, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_DECIMAL);331 }332 $this->is_tracker = count(array_unique($identifiers)) <= 1 || $is_sha1_hash || $has_sha1_shorthash;333 if($this->is_tracker)334 {335 $hw = $this->get_system_hardware();336 if(isset($hw[1]) && count($hw) == count(array_unique($hw)))337 {338 // it can't be a results tracker if the hardware is always different339 $this->is_tracker = false;340 }341 }342 if($this->is_tracker == false)343 {344 // See if only numbers are changing between runs345 foreach($identifiers as $i => &$identifier)346 {347 if(($x = strpos($identifier, ': ')) !== false)348 {349 $identifier = substr($identifier, ($x + 2));350 }351 if($i > 0 && pts_strings::remove_from_string($identifier, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL) != pts_strings::remove_from_string($identifiers[($i - 1)], pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL))352 {353 return false;354 }355 }356 $this->is_tracker = true;357 }358 }359 else360 {361 // Definitely not a tracker as not over 5 results362 $this->is_tracker = false;363 }364 }365 return $this->is_tracker;366 }367 public function is_multi_way_comparison($identifiers = false, $extra_attributes = null)368 {369 if(isset($extra_attributes['force_tracking_line_graph']))370 {371 // Phoromatic result tracker372 $is_multi_way = true;373 $this->is_multi_way_inverted = true;374 }375 else376 {377 $hw = null; // XXX: this isn't used anymore at least for now on system hardware378 if($identifiers == false)379 {380 $identifiers = $this->get_system_identifiers();381 }382 $is_multi_way = count($identifiers) < 2 ? false : pts_render::multi_way_identifier_check($identifiers, $hw, $this);383 $this->is_multi_way_inverted = $is_multi_way && $is_multi_way[1];384 }385 return $is_multi_way;386 }387 public function invert_multi_way_invert()388 {389 $this->is_multi_way_inverted = !$this->is_multi_way_inverted;390 }391 public function is_multi_way_inverted()392 {393 return $this->is_multi_way_inverted;394 }395 public function get_contained_test_profiles()396 {397 $test_profiles = array();398 foreach($this->get_result_objects() as $object)399 {400 $test_profiles[] = $object->test_profile;401 }402 return $test_profiles;403 }404 public function override_result_objects($result_objects)405 {406 $this->result_objects = $result_objects;407 }408 public function get_result($ch)409 {410 return isset($this->result_objects[$ch]) ? $this->result_objects[$ch] : false;411 }412 public function remove_result_object_by_id($index)413 {414 if(isset($this->result_objects[$index]))415 {416 unset($this->result_objects[$index]);417 return true;418 }419 return false;420 }421 public function get_result_objects($select_indexes = -1)422 {423 if($select_indexes != -1 && $select_indexes !== null)424 {425 $objects = array();426 if($select_indexes == 'ONLY_CHANGED_RESULTS')427 {428 foreach($this->result_objects as &$result)429 {430 // Only show results where the variation was greater than or equal to 1%431 if(abs($result->largest_result_variation(0.01)) >= 0.01)432 {433 $objects[] = $result;434 }435 }436 }437 else438 {439 foreach(pts_arrays::to_array($select_indexes) as $index)440 {441 if(isset($this->result_objects[$index]))442 {443 $objects[] = $this->result_objects[$index];444 }445 }446 }447 return $objects;448 }449 return $this->result_objects;450 }451 public function to_json()452 {453 $file = $this->get_xml();454 $file = str_replace(array("\n", "\r", "\t"), '', $file);455 $file = trim(str_replace('"', "'", $file));456 $simple_xml = simplexml_load_string($file);457 return json_encode($simple_xml);458 }459 public function avoid_duplicate_identifiers()460 {461 // avoid duplicate test identifiers462 foreach(pts_arrays::duplicates_in_array($this->get_system_identifiers()) as $duplicate)463 {464 while($this->is_system_identifier_in_result_file($duplicate))465 {466 $i = 0;467 do468 {469 $i++;470 $new_identifier = $duplicate . ' #' . $i;471 }472 while($this->is_system_identifier_in_result_file($new_identifier));473 $this->rename_run($duplicate, $new_identifier);474 }475 }476 }477 public function rename_run($from, $to)478 {479 if($from == 'PREFIX')480 {481 foreach($this->systems as &$s)482 {483 $s->set_identifier($to . ': ' . $s->get_identifier());484 }485 }486 else if($from == null)487 {488 if(count($this->systems) == 1)489 {490 foreach($this->systems as &$s)491 {492 $s->set_identifier($to);493 break;494 }495 }496 }497 else498 {499 foreach($this->systems as &$s)500 {501 if($s->get_identifier() == $from)502 {503 $s->set_identifier($to);504 break;505 }506 }507 }508 foreach($this->result_objects as &$result)509 {510 $result->test_result_buffer->rename($from, $to);511 }512 }513 public function reorder_runs($new_order)514 {515 foreach($new_order as $identifier)516 {517 foreach($this->systems as $i => $s)518 {519 if($s->get_identifier() == $identifier)520 {521 $c = $s;522 unset($this->systems[$i]);523 $this->systems[] = $c;524 break;525 }526 }527 }528 foreach($this->result_objects as &$result)529 {530 $result->test_result_buffer->reorder($new_order);531 }532 }533 public function remove_run($remove)534 {535 $remove = pts_arrays::to_array($remove);536 foreach($this->systems as $i => &$s)537 {538 if(in_array($s->get_identifier(), $remove))539 {540 unset($this->systems[$i]);541 }542 }543 foreach($this->result_objects as &$result)544 {545 $result->test_result_buffer->remove($remove);546 }547 }548 public function add_to_result_file(&$result_file, $only_merge_results_already_present = false)549 {550 foreach($result_file->get_systems() as $s)551 {552 if(!in_array($s, $this->systems))553 {554 $this->systems[] = $s;555 }556 }557 foreach($result_file->get_result_objects() as $result)558 {559 $this->add_result($result, $only_merge_results_already_present);560 }561 }562 public function result_hash_exists(&$result_object)563 {564 $ch = $result_object->get_comparison_hash(true, false);565 return isset($this->result_objects[$ch]) && isset($this->result_objects[$ch]->test_result_buffer);566 }567 public function add_result(&$result_object, $only_if_result_already_present = false)568 {569 $ch = $result_object->get_comparison_hash(true, false);570 if(isset($this->result_objects[$ch]) && isset($this->result_objects[$ch]->test_result_buffer))571 {572 foreach($result_object->test_result_buffer->get_buffer_items() as $bi)573 {574 if($bi->get_result_value() === null)575 {576 continue;577 }578 $this->result_objects[$ch]->test_result_buffer->add_buffer_item($bi);579 }580 }581 else if($only_if_result_already_present == false)582 {583 $this->result_objects[$ch] = $result_object;584 }585 return $ch;586 }587 public function add_result_return_object(&$result_object, $only_if_result_already_present = false)588 {589 $ch = $this->add_result($result_object, $only_if_result_already_present);590 return isset($this->result_objects[$ch]) ? $this->result_objects[$ch] : false;591 }592 public function get_xml($to = null, $force_nice_formatting = false)593 {594 $xml_writer = new nye_XmlWriter(null, $force_nice_formatting);595 $xml_writer->addXmlNode('PhoronixTestSuite/Generated/Title', $this->get_title());596 $xml_writer->addXmlNode('PhoronixTestSuite/Generated/LastModified', date('Y-m-d H:i:s'));597 $xml_writer->addXmlNode('PhoronixTestSuite/Generated/TestClient', pts_core::program_title(true));598 $xml_writer->addXmlNode('PhoronixTestSuite/Generated/Description', $this->get_description());599 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/Generated/Notes', $this->get_notes());600 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/Generated/InternalTags', $this->get_internal_tags());601 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/Generated/ReferenceID', $this->get_reference_id());602 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/Generated/PreSetEnvironmentVariables', $this->get_preset_environment_variables());603 // Write the system hardware/software information604 foreach($this->get_systems() as $s)605 {606 $xml_writer->addXmlNode('PhoronixTestSuite/System/Identifier', $s->get_identifier());607 $xml_writer->addXmlNode('PhoronixTestSuite/System/Hardware', $s->get_hardware());608 $xml_writer->addXmlNode('PhoronixTestSuite/System/Software', $s->get_software());609 $xml_writer->addXmlNode('PhoronixTestSuite/System/User', $s->get_username());610 $xml_writer->addXmlNode('PhoronixTestSuite/System/TimeStamp', $s->get_timestamp());611 $xml_writer->addXmlNode('PhoronixTestSuite/System/TestClientVersion', $s->get_client_version());612 $xml_writer->addXmlNode('PhoronixTestSuite/System/Notes', $s->get_notes());613 if(!defined('USER_PTS_CORE_VERSION') || USER_PTS_CORE_VERSION > 3722)614 {615 // Ensure that a supported result file schema is being written...616 // USER_PTS_CORE_VERSION is set by OpenBenchmarking.org so if the requested client is old, don't write this data to send back to their version617 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/System/JSON', ($s->get_json() ? json_encode($s->get_json()) : null));618 }619 }620 // Write the results621 foreach($this->get_result_objects() as $result_object)622 {623 $buffer_items = $result_object->test_result_buffer->get_buffer_items();624 if(count($buffer_items) == 0)625 {626 continue;627 }628 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Identifier', $result_object->test_profile->get_identifier());629 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Title', $result_object->test_profile->get_title());630 $xml_writer->addXmlNode('PhoronixTestSuite/Result/AppVersion', $result_object->test_profile->get_app_version());631 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Arguments', $result_object->get_arguments());632 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Description', $result_object->get_arguments_description());633 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Scale', $result_object->test_profile->get_result_scale());634 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Proportion', $result_object->test_profile->get_result_proportion());635 $xml_writer->addXmlNode('PhoronixTestSuite/Result/DisplayFormat', $result_object->test_profile->get_display_format());636 foreach($buffer_items as $i => &$buffer_item)637 {638 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Data/Entry/Identifier', $buffer_item->get_result_identifier());639 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Data/Entry/Value', $buffer_item->get_result_value());640 $xml_writer->addXmlNode('PhoronixTestSuite/Result/Data/Entry/RawString', $buffer_item->get_result_raw());641 if(!defined('USER_PTS_CORE_VERSION') || USER_PTS_CORE_VERSION > 3722)642 {643 // Ensure that a supported result file schema is being written...644 // USER_PTS_CORE_VERSION is set by OpenBenchmarking.org so if the requested client is old, don't write this data to send back to their version645 $xml_writer->addXmlNodeWNE('PhoronixTestSuite/Result/Data/Entry/JSON', ($buffer_item->get_result_json() ? json_encode($buffer_item->get_result_json()) : null));646 }647 }648 }649 return $to == null ? $xml_writer->getXML() : $xml_writer->saveXMLFile($to);650 }651 public function merge($result_merges_to_combine, $pass_attributes = 0, $add_prefix = null, $merge_meta = false)652 {653 if(!is_array($result_merges_to_combine) || empty($result_merges_to_combine))654 {655 return false;656 }657 foreach($result_merges_to_combine as $i => &$merge_select)658 {659 if(!($merge_select instanceof $merge_select))660 {661 $merge_select = new pts_result_merge_select($merge_select);662 }663 if(!is_file($merge_select->get_result_file()))664 {665 if(defined('PTS_SAVE_RESULTS_PATH') && is_file(PTS_SAVE_RESULTS_PATH . $merge_select->get_result_file() . '/composite.xml'))666 {667 $merge_select->set_result_file(PTS_SAVE_RESULTS_PATH . $merge_select->get_result_file() . '/composite.xml');668 }669 else670 {671 unset($result_merges_to_combine[$i]);672 }673 }674 }675 if(empty($result_merges_to_combine))676 {677 return false;678 }679 foreach($result_merges_to_combine as &$merge_select)680 {681 $result_file = new pts_result_file($merge_select->get_result_file(), true);682 if($add_prefix)683 {684 $result_file->rename_run('PREFIX', $add_prefix);685 }686 else if($merge_select->get_rename_identifier())687 {688 $result_file->rename_run(null, $merge_select->get_rename_identifier());689 }690 if($this->get_title() == null && $result_file->get_title() != null)691 {692 $this->set_title($result_file->get_title());693 }694 if($this->get_description() == null && $result_file->get_description() != null)695 {696 $this->set_description($result_file->get_description());697 }698 $this->add_to_result_file($result_file);699 if($merge_meta)700 {701 $this->set_title($this->get_title() . ', ' . $result_file->get_title());702 $this->set_description($this->get_description() . PHP_EOL . PHP_EOL . $result_file->get_title() . ': ' . $result_file->get_description());703 }704 unset($result_file);705 }706 }707 public function contains_system_hardware($search)708 {709 foreach($this->get_system_hardware() as $h)710 {711 if(stripos($h, $search) !== false)712 {713 return true;714 }715 }716 return false;717 }718 public function contains_system_software($search)719 {720 foreach($this->get_system_software() as $s)721 {722 if(stripos($s, $search) !== false)723 {...

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1require_once('pts_result_file_analyzer.php');2$rf = new pts_result_file_analyzer();3$rf->load_result_file('result_file.xml');4$rf->get_system_hardware();5require_once('pts_result_file_analyzer.php');6$rf = new pts_result_file_analyzer();7$rf->load_result_file('result_file.xml');8$rf->get_system_hardware();

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1include_once('pts_result_file.php');2$rf = new pts_result_file('result.xml');3$rf->get_system_hardware();4 (5 (6 (7 (8 (9 (10 (11 (12 (13 (14 (15 (16 [0] => Intel Open Source Technology Center Mesa DRI Intel(R) Sandybridge Mobile x86/MMX/SSE217 (18 (19 (20 (21include_once('pts_result_file.php');22$rf = new pts_result_file('result.xml');23$rf->get_system_hardware('

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1require_once('pts_result_file.php');2$pts_result_file = new pts_result_file();3$system_hardware = $pts_result_file->get_system_hardware();4print_r($system_hardware);5 (6 [1] => Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz7 (8 (9 (10 (11 (12 (13 (14 (

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1require_once('pts_result_file.php');2$rf = new pts_result_file('result_file.xml');3$rf->get_system_hardware();4require_once('pts_result_file.php');5$rf = new pts_result_file('result_file.xml');6$rf->get_system_software();7require_once('pts_result_file.php');8$rf = new pts_result_file('result_file.xml');9$rf->get_system_hardware();10require_once('pts_result_file.php');11$rf = new pts_result_file('result_file.xml');12$rf->get_system_hardware();13require_once('pts_result_file.php');14$rf = new pts_result_file('result_file.xml');15$rf->get_system_hardware();16require_once('pts_result_file.php');

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1include_once('pts_result_file.php');2$pts_result_file = new pts_result_file('result_file.xml');3$system_hardware = $pts_result_file->get_system_hardware();4echo $system_hardware;5include_once('pts_result_file.php');6$pts_result_file = new pts_result_file('result_file.xml');7$result_file_version = $pts_result_file->get_result_file_version();8echo $result_file_version;9include_once('pts_result_file.php');10$pts_result_file = new pts_result_file('result_file.xml');11$result_file_title = $pts_result_file->get_result_file_title();12echo $result_file_title;

Full Screen

Full Screen

get_system_hardware

Using AI Code Generation

copy

Full Screen

1require_once 'phoronix_test_suite.php';2$result = new pts_result_file('result.xml');3$system_hardware = $result->get_system_hardware();4print_r($system_hardware);5 [Memory] => 8192MB (DDR3-1066MHz)6require_once 'phoronix_test_suite.php';7$result = new pts_result_file('result.xml');8$result_objects = $result->get_result_objects();9print_r($result_objects);10 (

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in pts_result_file

Trigger get_system_hardware code on LambdaTest Cloud Grid

Execute automation tests with get_system_hardware on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful