-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
Suspiciously low User and Sys time #597
Comments
Please see https://stackoverflow.com/a/556411/704831. User and system times only refer to the time that the benchmarked process itself spent in user/system mode. Ninja calls out to subprocesses (the linker) which takes the majority of the time. So what you see above is only the time that Ninja itself spends in user/system mode. If you are interested in the user/system times for the linker, maybe you can benchmark it directly? I realize that this can be confusing. We should probably document it. Now that I'm thinking about it some more, I'm also not sure if that works correctly with and without the intermediate shell ( |
I think there might be something more subtle at play here. First of all, for some reason, when linking using If I skip ninja and invoke
The only difference in the command line is how the linker is specified. For I also ran both commands with
Once The call to
Maybe that's a clue toward the real answer. Note that I am not the only one to have seen this behavior. In this blog post, one of the Finally, I will add that With
With
|
Thank you for the detailed answer. I sent you that stackoverflow link but didn't read it carefully myself - sorry. This also explains my confusion ("I'm also not sure if that works correctly with and without the intermediate shell"). The reality is a bit more complicated, as you said. Typically, user and sys times of child processes are collected. Which is why hyperfines measurement usually works with and without the intermediate shell. However, user and sys times of child processes that did not finish in time (when the main processes ended) are not counted. This is described in this comment:
We can demonstrate this using
The same thing can also be demonstrated with
Note that the 2 seconds in user mode are only reported in the lower example, where the waiting time is long enough. In the first example, a user time of 0 is reported. Now the question remains why this happens in your example. Could it be that one of the tools spawns children but then doesn't |
Thank you for your reply. I will try to figure out what |
@moncefmechri Any update on this? |
I am benchmarking the mold linker on an in-house application, using hyperfine 1.15.0 (from conda-forge) to drive the benchmarks.
While the wall-clock times reported seem correct, the "User" and "Sys" times seem way too low (and also are not impacted by the number of threads used). Example:
The benchmark invokes the linker by calling
ninja MyBinary
(with--setup
and--prepare
used to make sureninja
does not much else than invoking the linker)Specs of the machine used to run the benchmark:
The text was updated successfully, but these errors were encountered: