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

System informations cpu_brand is always empty #2794

Open
4 tasks done
AMS21 opened this issue Feb 6, 2025 · 0 comments · May be fixed by #2797
Open
4 tasks done

System informations cpu_brand is always empty #2794

AMS21 opened this issue Feb 6, 2025 · 0 comments · May be fixed by #2797
Labels
bug Something isn't working

Comments

@AMS21
Copy link

AMS21 commented Feb 6, 2025

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Experimenting a bit I noticed that the cpu_brand is always an empty string. Running the system_information example with cargo r --package system_information for example. On my machine looks like this:

Image

Looking at the implementation shows that here we fill out the Information struct like this:

use sysinfo::{Process, System};
    let mut system = System::new_all();
    system.refresh_all();

    let cpu = system.global_cpu_info();

    // ...

    Information {
        // ...
        cpu_brand: cpu.brand().into(),
        // ...
    }

Reading the documentation for System::global_cpu_info() from here it states:

...
⚠️ Important ⚠️

Information like [Cpu::brand](https://docs.rs/sysinfo/0.30.13/sysinfo/struct.Cpu.html#method.brand), 
[Cpu::vendor_id](https://docs.rs/sysinfo/0.30.13/sysinfo/struct.Cpu.html#method.vendor_id) or [Cpu::frequency]
(https://docs.rs/sysinfo/0.30.13/sysinfo/struct.Cpu.html#method.frequency) are not set on the “global” CPU.

which would explain why the cpu_brand always shows an empty String.

What is the expected behavior?

cpu_brand not being an empty string.

Version

master

Operating System

Linux

Do you have any log output?

N/A
@AMS21 AMS21 added the bug Something isn't working label Feb 6, 2025
AMS21 added a commit to AMS21/iced that referenced this issue Feb 7, 2025
This was caused by a misuse of the `global_cpu_info` function, which was
does not contain a valid `cpu_brand` field.

To fix this, we now get the first cpu and return it's brand instead.

Fixes iced-rs#2794
AMS21 added a commit to AMS21/iced that referenced this issue Feb 7, 2025
This was caused by a misuse of the `global_cpu_info` function, which
does not contain a valid `cpu_brand` field.

To fix this, we now get the first cpu and return it's brand instead.

Fixes iced-rs#2794
@AMS21 AMS21 linked a pull request Feb 7, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant