diff options
Diffstat (limited to 'src/cmd/vendor/github.com')
6 files changed, 57 insertions, 49 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/driver/driver.go index b1c745bacd..9bcbc8295a 100644 --- a/src/cmd/vendor/github.com/google/pprof/driver/driver.go +++ b/src/cmd/vendor/github.com/google/pprof/driver/driver.go @@ -92,13 +92,6 @@ type FlagSet interface { Float64(name string, def float64, usage string) *float64 String(name string, def string, usage string) *string - // BoolVar, IntVar, Float64Var, and StringVar define new flags referencing - // a given pointer, like the functions of the same name in package flag. - BoolVar(pointer *bool, name string, def bool, usage string) - IntVar(pointer *int, name string, def int, usage string) - Float64Var(pointer *float64, name string, def float64, usage string) - StringVar(pointer *string, name string, def string, usage string) - // StringList is similar to String but allows multiple values for a // single flag StringList(name string, def string, usage string) *[]*string diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go index 551965e776..af7b8d478a 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go @@ -25,7 +25,7 @@ import ( "github.com/google/pprof/profile" ) -var tagFilterRangeRx = regexp.MustCompile("([+-]?[[:digit:]]+)([[:alpha:]]+)") +var tagFilterRangeRx = regexp.MustCompile("([+-]?[[:digit:]]+)([[:alpha:]]+)?") // applyFocus filters samples based on the focus/ignore options func applyFocus(prof *profile.Profile, numLabelUnits map[string]string, v variables, ui plugin.UI) error { diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/flags.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/flags.go index 6ef1397852..5390319166 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/flags.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/flags.go @@ -44,27 +44,6 @@ func (*GoFlags) String(o, d, c string) *string { return flag.String(o, d, c) } -// BoolVar implements the plugin.FlagSet interface. -func (*GoFlags) BoolVar(b *bool, o string, d bool, c string) { - flag.BoolVar(b, o, d, c) -} - -// IntVar implements the plugin.FlagSet interface. -func (*GoFlags) IntVar(i *int, o string, d int, c string) { - flag.IntVar(i, o, d, c) -} - -// Float64Var implements the plugin.FlagSet interface. -// the value of the flag. -func (*GoFlags) Float64Var(f *float64, o string, d float64, c string) { - flag.Float64Var(f, o, d, c) -} - -// StringVar implements the plugin.FlagSet interface. -func (*GoFlags) StringVar(s *string, o, d, c string) { - flag.StringVar(s, o, d, c) -} - // StringList implements the plugin.FlagSet interface. func (*GoFlags) StringList(o, d, c string) *[]*string { return &[]*string{flag.String(o, d, c)} diff --git a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go index a304284c31..4c1db2331f 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go @@ -61,13 +61,6 @@ type FlagSet interface { Float64(name string, def float64, usage string) *float64 String(name string, def string, usage string) *string - // BoolVar, IntVar, Float64Var, and StringVar define new flags referencing - // a given pointer, like the functions of the same name in package flag. - BoolVar(pointer *bool, name string, def bool, usage string) - IntVar(pointer *int, name string, def int, usage string) - Float64Var(pointer *float64, name string, def float64, usage string) - StringVar(pointer *string, name string, def string, usage string) - // StringList is similar to String but allows multiple values for a // single flag StringList(name string, def string, usage string) *[]*string diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go index fb67a343ba..1b555a4e2e 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go @@ -102,7 +102,7 @@ func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error { case Tags: return printTags(w, rpt) case Proto: - return rpt.prof.Write(w) + return printProto(w, rpt) case TopProto: return printTopProto(w, rpt) case Dis: @@ -291,6 +291,23 @@ func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph { return graph.New(rpt.prof, gopt) } +// printProto writes the incoming proto via thw writer w. +// If the divide_by option has been specified, samples are scaled appropriately. +func printProto(w io.Writer, rpt *Report) error { + p, o := rpt.prof, rpt.options + + // Apply the sample ratio to all samples before saving the profile. + if r := o.Ratio; r > 0 && r != 1 { + for _, sample := range p.Sample { + for i, v := range sample.Value { + sample.Value[i] = int64(float64(v) * r) + } + } + } + return p.Write(w) +} + +// printTopProto writes a list of the hottest routines in a profile as a profile.proto. func printTopProto(w io.Writer, rpt *Report) error { p := rpt.prof o := rpt.options diff --git a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go index c467440176..62667bbde9 100644 --- a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go +++ b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go @@ -160,7 +160,7 @@ func doDemangle(name string, options ...Option) (ret AST, err error) { } st := &state{str: name, verbose: verbose} - a := st.encoding(params) + a := st.encoding(params, notForLocalName) // Accept a clone suffix. if clones { @@ -249,10 +249,16 @@ func adjustErr(err error, adj int) error { return err } +type forLocalNameType int +const ( + forLocalName forLocalNameType = iota + notForLocalName +) + // encoding ::= <(function) name> <bare-function-type> // <(data) name> // <special-name> -func (st *state) encoding(params bool) AST { +func (st *state) encoding(params bool, local forLocalNameType) AST { if len(st.str) < 1 { st.fail("expected encoding") } @@ -316,6 +322,14 @@ func (st *state) encoding(params bool) AST { ft = simplify(ft) + // For a local name, discard the return type, so that it + // doesn't get confused with the top level return type. + if local == forLocalName { + if functype, ok := ft.(*FunctionType); ok { + functype.Return = nil + } + } + // Any top-level qualifiers belong to the function type. if mwq != nil { a = mwq.Method @@ -526,13 +540,22 @@ func (st *state) prefix() AST { } else { switch st.str[0] { case 'C': - if len(st.str) < 2 { + inheriting := false + st.advance(1) + if len(st.str) > 0 && st.str[0] == 'I' { + inheriting = true + st.advance(1) + } + if len(st.str) < 1 { st.fail("expected constructor type") } if last == nil { st.fail("constructor before name is seen") } - st.advance(2) + st.advance(1) + if inheriting { + last = st.demangleType(false) + } next = &Constructor{Name: getLast(last)} case 'D': if len(st.str) > 1 && (st.str[1] == 'T' || st.str[1] == 't') { @@ -834,7 +857,7 @@ func (st *state) operatorName(inExpression bool) (AST, int) { // ::= Z <(function) encoding> E d [<parameter> number>] _ <entity name> func (st *state) localName() AST { st.checkChar('Z') - fn := st.encoding(true) + fn := st.encoding(true, forLocalName) if len(st.str) == 0 || st.str[0] != 'E' { st.fail("expected E after local name") } @@ -851,7 +874,7 @@ func (st *state) localName() AST { st.advance(1) num = st.compactNumber() } - var n AST = st.name() + n := st.name() n = st.discriminator(n) if num >= 0 { n = &DefaultArg{Num: num, Arg: n} @@ -939,16 +962,16 @@ func (st *state) specialName() AST { return &Special{Prefix: "typeinfo name for ", Val: t} case 'h': st.callOffset('h') - v := st.encoding(true) + v := st.encoding(true, notForLocalName) return &Special{Prefix: "non-virtual thunk to ", Val: v} case 'v': st.callOffset('v') - v := st.encoding(true) + v := st.encoding(true, notForLocalName) return &Special{Prefix: "virtual thunk to ", Val: v} case 'c': st.callOffset(0) st.callOffset(0) - v := st.encoding(true) + v := st.encoding(true, notForLocalName) return &Special{Prefix: "covariant return thunk to ", Val: v} case 'C': derived := st.demangleType(false) @@ -995,7 +1018,7 @@ func (st *state) specialName() AST { i := st.number() return &Special{Prefix: fmt.Sprintf("reference temporary #%d for ", i), Val: n} case 'A': - v := st.encoding(true) + v := st.encoding(true, notForLocalName) return &Special{Prefix: "hidden alias for ", Val: v} case 'T': if len(st.str) == 0 { @@ -1003,7 +1026,7 @@ func (st *state) specialName() AST { } c := st.str[0] st.advance(1) - v := st.encoding(true) + v := st.encoding(true, notForLocalName) switch c { case 'n': return &Special{Prefix: "non-transaction clone for ", Val: v} @@ -2065,7 +2088,7 @@ func (st *state) exprPrimary() AST { st.fail("expected mangled name") } st.advance(1) - ret = st.encoding(true) + ret = st.encoding(true, notForLocalName) } else { t := st.demangleType(false) @@ -2074,6 +2097,9 @@ func (st *state) exprPrimary() AST { neg = true st.advance(1) } + if len(st.str) > 0 && st.str[0] == 'E' { + st.fail("missing literal value") + } i := 0 for len(st.str) > i && st.str[i] != 'E' { i++ |
