Code Monkey home page Code Monkey logo

Comments (9)

GuillaumeGomez avatar GuillaumeGomez commented on May 31, 2024 1

Try to run System::refresh_all at least once. If it works after this, then it means some values aren't initialized correctly on sysinfo side.

from sysinfo.

GuillaumeGomez avatar GuillaumeGomez commented on May 31, 2024 1

I released the new version.

from sysinfo.

maciejhirsz avatar maciejhirsz commented on May 31, 2024 1

Cool, thanks for doing it so quickly :).

from sysinfo.

GuillaumeGomez avatar GuillaumeGomez commented on May 31, 2024

Code looks correct so that's weird... Taking a look.

from sysinfo.

GuillaumeGomez avatar GuillaumeGomez commented on May 31, 2024

Just to be sure: can you run process-viewer and htop alongside with the program highlighted to have a comparison please?

(process-viewer is using sysinfo so it'll make the bug more obvious and maybe easier for me to track)

from sysinfo.

maciejhirsz avatar maciejhirsz commented on May 31, 2024

I've used the example crate which seems to be working correctly and narrowed it down to total_time not being measured correctly. Just dumping values in terminal:

            let (new, old) = get_raw_times(&self.processors[0]);
            println!("New {:?} Old {:?}", new, old);

I get:

New 48856671 Old 48849869
Total time 6802, Use time 4509

In the example crate, but in our project:

New 48842622 Old 0
Total time 48842624, Use time 4136

Digging deeper to figure out why is that.

from sysinfo.

maciejhirsz avatar maciejhirsz commented on May 31, 2024

Tested all scenarios:

  • Calling refresh_all before each refresh_process produces correct results edit: actually incorrect.
  • Calling refresh_all once on init makes the total_time stuck on the same value for all refresh_process calls.
  • Calling refresh_all and then probing the process without calling refresh_process produces values that are too large edit: actually correct.

from sysinfo.

GuillaumeGomez avatar GuillaumeGomez commented on May 31, 2024

Those are quite weird results... But it means that refresh_all makes an update needed for refresh_process. It reduces the possibilities quite a lot. With this, I think I'll be able to fix the issue pretty quickly. Thanks a lot!

from sysinfo.

maciejhirsz avatar maciejhirsz commented on May 31, 2024

Cheers, thanks for doing this!

edit FYI: I can reproduce all of that behavior in the example crate.

from sysinfo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.