Re: [PATCH] cpufreq: stats: Switch to ktime and msec instead of jiffies and usertime

From: Viresh Kumar
Date: Wed Nov 11 2020 - 00:13:57 EST


On 10-11-20, 13:53, Thomas Renninger wrote:
> Am Dienstag, 10. November 2020, 12:07:37 CET schrieb Viresh Kumar:
> > The cpufreq and thermal core, both provide sysfs statistics to help
> > userspace learn about the behavior of frequencies and cooling states.
> >
> > This is how they look:
> > /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state:1200000 399
>
> > The results look like this after this commit:
> > /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state:1200000 3830
>
> How would userspace know whether it's ms or 10ms?
>
> whatabout a new file with the same convention as cooling devices (adding ms):

Keeping two files for same stuff is not great, and renaming the file
breaks userspace ABI. I am not sure what's the right thing to do here.

> > /sys/class/thermal/cooling_device0/stats/time_in_state_ms:state0 3888
> > /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state_ms:1200000 3830
>
> Somewhat off-topic, some ideas:
>
> I wonder how useful these stats still are.
> CPU_FREQ_STAT is off on my system:

I still use it.

> config CPU_FREQ_STAT
> bool "CPU frequency transition statistics"
> help
> Export CPU frequency statistics information through sysfs.
>
> If in doubt, say N.
>
> Iirc this was a module at former times?
>
> commit 1aefc75b2449eb68a6fc3ca932e2a4ee353b748d
> Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Date: Tue May 31 22:14:44 2016 +0200
>
> cpufreq: stats: Make the stats code non-modular
>
> outlined 2 problems with cpufreq_stats being non-modular, but
> also seem to fix them up:
> ... and drop the notifiers from it
> Make the stats sysfs attributes appear empty if fast frequency
> switching is enabled...

I already fixed this recently and stats don't appear empty for fast
switch anymore.

--
viresh