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

Add governor information #1057

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

patrickelectric
Copy link
Contributor

Signed-off-by: Patrick José Pereira [email protected]

Signed-off-by: Patrick José Pereira <[email protected]>
@patrickelectric patrickelectric marked this pull request as draft September 3, 2023 16:19
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
@patrickelectric
Copy link
Contributor Author

@GuillaumeGomez it's ready to review, it appears that the CI error is not from this patch

@@ -232,6 +232,9 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
sys.global_cpu_info().frequency()
);
}
"governor" => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not displaying this information as part of the CPUs directly?

/// );
/// println!("{}%", s.global_cpu_info().cpu_usage());
/// ```
fn governor(&self) -> GovernorKind;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this from SystemExt, it should only be on CpuExt.

/// println!("{}", cpu.governor());
/// }
/// ```
fn governor(&self) -> GovernorKind;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should return an Option in case this information hasn't been retrieved yet.

@GuillaumeGomez
Copy link
Owner

A few things to change but also: I won't merge this PR until this feature is implemented for all supported systems.

@patrickelectric
Copy link
Contributor Author

A few things to change but also: I won't merge this PR until this feature is implemented for all supported systems.

Is this truly necessary ? Can't we make it an optional and have others OSs implementing it and allowing not having support ?

I don't have access to all OSs, and that's open source.. others may add this functionality if it's necessary, I'm just creating the background to support it.

@GuillaumeGomez
Copy link
Owner

Is this truly necessary ?

Yes it is.

Can't we make it an optional and have others OSs implementing it and allowing not having support ?

The only way to have something optional is in case an OS doesn't support this feature. Otherwise it might very well never be implemented. It also forces to add special handling in tests, meaning more code to maintain.

I don't have access to all OSs, and that's open source.. others may add this functionality if it's necessary, I'm just creating the background to support it.

I do everything with VMs. You can always ask help and see if others are interested into this feature and willing to help you implement it.

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

Successfully merging this pull request may close these issues.

2 participants