Skip to content

Commit 34537dd

Browse files
Patryk Wlazlynlenb
authored andcommitted
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>
1 parent 7c6fee2 commit 34537dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4615,7 +4615,8 @@ unsigned long pmt_gen_value_mask(unsigned int lsb, unsigned int msb)
46154615

46164616
unsigned long pmt_read_counter(struct pmt_counter *ppmt, unsigned int domain_id)
46174617
{
4618-
assert(domain_id < ppmt->num_domains);
4618+
if (domain_id >= ppmt->num_domains)
4619+
return 0;
46194620

46204621
const unsigned long *pmmio = ppmt->domains[domain_id].pcounter;
46214622
const unsigned long value = pmmio ? *pmmio : 0;

0 commit comments

Comments
 (0)