cmd/bent: clean up benchsize

1. Remove the section from the benchmark names. It is already in the
   unit, so this will provide better grouping.

2. Capitalize the first letter in the name. This makes the benchmark
   name match the name used for the build time benchmark.

3. Change section size parsing to use exact matches.

The existing substring match could match multiple lines. e.g.,
`zdebug_loc` matching `.zdebug_loc` and `.zdebug_loclists`. When this
happens, $zdebug_loc contains a string like "12345 123", which breaks
the later addition in `expr`.

Fix this by requiring an exact match of the section name field with the
desired section name. Rather than making a more complex regexp, just
include this as a condition in the awk command. Darwin and GNU size has
different formats, so they each require their own format.

For golang/go#57770.

Change-Id: I482bb90b29578179a3b59637c265580f06becaf8
Auto-Submit: Michael Pratt <>
Run-TryBot: Michael Pratt <>
TryBot-Result: Gopher Robot <>
Reviewed-by: Michael Knyszek <>
2 files changed