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

How to obtain information of CPU frequency? #221

Open
yichenchenyi opened this issue Jan 30, 2024 · 2 comments
Open

How to obtain information of CPU frequency? #221

yichenchenyi opened this issue Jan 30, 2024 · 2 comments

Comments

@yichenchenyi
Copy link

if (core->processor_count == 1) {
printf("\t%" PRIu32 ": 1 processor (%" PRIu32 "), Frequency: %" PRIu64 " Hz\n",
i,
core->processor_start,
core->frequency);
}
Frequency output 0

@prashanthswami
Copy link
Collaborator

We don't currently mark frequency as one of the "Exposed Information" fields in our README.md, so I wouldn't take a dependency on it just yet. As for why it doesn't work, we don't currently populate that field in the ARM init files.

I'm not actually sure if there's some reason as to why, since we seem to read min/max frequency information. @malfet any idea if there's a reason we don't do this yet, or is it just a feature we need to implement at some point?

@prashanthswami
Copy link
Collaborator

One other errant thought about this - it's unfortunate that we call this 'frequency' and not 'min_frequency' or 'max_frequency' - the latter are well-defined, but the former isn't great for us to surface. It's hard from a user perspective to appreciate that they are getting the instantaneous frequency read at the time of cpuinfo_initialize whereas the governor could have clocked the calling process up or down in the interim. Hopefully no one is relying on it at the moment, as it always returns zero, but maybe this is an opportunity to create an explicit min / max attribute and just remove 'frequency' to prevent any further usage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants