Skip to content

Commit b33030a

Browse files
committed
runtime/pprof: write profiles in protobuf format.
Original Change by Daria Kolistratova <[email protected]> Added functions with suffix proto and stuff from pprof tool to translate to protobuf. Done as the profile proto is more extensible than the legacy pprof format and is pprof's preferred profile format. Large part was taken from https://github.com/google/pprof tool. Tested by hand and compared the result with translated by pprof tool, profiles are identical. Fixes #16093 Change-Id: I2751345b09a66ee2b6aa64be76cba4cd1c326aa6 Reviewed-on: https://go-review.googlesource.com/32257 Run-TryBot: Michael Matloob <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 30651b3 commit b33030a

File tree

11 files changed

+2170
-406
lines changed

11 files changed

+2170
-406
lines changed

src/go/build/deps_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,14 @@ var pkgDeps = map[string][]string{
170170
"log": {"L1", "os", "fmt", "time"},
171171

172172
// Packages used by testing must be low-level (L2+fmt).
173-
"regexp": {"L2", "regexp/syntax"},
174-
"regexp/syntax": {"L2"},
175-
"runtime/debug": {"L2", "fmt", "io/ioutil", "os", "time"},
176-
"runtime/pprof": {"L2", "fmt", "os", "text/tabwriter"},
177-
"runtime/trace": {"L0"},
178-
"text/tabwriter": {"L2"},
173+
"regexp": {"L2", "regexp/syntax"},
174+
"regexp/syntax": {"L2"},
175+
"runtime/debug": {"L2", "fmt", "io/ioutil", "os", "time"},
176+
"runtime/pprof/internal/profile": {"L2"},
177+
"runtime/pprof/internal/protopprof": {"L2", "fmt", "runtime/pprof/internal/profile", "os", "time"},
178+
"runtime/pprof": {"L2", "fmt", "runtime/pprof/internal/profile", "runtime/pprof/internal/protopprof", "time", "text/tabwriter"},
179+
"runtime/trace": {"L0"},
180+
"text/tabwriter": {"L2"},
179181

180182
"testing": {"L2", "flag", "fmt", "os", "runtime/debug", "runtime/pprof", "runtime/trace", "time"},
181183
"testing/iotest": {"L2", "log"},

src/runtime/crash_cgo_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,11 @@ func testCgoPprof(t *testing.T, buildArg, runArg string) {
271271
if err != nil {
272272
t.Fatal(err)
273273
}
274+
274275
fn := strings.TrimSpace(string(got))
275276
defer os.Remove(fn)
276277

277-
cmd := testEnv(exec.Command(testenv.GoToolPath(t), "tool", "pprof", "-top", "-nodecount=1", exe, fn))
278+
cmd := testEnv(exec.Command(testenv.GoToolPath(t), "tool", "pprof", "-top", "-nodecount=1", "-symbolize=force", exe, fn))
278279

279280
found := false
280281
for i, e := range cmd.Env {

0 commit comments

Comments
 (0)