Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantaneous vs. cummulative cpufreq stats #428

Closed
iustin opened this issue Dec 17, 2021 · 6 comments · Fixed by #627
Closed

Instantaneous vs. cummulative cpufreq stats #428

iustin opened this issue Dec 17, 2021 · 6 comments · Fixed by #627
Assignees

Comments

@iustin
Copy link

iustin commented Dec 17, 2021

Hi,

Looking around at issues such as #122 and #123, I see that in both cases, what is collected is the current (i.e. instantaneous) state of the CPUs, either hardware (cpufreq_* counters) or software (scaling_*_freq).

However, if compiled as such, the kernel does provide cummulative statistics via the stats/ subdirectory - see https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html.

I think the time_in_state is the most interesting, followed by total_trans. These would allow much better fidelity of historical CPU state.

Thoughts?

@rexagod
Copy link
Contributor

rexagod commented Mar 22, 2024

+1. Looping in @discordianfish to check if this request makes sense, and if so, I'd be happy to raise a PR. (:

@discordianfish
Copy link
Member

Agreed, I think that would make sense

@iustin
Copy link
Author

iustin commented Mar 23, 2024

Thanks both, I forgot to track this. Would be really good to have cumulative stats.

@rexagod
Copy link
Contributor

rexagod commented Mar 30, 2024

trans_table and time_in_state seem to exhibit a high cardinality nature owing to the CPU frequencies they track. total_trans seems fine to generate metrics for, though.

@iustin
Copy link
Author

iustin commented Mar 31, 2024

Hmm. total_trans is interesting, but mostly a gimmick. Looking at one of my systems that has this module compiled, time_in_state has 10 rows, per CPU, so indeed that's a lot of metrics, but it is the real file that gives the data.

How about hiding this behind a flag, so only people interested enable it? It needs anyway a kernel module, that might not be always available.

@SuperQ
Copy link
Member

SuperQ commented Mar 31, 2024

I think time_in_state metrics make the most useful data.

As this is a generically useful library, the decision on metrics exposition would happen in something like the node_exporter.

rexagod added a commit to rexagod/procfs that referenced this issue Apr 1, 2024
Extracts data from the following files:
* `total_trans`
* `trans_table`
* `time_in_state`

Refer
https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html#configuring-cpufreq-stats.
Fixes: prometheus#428

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
rexagod added a commit to rexagod/procfs that referenced this issue Apr 1, 2024
Extracts data from the following files:
* `total_trans`
* `trans_table`
* `time_in_state`

Refer: https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html#configuring-cpufreq-stats.

Fixes: prometheus#428

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
rexagod added a commit to rexagod/procfs that referenced this issue Apr 1, 2024
Extracts data from the following files:
* `total_trans`
* `trans_table`
* `time_in_state`

Refer: https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html#configuring-cpufreq-stats.

Fixes: prometheus#428

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
SuperQ pushed a commit that referenced this issue May 13, 2024
Extracts data from the following files:
* `total_trans`
* `trans_table`
* `time_in_state`

Refer: https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html#configuring-cpufreq-stats.

Fixes: #428

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
jritter pushed a commit to jritter/procfs that referenced this issue Jul 15, 2024
Extracts data from the following files:
* `total_trans`
* `trans_table`
* `time_in_state`

Refer: https://www.kernel.org/doc/html/latest/cpu-freq/cpufreq-stats.html#configuring-cpufreq-stats.

Fixes: prometheus#428

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants