From e7cbbbe9bb878b6ca4ce04fde645df1c8f1845bd Mon Sep 17 00:00:00 2001 From: Daniel Martí Date: Mon, 12 Feb 2018 16:34:48 +0000 Subject: cmd/vendor/github.com/google/pprof: refresh from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating to commit 0e0e5b7254e076a62326ab7305ba49e8515f0c91 from github.com/google/pprof Recent modifications to the vendored pprof, such as skipping TestWebInterface to avoid starting a web browser, have all been fixed upstream. Change-Id: I72e11108c438e1573bf2f9216e76d157378e8d45 Reviewed-on: https://go-review.googlesource.com/93375 Run-TryBot: Daniel Martí TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- .../google/pprof/internal/driver/interactive.go | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go') diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go index 2c36b64cc7..b893697b62 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go @@ -42,6 +42,9 @@ func interactive(p *profile.Profile, o *plugin.Options) error { interactiveMode = true shortcuts := profileShortcuts(p) + // Get all groups in pprofVariables to allow for clearer error messages. + groups := groupOptions(pprofVariables) + greetings(p, o.UI) for { input, err := o.UI.ReadLine("(pprof) ") @@ -87,6 +90,9 @@ func interactive(p *profile.Profile, o *plugin.Options) error { o.UI.PrintErr(err) } continue + } else if okValues := groups[name]; okValues != nil { + o.UI.PrintErr(fmt.Errorf("Unrecognized value for %s: %q. Use one of %s", name, value, strings.Join(okValues, ", "))) + continue } } @@ -118,6 +124,23 @@ func interactive(p *profile.Profile, o *plugin.Options) error { } } +// groupOptions returns a map containing all non-empty groups +// mapped to an array of the option names in that group in +// sorted order. +func groupOptions(vars variables) map[string][]string { + groups := make(map[string][]string) + for name, option := range vars { + group := option.group + if group != "" { + groups[group] = append(groups[group], name) + } + } + for _, names := range groups { + sort.Strings(names) + } + return groups +} + var generateReportWrapper = generateReport // For testing purposes. // greetings prints a brief welcome and some overall profile -- cgit v1.3-5-g9baa