Skip to content

Commit 7d14401

Browse files
DarKol13matloob
authored andcommitted
runtime/pprof: write profiles in protobuf format.
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: I5acdb2809cab0d16ed4694fdaa7b8ddfd68df11e Reviewed-on: https://go-review.googlesource.com/30556 Run-TryBot: Michael Matloob <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent d70b0fe commit 7d14401

File tree

11 files changed

+2140
-409
lines changed

11 files changed

+2140
-409
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"},
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)