phodevi: Various hardware fixes

This commit is contained in:
Michael Larabel
2024-02-24 18:56:37 -06:00
parent 9c96e22e1a
commit fd22d6cb09
6 changed files with 140 additions and 21 deletions

View File

@@ -0,0 +1,67 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2024, Phoronix Media
Copyright (C) 2024, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class prune_empty_results implements pts_option_interface
{
const doc_section = 'Result Management';
const doc_description = 'This option is used if there are test results (benchmarks) to be dropped from a given result file that had no successful runs. I.e. if any run attempt(s) only errored out without producing any result for any of the test run(s) saved in that file. The user must specify a saved results file.';
public static function argument_checks()
{
return array(
new pts_argument_check(0, array('pts_types', 'is_result_file'), null)
);
}
public static function run($r)
{
$result_file = new pts_result_file($r[0]);
$remove_count = 0;
$table = array();
foreach($result_file->get_result_objects() as $id => $result)
{
if(!$result->test_result_buffer->has_successful_run())
{
$table[] = array($result->test_profile->get_title(), $result->get_arguments_description(), $result->test_profile->get_result_scale());
$result_file->remove_result_object_by_id($id);
$remove_count++;
}
}
if($remove_count == 0)
{
echo 'No empty result objects found.';
}
else
{
echo PHP_EOL . pts_client::cli_just_bold('Empty results to remove: ') . PHP_EOL;
echo pts_user_io::display_text_table($table) . PHP_EOL . PHP_EOL;
$do_save = pts_user_io::prompt_bool_input('Save the result file changes?');
if($do_save)
{
pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml());
pts_client::display_result_view($result_file, false);
}
}
}
}
?>

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2022, Phoronix Media
Copyright (C) 2008 - 2022, Michael Larabel
Copyright (C) 2008 - 2024, Phoronix Media
Copyright (C) 2008 - 2024, Michael Larabel
phodevi_cpu.php: The PTS Device Interface object for the CPU / processor
This program is free software; you can redistribute it and/or modify
@@ -887,6 +887,7 @@ class phodevi_cpu extends phodevi_device_interface
{
case '0xac3':
case '0xac4':
case '0xac5':
$new_info .= 'One';
break;
}
@@ -1317,6 +1318,7 @@ class phodevi_cpu extends phodevi_device_interface
112 => 'Zen 4',
116 => 'Zen 4', // Ryzen Z1 Extreme
117 => 'Zen 4',
120 => 'Zen 4',
160 => 'Zen 4',
161 => 'Zen 4',
162 => 'Zen 4',
@@ -1335,25 +1337,17 @@ class phodevi_cpu extends phodevi_device_interface
175 => 'Zen 4',
),
26 => array(
0 => 'Zen 5',
1 => 'Zen 5',
2 => 'Zen 5',
3 => 'Zen 5',
4 => 'Zen 5',
5 => 'Zen 5',
6 => 'Zen 5',
7 => 'Zen 5',
8 => 'Zen 5',
9 => 'Zen 5',
10 => 'Zen 5',
11 => 'Zen 5',
12 => 'Zen 5',
13 => 'Zen 5',
14 => 'Zen 5',
15 => 'Zen 5',
// 1Ah for Zen 5 so far
// Auto-populated below due to wide span
),
);
for($i = 0; $i < 128; $i++)
{
// Based on GCC patch and other Linux patches
$amd_map[26][$i] = 'Zen 5';
}
$intel_map = array(
5 => array(
9 => 'Quark',

View File

@@ -1259,10 +1259,33 @@ class phodevi_gpu extends phodevi_device_interface
$controller_3d = phodevi_linux_parser::read_pci('3D controller', false);
$info_pci = phodevi_linux_parser::read_pci('VGA compatible controller', false);
if((empty($info_pci) || strpos($info_pci, ' ') === false) && !empty($controller_3d))
if((empty($info_pci) || strpos($info_pci, ' ') === false || stripos($info_pci, 'aspeed') !== false) && !empty($controller_3d))
{
// e.g. NVIDIA GH200 is 3D controller while VGA is ASpeed
$info_pci = $controller_3d;
if(stripos($controller_3d, 'nvidia') !== false && ($nvidia_smi = pts_client::executable_in_path('nvidia-smi')))
{
// This works for some headless configurations
$nvidia_smi = shell_exec($nvidia_smi . ' -L 2>&1');
if(($x = strpos($nvidia_smi, 'GPU 0: ')) !== false)
{
$nvidia_smi = substr($nvidia_smi, $x + 7);
if(($x = strpos($nvidia_smi, PHP_EOL)) !== false)
{
$nvidia_smi = substr($nvidia_smi, 0, $x);
}
$nvidia_smi = trim($nvidia_smi);
if(!empty($nvidia_smi))
{
$info_pci = $nvidia_smi;
}
}
}
else
{
$info_pci = $controller_3d;
}
}
if(!empty($info_pci) && strpos($info_pci, 'Device ') === false)
@@ -1466,7 +1489,7 @@ class phodevi_gpu extends phodevi_device_interface
$clean_phrases = array('OpenGL Engine');
$info = str_replace($clean_phrases, '', $info);
if(!empty($info) && $video_ram > 64 && strpos($info, $video_ram) == false && stripos($info, 'llvmpipe') === false) // assume more than 64MB of vRAM
if(!empty($info) && $video_ram > 64 && strpos($info, $video_ram) == false && stripos($info, 'llvmpipe') === false && substr($info, -2) != 'GB') // assume more than 64MB of vRAM
{
if($video_ram < 1024)
{

View File

@@ -32,6 +32,11 @@ class phodevi_parser
{
$info = shell_exec('nvidia-settings --query ' . $attribute . ' 2> /dev/null');
if(empty($info))
{
return false;
}
if(($pos = strpos($info, pts_strings::last_in_string($attribute, '/'))) > 0 && strpos($info, 'ERROR:') === false)
{
$nv_info = substr($info, strpos($info, '):') + 3);

View File

@@ -195,6 +195,25 @@ class cpu_power extends phodevi_sensor
$cpu_power = $cpu_power / 100000;
}
}
else if(($power_oem_info = pts_file_io::glob('/sys/class/hwmon/hwmon*/device/power1_oem_info')) && !empty($power_oem_info))
{
// Grace https://docs.nvidia.com/grace-performance-tuning-guide.pdf
foreach($power_oem_info as $info_file)
{
if(stripos(pts_file_io::file_get_contents($info_file), 'CPU Power') !== false)
{
$bdir = dirname($info_file);
if(is_file($bdir . '/power1_average'))
{
$this_power = pts_file_io::file_get_contents($bdir . '/power1_average');
if(is_numeric($this_power) && $this_power > 1000000)
{
$cpu_power += round($this_power / 1000000, 2);
}
}
}
}
}
return round($cpu_power, 2);
}

View File

@@ -101,6 +101,17 @@ class pts_test_result_buffer
}
return false;
}
public function has_successful_run()
{
foreach($this->buffer_items as &$buffer_item)
{
if($buffer_item->get_result_value() != '')
{
return true;
}
}
return false;
}
public function recalculate_buffer_items_min_max()
{
$this->min_value = 0;