golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.59k stars 17.48k forks source link

x/perf/cmd/benchstat: wrong number of header columns in CSV output #67760

Open ivanvc opened 3 months ago

ivanvc commented 3 months ago

Go version

go version go1.22.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/ivan/.cache/go-build'
GOENV='/home/ivan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/ivan/.local/share/asdf/installs/golang/1.22.2/packages/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ivan/.local/share/asdf/installs/golang/1.22.2/packages'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/ivan/.local/share/asdf/installs/golang/1.22.3/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/ivan/.local/share/asdf/installs/golang/1.22.3/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/ivan/Code/Personal/etcd/bbolt/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build144319728=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Running benchstat -output=csv returns an invalid CSV (according to RFC4180) because the header is missing columns.

I ran:

benchstat -confidence=0.75 -format=csv bm1.txt bm2.txt 2>/dev/null

Find attached both bm1.txt and bm2.txt.

What did you see happen?

The output is:

,bm1.txt,,bm2.txt
,sec/op,CI,sec/op,CI,vs base,P
_FreelistRelease10K-8,0.000298085,0%,0.000298883,0%,~,p=0.400 n=3
...

Notice that the header has 4 columns, while the table rows have 7.

What did you expect to see?

The headers in the CSV should have all of the columns, i.e.

,bm1.txt,,bm2.txt,,,
,sec/op,CI,sec/op,CI,vs base,P
_FreelistRelease10K-8,0.000298085,0%,0.000298883,0%,~,p=0.400 n=3
...
mknyszek commented 2 months ago

CC @aclements @dr2chase