• Russ Cox's avatar
    runtime/pprof: add streaming protobuf encoder · cbab65fd
    Russ Cox authored
    The existing code builds a full profile in memory.
    Then it translates that profile into a data structure (in memory).
    Then it marshals that data structure into a protocol buffer (in memory).
    Then it gzips that marshaled form into the underlying writer.
    So there are three copies of the full profile data in memory
    at the same time before we're done. This is obviously dumb.
    
    This CL implements a fully streaming conversion from
    the original in-memory profile to the underlying writer.
    There is now only one copy of the profile in memory.
    
    For the non-CPU profiles, this is optimal, since we have to
    have a full copy in memory to start with.
    
    For the CPU profiles, we could still try to bound the profile
    size stored in memory and stream fragments out during
    the actual profiling, as Go 1.7 did (with a simpler format),
    but so far that hasn't been necessary.
    
    Change-Id: Ic36141021857791bf0cd1fce84178fb5e744b989
    Reviewed-on: https://go-review.googlesource.com/37164
    Run-TryBot: Russ Cox <rsc@golang.org>
    Reviewed-by: 's avatarMichael Matloob <matloob@golang.org>
    cbab65fd
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...