tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options

The clustered uncore frequency counters, UMHz*.*
should honor the --show and --hide options.

All non-specified counters should be implicityly hidden.
But when --show was used, UMHz*.* showed up anyway:

$ sudo turbostat -q -S --show Busy%
Busy%  UMHz0.0  UMHz1.0  UMHz2.0  UMHz3.0  UMHz4.0

Indeed, there was no string that can be used to explicitly
show or hide clustered uncore counters.

Even through they are dynamically probed and added,
group the clustered UMHz*.* counters with the legacy
built-in-counter "UncMHz" for show/hide.

turbostat --show Busy%
does not show UMHz*.*.
turbostat --show UncMHz
shows either UncMHz or UMHz*.*, if present
turbostat --hide UncMHz
hides either UncMHz or UMHz*.*, if present

Reported-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Tested-by: Artem Bityutskiy <artem.bityutskiy@intel.com>

+13 -1
+1
tools/power/x86/turbostat/turbostat.8
··· 199 \fBUncMHz\fP per-package uncore MHz, instantaneous sample. 200 .PP 201 \fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample. System summary is the average of all packages. 202 .SH TOO MUCH INFORMATION EXAMPLE 203 By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters. 204 This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.
··· 199 \fBUncMHz\fP per-package uncore MHz, instantaneous sample. 200 .PP 201 \fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample. System summary is the average of all packages. 202 + For the "--show" and "--hide" options, use "UncMHz" to operate on all UMHz*.* as a group. 203 .SH TOO MUCH INFORMATION EXAMPLE 204 By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters. 205 This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.
+12 -1
tools/power/x86/turbostat/turbostat.c
··· 6703 sprintf(path, "%s/current_freq_khz", path_base); 6704 sprintf(name_buf, "UMHz%d.%d", domain_id, cluster_id); 6705 6706 - add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id); 6707 6708 if (quiet) 6709 continue;
··· 6703 sprintf(path, "%s/current_freq_khz", path_base); 6704 sprintf(name_buf, "UMHz%d.%d", domain_id, cluster_id); 6705 6706 + /* 6707 + * Once add_couter() is called, that counter is always read 6708 + * and reported -- So it is effectively (enabled & present). 6709 + * Only call add_counter() here if legacy BIC_UNCORE_MHZ (UncMHz) 6710 + * is (enabled). Since we are in this routine, we 6711 + * know we will not probe and set (present) the legacy counter. 6712 + * 6713 + * This allows "--show/--hide UncMHz" to be effective for 6714 + * the clustered MHz counters, as a group. 6715 + */ 6716 + if BIC_IS_ENABLED(BIC_UNCORE_MHZ) 6717 + add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id); 6718 6719 if (quiet) 6720 continue;