Skip to content

cmd/compile: rsc/compilebench -alloc is broken #18641

Closed
@mdempsky

Description

@mdempsky

Using rsc/compilebench's -alloc flag, all compiles currently report "0 B/op 0 allocs/op". Presumably something in cmd/compile changed that broke this. We should either revert that change, or update rsc/compilebench accordingly.

Activity

added this to the Go1.9 milestone on Jan 12, 2017
mdempsky

mdempsky commented on Jan 12, 2017

@mdempsky
ContributorAuthor

This appears to be because runtime/pprof switched to writing binary pprof files, so compilebench's code to parse the # TotalAlloc and # Mallocs lines no longer work.

/cc @matloob

josharian

josharian commented on Jan 20, 2017

@josharian
Contributor

Just hit this myself. Sadness. (I wonder whether anyone else was parsing the pprof output to get memstats and will also be impacted by this change.)

I don't see an obvious way to add ignored to the binary pprof output, and I really don't want to embed a protobuf decoder in compilebench anyway.

I propose instead that we add a -memstats=<file> flag to cmd/compile. When provided, on exit, we call runtime.ReadMemStats and write the JSON-encoded results to <file>.

compilebench will have to probe whether the compiler accepts the flag. If yes, it uses it and reads the result. If no, it omits it and attempts to read the pprof output. There will be a stretch of commits in Go 1.8 and the beginning of Go 1.9 for which compilebench forever cannot emit alloc info. (Or in dire straights you can patch runtime/pprof/pprof.go's WriteHeapProfile to call writeHeap(w, 1) instead of writeHeap(w, 0).)

How does that sound?

minux

minux commented on Jan 20, 2017

@minux
Member
josharian

josharian commented on Jan 20, 2017

@josharian
Contributor

I assume that at some point @matloob will want to eliminate the old code, but as an interim measure, that'd be really useful. Particularly if it could go in for 1.8--it is a tiny, safe change--but I'm not going to hold my breath for that.

modified the milestones: Go1.8, Go1.9 on Jan 20, 2017
minux

minux commented on Jan 20, 2017

@minux
Member
bradfitz

bradfitz commented on Jan 20, 2017

@bradfitz
Contributor

Can you prepare a non-scary CL before Monday?

josharian

josharian commented on Jan 20, 2017

@josharian
Contributor

False alarm. While preparing a CL, I accidentally read the documentation (oops). CL on its way.

josharian

josharian commented on Jan 20, 2017

@josharian
Contributor

gopherbot down? CL 35484

minux

minux commented on Jan 20, 2017

@minux
Member
josharian

josharian commented on Jan 21, 2017

@josharian
Contributor

But those who have the problem have a one line fix available. They'd have to do the same thing with a GODEBUG envvar.

locked and limited conversation to collaborators on Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@mdempsky@josharian@minux@gopherbot

        Issue actions

          cmd/compile: rsc/compilebench -alloc is broken · Issue #18641 · golang/go