• Russ Cox's avatar
    runtime/pprof: use new profile buffers for CPU profiling · 1a680a90
    Russ Cox authored
    This doesn't change the functionality of the current code,
    but it sets us up for exporting the profiling labels into the profile.
    
    The old code had a hash table of profile samples maintained
    during the signal handler, with evictions going into a log.
    The new code just logs every sample directly, leaving the
    hash-based deduplication to an ordinary goroutine.
    
    The new code also avoids storing the entire profile in two
    forms in memory, an unfortunate regression introduced
    when binary profile support was added. After this CL the
    entire profile is only stored once in memory. We'd still like
    to get back down to storing it zero times (streaming it to
    the underlying io.Writer).
    
    Change-Id: I0893a1788267c564aa1af17970d47377b2a43457
    Reviewed-on: https://go-review.googlesource.com/36712
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarMichael Matloob <matloob@golang.org>
    1a680a90
cpuprof.go 6.28 KB