diff options
author | Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> | 2024-12-10 20:27:38 +0300 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2025-01-27 20:35:22 +0300 |
commit | 34537ddd208d614dbefeb97823ae1c79e7771588 (patch) | |
tree | ef4b3c526cfb73cc3356e818a2c69faeecae27d9 | |
parent | 7c6fee25bdf5c8f8a1bcc6fa3566fffb7fe9eb9a (diff) | |
download | linux-34537ddd208d614dbefeb97823ae1c79e7771588.tar.xz |
tools/power turbostat: Return default value for unmapped PMT domains
When requesting PMT counters with --add command, user may want to skip
specifying values for all the domains (that is, cpu, core, package etc).
For the domains that user did not provide information on how to read the
counter, return default value - zero.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 6b72b922e2f5..60b1ade8659b 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4615,7 +4615,8 @@ unsigned long pmt_gen_value_mask(unsigned int lsb, unsigned int msb) unsigned long pmt_read_counter(struct pmt_counter *ppmt, unsigned int domain_id) { - assert(domain_id < ppmt->num_domains); + if (domain_id >= ppmt->num_domains) + return 0; const unsigned long *pmmio = ppmt->domains[domain_id].pcounter; const unsigned long value = pmmio ? *pmmio : 0; |