Added CPU freq measurements
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
dacaefab40
commit
f090413392
|
@ -278,6 +278,42 @@ function device_cputop_async(string $atf_host, string $device) : Amp\Promise
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function device_cpu_freq_min_async(string $atf_host, string $device, int $core_index = 0) : Amp\Promise
|
||||||
|
{
|
||||||
|
return device_cpu_measure_async($atf_host, $device, "cpuinfo_min_freq", $core_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function device_cpu_freq_max_async(string $atf_host, string $device, int $core_index = 0) : Amp\Promise
|
||||||
|
{
|
||||||
|
return device_cpu_measure_async($atf_host, $device, "cpuinfo_max_freq", $core_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function device_cpu_freq_cur_async(string $atf_host, string $device, int $core_index = 0) : Amp\Promise
|
||||||
|
{
|
||||||
|
return device_cpu_measure_async($atf_host, $device, "scaling_cur_freq", $core_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function device_cpu_measure_async(string $atf_host, string $device, string $metric, int $core_index) : Amp\Promise
|
||||||
|
{
|
||||||
|
return Amp\call(function() use($atf_host, $device, $metric, $core_index) {
|
||||||
|
//NOTE: on current devices 16 thermal zone are responsible for GPU temperature probing
|
||||||
|
list($code, $lines) = yield host_exec_async($atf_host, "%{adb}% -s $device shell cat /sys/devices/system/cpu/cpu$core_index/cpufreq/$metric", DEPLOY_OPT_ERR_OK, 1);
|
||||||
|
|
||||||
|
if($code !== 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
foreach($lines as $idx => $line)
|
||||||
|
{
|
||||||
|
$line = trim($line);
|
||||||
|
if(!$line)
|
||||||
|
continue;
|
||||||
|
return intval($line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function device_temperature_async(string $atf_host, string $device) : Amp\Promise
|
function device_temperature_async(string $atf_host, string $device) : Amp\Promise
|
||||||
{
|
{
|
||||||
return Amp\call(function() use($atf_host, $device) {
|
return Amp\call(function() use($atf_host, $device) {
|
||||||
|
|
Loading…
Reference in New Issue