How to get real CPU frequency while system running? - cpu

Because of the Intel Turbo Boost technology, I can't trust the CPU frequency written on the chip. I want to get the real CPU frequency while system running. I searched that cpufreq device could help. But dev.cpu.n.freq turned out only support for dev.cpu.0.freq.
There are no other OID like dev.cpu.1.freq or dev.cpu.n.freq.
Is there any useful tool could see the CPU frequency immediately?

Regarding the absence of the dev.cpu.N.freq sysctl for N>0, look at the BUGS section of cpufreq(4):
When multiple CPUs offer frequency control, they cannot be set to differ‐
ent levels and must all offer the same frequency settings.
This is why only CPU 0 is reported.

Related

How does Intel's RAPL estimate the power consumption

First of all, I do not know whether I should be asking this here or in the Electronics StackExchange, so please let me know if you think I should ask it there.
I am interested in measuring the energy consumption of each CPU core in Intel CPUs. I have read Intel's Intel 64 developer manual, and, as I understand, RAPL will provide energy estimations for:
The whole Package
The Cores
An unspecified Uncore device (Only in client processors)
The DRAM (Only in server processors)
This would indicate that the best I can aspire to is a value for the collective energy consumption of all the cores in the CPU. However, I also know that "RAPL is not an analog power meter, but rather uses a software power model", according to https://01.org/blogs/2014/running-average-power-limit-%E2%80%93-rapl.
What I would like to know is, is the way this model works known, or publicly available? And, would it be possible to get an estimation of individual core power consumption using metrics provided by RAPL or other interfaces? I know that, if Intel isn't providing this information through RAPL it is probably impossible to get it, but I would like to at least find a source that confirms that.
Thanks for your help!
Here is a post on different tools that you can use to get energy measurements for different Operating Systems. If you are using Linux, consider using the Perf since it uses the RAPL interface to get energy measurements. As far as I know, Perf does not offer energy consumption per core but as a whole (package) and you can get energy measurements for an executable (of any kind: Python, Java, SHELL, C, and so on) using the following command:
sudo perf stat -e power/energy-cores/ ./executable

CPU usage is higher than expected to be possible (over 200% with a total of two cores)

Correct me if I'm wrong, but based on answers to this question and this question, I understand that the percentage of CPU used can easily go up to 100 * number of processors * number of cores per processor without affecting performance too badly; e.g if I have one processor with two cores, my CPU usage should be able to go easily to 200%.
I just checked with top while training a small neural network in Python / TensorFlow, and Python is consistently using over 300% of my single, dual core processor.
I have not been noticing any poor performance in any other applications. How is this possible?
It could be that your particular CPU supports multiple logical threads per physical core by some other mechanism. This question suggests some ways you could discover if this is the case.
With the caveat that I'm kind of guessing, another reason you might see this effect is with Intel's Turbo Boost feature interacting with the way CPU counters and CPU usage are reported.
The 100% * nCores thing breaks down in the presence of things like hyper-threading, CPU frequency scaling, and the murky relationship between what CPU vendors market as "threads" vs. "cores".

How to permanently limit cpu frequency

I need to limit the cpu frequency of my Linux machine.
I know about cpufreq sysfs, but limiting online is too late in my case.
Is there a kernel parameter for this?
Where do the values for cpuinfo_max_freq and scaling_max_freq come from?
Can I change them before the governor starts changing cpu frequencies?
Can I change the default governor (to powersave for example)?
You can achieve this by compiling the kernel and enabling only the "powersave" governor.
This sets the frequency statically to the lowest frequency supported
by the CPU
Check here to see if this can be set as kernel parameter for a multi-governor kernel

How to monitor the utilization of cores on Xeon Phi at 10Hz?

I've been trying to measure/monitor the utilization of all those 60 cores on Xeon Phi (Knights Corner, in-order processors) at a relatively high frequency, say, at least every 0.1s which yields to 10Hz.
I tried the latest PAPI library. But it only supports PAPI_TOT_INS which is the counter of completed instructions. This won't work because I actually need something related to the instructions issued every 0.1s, not finished. Several instructions issued at different cycles may finish at the same cycle. The issue of instructions is influenced by whether the core is halted or not.
Other commands available like 'top' and 'perf' operate at 1Hz which is too slow for my measurement. I need a higher frequency. And, I also need to synchronize the measurement with vital phases of my codes. So, the Intel Vtune Profile does not work for me either.
Is there a possible way for me to monitor the issue of instructions on Xeon Phi or any other activities linked to their utilizations? I understand that those hardware counters are there, but to read them seems very challenging to me. Maybe I can deduce this utilization by measuring the CPU time of each thread?
Thanks.

High PMC counter (ILD_STALL.ANY & ILD_STALL.IQ_FULL) reported on my Intel Westmere system

the PMC counters "ILD_STALL.ANY" and "ILD_STALL.IQ_FULL" are reporting a very high value (i.e almost 50-60 % of cpu frequency) on my Intel Westmere based system. What could be the reason for theses stalls? I am investigating a performance issue, and suspecting these STALLs may as well contribute to performance drop. Is there a way to bring down these stalls?

Resources