High latency of reading the current CPU frequency from sysfs
CPU governor which was active during the tests below: performance.
Ryzen 7 3700X (8 cores, 16 threads): latency 200 milliseconds
$ while true; do /usr/bin/time cat /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq; sleep 1; done
3755299
....
3995430
0.000000user 0.000944system 0:00.193443elapsed
Ryzen 9 3900X (12 cores, 24 threads): latency 800 milliseconds
$ while true; do /usr/bin/time cat /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq; sleep 1; done
3600014
....
3600767
0.001208user 0.000000system 0:00.791856elapsed 0%CPU
However, with a sleep interval of 0.5 seconds, the latency on Ryzen 7 3700X is only 500 microseconds:
$ while true; do /usr/bin/time cat /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq; sleep 0.5; done
3735508
....
3632941
0.000926user 0.000000system 0:00.193690elapsed 0%CPU
3739502
....
4243973
0.000551user 0.000000system 0:00.000583elapsed 94%CPU