pts-core: Few fixes and NPU detection

This commit is contained in:
Michael Larabel
2025-01-26 06:39:07 -06:00
parent f665ba8ee7
commit e1fdc09426
6 changed files with 40 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
Copyright 2008 - 2024 by Phoronix Media.
Copyright 2008 - 2025 by Phoronix Media.
Lead Architects:

View File

@@ -3,8 +3,8 @@
#
# Phoronix Test Suite
# URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
# Copyright (C) 2008 - 2021, Phoronix Media
# Copyright (C) 2008 - 2021, Michael Larabel
# Copyright (C) 2008 - 2025, Phoronix Media
# Copyright (C) 2008 - 2025, Michael Larabel
# phoronix-test-suite: The Phoronix Test Suite is an extensible open-source testing / benchmarking platform
#
# This program is free software; you can redistribute it and/or modify
@@ -76,12 +76,12 @@ then
elif [ -x /usr/bin/php ] || [ -x /usr/pkg/bin/php ]
then
export PHP_BIN="php"
elif [ -x /usr/php7/bin/php ]
then
export PHP_BIN="/usr/php7/bin/php"
elif [ -x /usr/php8/bin/php ]
then
export PHP_BIN="/usr/php8/bin/php"
elif [ -x /usr/php7/bin/php ]
then
export PHP_BIN="/usr/php7/bin/php"
elif [ -x /usr/php/bin/php ]
then
export PHP_BIN="/usr/php/bin/php"
@@ -189,7 +189,7 @@ elif [ -x /usr/bin/pkg_radd ]
then
# BSD
echo "The command to likely run for your operating system is: "
echo "# pkg_radd php7 php7-json php7-zip php7-dom"
echo "# pkg_radd php8 php8-json php8-zip php8-dom"
echo " "
elif [ -x /usr/bin/pacman ]
then

View File

@@ -134,7 +134,10 @@ class pts_module_manager
{
list($var, $value) = pts_strings::trim_explode('=', $ev);
putenv($var . '=' . $value);
pts_env::set($var, $value);
if(pts_env::read($var) == false)
{
pts_env::set($var, $value);
}
pts_module_manager::var_store_add($var, $value);
}
}

View File

@@ -59,6 +59,7 @@ class phodevi_system extends phodevi_device_interface
'kernel-extra-details' => new phodevi_device_property('sw_kernel_extra_details', phodevi::std_caching),
'battery' => new phodevi_device_property('battery', phodevi::smart_caching),
'platform-profile' => new phodevi_device_property('sw_platform_profile', phodevi::std_caching),
'npu' => new phodevi_device_property('npu', phodevi::std_caching),
);
}
public static function sw_username()
@@ -90,6 +91,29 @@ class phodevi_system extends phodevi_device_interface
return $platform_profile;
}
public static function npu()
{
$npus = array();
foreach(pts_file_io::glob('/sys/class/accel/accel*/device/enable') as $accel_device)
{
$enable = pts_file_io::file_get_contents($accel_device);
if($enable == '1')
{
$accel_dir = dirname($accel_device);
$vendor = pts_file_io::file_get_contents($accel_dir . '/vendor');
if($vendor == '0x8086')
{
$npus[] = 'Intel NPU';
}
}
}
if(count(pts_file_io::glob('/sys/memx*/verinfo')) > 0)
{
// Unfortunately no better name reporting...
$npus[] = 'MemryX NPU';
}
return implode(' + ', $npus);
}
public static function sw_kernel_extra_details()
{
$extra = array();

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2018, Phoronix Media
Copyright (C) 2009 - 2018, Michael Larabel
Copyright (C) 2009 - 2025, Phoronix Media
Copyright (C) 2009 - 2025, Michael Larabel
phodevi_base.php: The base object for interacting with the Phoronix Device Interface
This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,8 @@ class phodevi_base
'Graphics' => 'gpu',
'Audio' => 'audio',
'Monitor' => 'monitor',
'Network' => 'network'
'Network' => 'network',
'npu' => array('system', 'npu'),
);
}
public static function available_software_components()

View File

@@ -114,7 +114,7 @@ class pts_graph_lines extends pts_graph_core
protected function render_graph_pre_init()
{
// Do some common work to this object
$this->i['identifier_width'] = $this->max_count > 0 ? round(($this->i['graph_left_end'] - $this->i['left_start']) / $this->max_count) : 1;
$this->i['identifier_width'] = $this->max_count > 0 ? (($this->i['graph_left_end'] - $this->i['left_start']) / $this->max_count) : 1;
if(!$this->i['hide_graph_identifiers'])
{