You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
testing: add CPU name to standard benchmark labels #39214
Reacted by Matt Layher, Daniel Martí, Kale Blankenship, Furkan Türkal, Josh Bleecher Snyder, Tobias Klauser, Peter Rabbitson, Cholerae Hu, Ainar Garipov, Bryan C. Mills and 4 more
Should we also print information about the memory and disk models/speeds? I imagine this will greatly depend on what the bottleneck for a benchmark is.
I would leave it at CPU information for now as this is a common factor for many microbenchmarks. For me this also identifies the system I was benchmarking on, which is helpful when examining logs of benchmarks later.
I agree; I was thinking outloud more than anything. There could be many other factors at play too, such as what kernel version and if any special boot options were used (such as intel mitigations which could slow down syscalls).
@mvdan agreed. This could potentially be expanded in the future with a flag for printing even more information (ram, caches, kernel, ...) but I would leave that to a future extra and separate proposal.
The same information could then be easily added to e.g. go env or other commands with information for bug reporting if considered helpful.
changed the title [-]proposal: add CPU name to standard benchmark labels[/-][+]proposal: testing: add CPU name to standard benchmark labels[/+]on Jun 10, 2020
Having gathered benchmarks from multiple machines with different CPUs again lately for comparison and the reactions posted/emojis are all seem to be positive. Does anyone object to adding this for go1.16?
On all operating systems for 386 and amd64 we can use the CPUID instruction (see http://golang.org/cl/234977) to get the CPU name.
Generally for linux on other architectures /proc/cpuinfo can be read.
For ARM on all operating systems another (more indirect) but not as universal approach can be to read the model and vendor IDs with CPU instructions and then map those to common architecture names for the most common CPUs (e.g. Cortex-A55, Cortex-A77 ...).
For ppc64x, you have to rely on the OS. Currently, there is no exposed hardware CPU ID to userspace. On Linux, you can get that from /proc/cpuinfo or directly from the auxiliary vector (via the AT_PLATFORM variable — see LD_SHOW_AUXV=1)
I will work on to ammend my protoype patch for Linux on all CPU architectures to use AT_PLATFORM from the aux vector. We already use the same mechanism to get HWCAP bits from AT_HWCAP in the auxillary vector. It seems this could also work on BSDs.
@martisch please bear in mind that, if you want to add the processor capabilities in the future (VSX, etc), you will have to read both AT_HWCAP and AT_HWCAP2 on ppc64x.
changed the title [-]proposal: testing: add CPU name to standard benchmark labels[/-][+]testing: add CPU name to standard benchmark labels[/+]on Sep 30, 2020
Activity
mvdan commentedon May 22, 2020
Should we also print information about the memory and disk models/speeds? I imagine this will greatly depend on what the bottleneck for a benchmark is.
martisch commentedon May 22, 2020
I would leave it at CPU information for now as this is a common factor for many microbenchmarks. For me this also identifies the system I was benchmarking on, which is helpful when examining logs of benchmarks later.
mvdan commentedon May 22, 2020
I agree; I was thinking outloud more than anything. There could be many other factors at play too, such as what kernel version and if any special boot options were used (such as intel mitigations which could slow down syscalls).
gopherbot commentedon May 22, 2020
Change https://golang.org/cl/234977 mentions this issue:
testing: print CPU name for benchmarksmartisch commentedon May 22, 2020
@mvdan agreed. This could potentially be expanded in the future with a flag for printing even more information (ram, caches, kernel, ...) but I would leave that to a future extra and separate proposal.
The same information could then be easily added to e.g. go env or other commands with information for bug reporting if considered helpful.
[-]proposal: add CPU name to standard benchmark labels[/-][+]proposal: testing: add CPU name to standard benchmark labels[/+]martisch commentedon Jul 22, 2020
Having gathered benchmarks from multiple machines with different CPUs again lately for comparison and the reactions posted/emojis are all seem to be positive. Does anyone object to adding this for go1.16?
rsc commentedon Sep 16, 2020
Seems OK. Do we know how to procure this information for a wide enough variety of architectures and operating systems?
bradfitz commentedon Sep 16, 2020
Linux:
cat /proc/cpuinfomac:
sysctl -n machdep.cpu.brand_stringWindows:
wmic cpu getmartisch commentedon Sep 16, 2020
On all operating systems for 386 and amd64 we can use the CPUID instruction (see http://golang.org/cl/234977) to get the CPU name.
Generally for linux on other architectures
/proc/cpuinfocan be read.For ARM on all operating systems another (more indirect) but not as universal approach can be to read the model and vendor IDs with CPU instructions and then map those to common architecture names for the most common CPUs (e.g. Cortex-A55, Cortex-A77 ...).
ceseo commentedon Sep 16, 2020
For ppc64x, you have to rely on the OS. Currently, there is no exposed hardware CPU ID to userspace. On Linux, you can get that from
/proc/cpuinfoor directly from the auxiliary vector (via theAT_PLATFORMvariable — seeLD_SHOW_AUXV=1)martisch commentedon Sep 16, 2020
@ceseo thanks for pointing this out.
I will work on to ammend my protoype patch for Linux on all CPU architectures to use AT_PLATFORM from the aux vector. We already use the same mechanism to get HWCAP bits from AT_HWCAP in the auxillary vector. It seems this could also work on BSDs.
ceseo commentedon Sep 16, 2020
@martisch please bear in mind that, if you want to add the processor capabilities in the future (VSX, etc), you will have to read both
AT_HWCAPandAT_HWCAP2on ppc64x.3 remaining items
rsc commentedon Sep 30, 2020
No change in consensus, so accepted.
[-]proposal: testing: add CPU name to standard benchmark labels[/-][+]testing: add CPU name to standard benchmark labels[/+]gopherbot commentedon Oct 20, 2020
Change https://golang.org/cl/263804 mentions this issue:
testing: print cpu type as label for benchmarkstesting: print cpu type as label for benchmarks