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

testing: show rusage statistics for benchmarks #24905

Open
LMMilewski opened this Issue Apr 17, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@LMMilewski
Member

LMMilewski commented Apr 17, 2018

When optimizing CPU usage, it would be useful to get CPU usage information from Go benchmarks.

Could we add, where supported, getrusage calls before and after running each benchmark, in addition to wall-time?

I have no opinion about the API for requesting those statistics. Perhaps adding a -test.stats or -test.resources flag would work?
For example: -test.stats=utime,stime,maxrss.

This doesn't have to be rusage specific. For instance, it could be extended with statistics from the perf_event API at some point.

I could send a CL if this is a welcome change.

@davecheney

This comment has been minimized.

Contributor

davecheney commented Apr 17, 2018

@josharian

This comment has been minimized.

Contributor

josharian commented Apr 18, 2018

See also #21295

@LMMilewski

This comment has been minimized.

Member

LMMilewski commented Apr 18, 2018

@davecheney could you clarify your recommendation?

I'm familiar with the execution tracer. I use it when it's a good match for what I want to do.
However, I'm not sure how I could easily use it to:

  • communicate performance improvements to others (e.g. in a CL description, on a performance dashboard, etc.), or
  • quickly compare multiple optimization ideas to see which one yields the best results, or
  • do multiple runs and process results with benchstat

To clarify, I'm proposing adding, to benchmark output, columns with rusage diffs for requested resources. That is, we would have, for example, user time ("utime/op") column next to "ns/op".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment