From 7aa29edbfac59fb576ffb6a3020b7c32769ff36a Mon Sep 17 00:00:00 2001 From: Alexey Alexandrov Date: Thu, 12 Jul 2018 10:41:47 -0700 Subject: [PATCH 1/2] Stop supporting Go older than 1.9 (#399) Fixes #398. --- .travis.yml | 18 ++++++++---------- README.md | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad30af24b..28b3c0dd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,21 +4,19 @@ go_import_path: github.com/google/pprof matrix: include: - - os: linux - go: 1.7.x - - os: linux - go: 1.8.x - os: linux go: 1.9.x + - os: linux + go: 1.10.x - os: linux go: master - os: osx osx_image: xcode6.4 - go: 1.8.x + go: 1.9.x env: SKIP_GRAPHVIZ=1 - os: osx osx_image: xcode6.4 - go: 1.9.x + go: 1.10.x env: SKIP_GRAPHVIZ=1 - os: osx osx_image: xcode6.4 @@ -26,19 +24,19 @@ matrix: env: SKIP_GRAPHVIZ=1 - os: osx osx_image: xcode7.3 - go: 1.8.x + go: 1.9.x - os: osx osx_image: xcode7.3 - go: 1.9.x + go: 1.10.x - os: osx osx_image: xcode7.3 go: master - os: osx osx_image: xcode8.3 - go: 1.8.x + go: 1.9.x - os: osx osx_image: xcode8.3 - go: 1.9.x + go: 1.10.x - os: osx osx_image: xcode8.3 go: master diff --git a/README.md b/README.md index 266a8ec4c..8cac74783 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ them through the use of the native binutils tools (addr2line and nm). Prerequisites: -- Go development kit. Requires Go 1.7 or newer. +- Go development kit. Requires Go 1.9 or newer. Follow [these instructions](http://golang.org/doc/code.html) to install the go tool and set up GOPATH. From 3e1e08e68eaed0faefa67fe1c1e10e004cec2c9a Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 16 Jul 2018 09:52:59 -0700 Subject: [PATCH 2/2] apply filters to -proto output format (#393) * make filters applied to -proto output * update comments * address comments * reassign flags in TestParse * update TestParse to address comments * use original names for options in TestParse --- internal/driver/driver.go | 17 +++-------------- internal/driver/driver_test.go | 17 +++++++---------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/internal/driver/driver.go b/internal/driver/driver.go index 2dabc3017..55696a1a9 100644 --- a/internal/driver/driver.go +++ b/internal/driver/driver.go @@ -152,7 +152,7 @@ func generateReport(p *profile.Profile, cmd []string, vars variables, o *plugin. } func applyCommandOverrides(cmd string, outputFormat int, v variables) variables { - trim, tagfilter, filter := v["trim"].boolValue(), true, true + trim := v["trim"].boolValue() switch cmd { case "callgrind", "kcachegrind": @@ -162,7 +162,7 @@ func applyCommandOverrides(cmd string, outputFormat int, v variables) variables trim = false v.set("addressnoinlines", "t") case "peek": - trim, tagfilter, filter = false, false, false + trim = false case "list": v.set("nodecount", "0") v.set("lines", "t") @@ -177,7 +177,7 @@ func applyCommandOverrides(cmd string, outputFormat int, v variables) variables } if outputFormat == report.Proto || outputFormat == report.Raw { - trim, tagfilter, filter = false, false, false + trim = false v.set("addresses", "t") } @@ -186,17 +186,6 @@ func applyCommandOverrides(cmd string, outputFormat int, v variables) variables v.set("nodefraction", "0") v.set("edgefraction", "0") } - if !tagfilter { - v.set("tagfocus", "") - v.set("tagignore", "") - } - if !filter { - v.set("focus", "") - v.set("ignore", "") - v.set("hide", "") - v.set("show", "") - v.set("show_from", "") - } return v } diff --git a/internal/driver/driver_test.go b/internal/driver/driver_test.go index 98306469b..0a29d984b 100644 --- a/internal/driver/driver_test.go +++ b/internal/driver/driver_test.go @@ -109,9 +109,6 @@ func TestParse(t *testing.T) { flags := strings.Split(tc.flags, ",") - // Skip the output format in the first flag, to output to a proto - addFlags(&f, flags[1:]) - // Encode profile into a protobuf and decode it again. protoTempFile, err := ioutil.TempFile("", "profile_proto") if err != nil { @@ -124,6 +121,7 @@ func TestParse(t *testing.T) { if flags[0] == "topproto" { f.bools["proto"] = false f.bools["topproto"] = true + f.bools["addresses"] = true } // First pprof invocation to save the profile into a profile.proto. @@ -145,23 +143,22 @@ func TestParse(t *testing.T) { } defer os.Remove(outputTempFile.Name()) defer outputTempFile.Close() + + f = baseFlags() f.strings["output"] = outputTempFile.Name() f.args = []string{protoTempFile.Name()} - var solution string + delete(f.bools, "proto") + addFlags(&f, flags) + solution := solutionFilename(tc.source, &f) // Apply the flags for the second pprof run, and identify name of // the file containing expected results if flags[0] == "topproto" { + addFlags(&f, flags) solution = solutionFilename(tc.source, &f) delete(f.bools, "topproto") f.bools["text"] = true - } else { - delete(f.bools, "proto") - addFlags(&f, flags[:1]) - solution = solutionFilename(tc.source, &f) } - // The add_comment flag is not idempotent so only apply it on the first run. - delete(f.strings, "add_comment") // Second pprof invocation to read the profile from profile.proto // and generate a report.