tools/power turbostat: Enable non-privileged users to read sysfs counters
authorPatryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Thu, 25 Apr 2024 15:54:18 +0000 (17:54 +0200)
committerLen Brown <len.brown@intel.com>
Wed, 1 May 2024 04:04:25 +0000 (00:04 -0400)
commit0e39702fbbcdb16ad349439065d24a3bb5e2f331
treed4676ee46fd47243da2064cae6d1440a4fcaf5e6
parentd3e6f6253895f499b63bac261b81732f9efc4902
tools/power turbostat: Enable non-privileged users to read sysfs counters

A group of counters called "sysfs" displays software
C-state request counts and resulting perceived C-state residency.

They are not built-in counters that turbostat knows about ahead of time,
rather they are discovered in sysfs when turbostat starts.

Thus, they are added dynamically, using the same interface
as user-added MSR counters.

When turbostat enters "no-msr" mode, such as when running as a
non-privileged user, it clears all added counters.

Updating that to clear only actual MSR added counters
allows regular users to see the sysfs counters.

[lenb: commit message]

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c