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>
This commit is contained in:
committed by
Len Brown
parent
7c6fee25bd
commit
34537ddd20
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user