GithubHelp home page GithubHelp logo

Comments (3)

xu-cheng avatar xu-cheng commented on May 18, 2024 1

I think there is no too much difference between wall clock and process real clock sementically. The only difference lies in the implementation details, where different system APIs are used for the respective clocks. See https://docs.rs/howlong/0.1.5/howlong/clock/index.html#implementations-2 for more details.

For the purpose of using this crate, I think you should use ProcessCPUClock if you want to have a breakdown between user cpu time and system cpu time. Otherwise, HighResolutionClock is preferred.

But "CPU time" is colloquially "process user (out-of-kernel) time + process system (in-kernel) time"

It is important to note that elapsed_cpu_time.user + elapsed_cpu_time.system does not equal to the elapsed_cpu_time.real. If the process is sleeping or yields its execution, then user + system < real. Alternatively, when running a multi-core program, user + system > real.

Some clarification in the docs would be great!

I would accept a PR for this.

from howlong.

xu-cheng avatar xu-cheng commented on May 18, 2024 1
  • The real field of ProcessCPUClock and ProcessRealCPUClock are identical. They are using the same implementation.
  • There is not much semantical difference between wall clock (i.e., HighResolutionClock, which by default is SteadyClock) and ProcessRealCPUClock. But their implementations are different.
  • There is a slight difference between SteadyClock and SystemClock in that the former one guarantees to be increasing monotonically.

from howlong.

qiolol avatar qiolol commented on May 18, 2024

I think there is no too much difference between wall clock and process real clock sementically. The only difference lies in the implementation details, where different system APIs are used for the respective clocks. See https://docs.rs/howlong/0.1.5/howlong/clock/index.html#implementations-2 for more details.

To check my understanding, would it be correct to phrase this as

  • the real field of ProcessCPUClock's ProcessTimePoint
  • ProcessRealCPUClock
  • and SystemClock

are semantically identical in that all three mean to provide real, "wall clock" time, but that this is implementation-dependent by operating system (as shown in the table of the underlying APIs)?

from howlong.

Related Issues (2)

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.