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.
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.statsor-test.resourcesflag 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.