diff options
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go index 74ce8cb422..18941926c5 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go @@ -20,6 +20,7 @@ package driver import ( "bytes" "fmt" + "io" "os" "path/filepath" "regexp" @@ -118,7 +119,14 @@ func generateReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Opti // Generate the report. dst := new(bytes.Buffer) - if err := report.Generate(dst, rpt, o.Obj); err != nil { + switch rpt.OutputFormat() { + case report.WebList: + // We need template expansion, so generate here instead of in report. + err = printWebList(dst, rpt, o.Obj) + default: + err = report.Generate(dst, rpt, o.Obj) + } + if err != nil { return err } src := dst @@ -155,6 +163,18 @@ func generateReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Opti return out.Close() } +func printWebList(dst io.Writer, rpt *report.Report, obj plugin.ObjTool) error { + listing, err := report.MakeWebList(rpt, obj, -1) + if err != nil { + return err + } + legend := report.ProfileLabels(rpt) + return renderHTML(dst, "sourcelisting", rpt, nil, legend, webArgs{ + Standalone: true, + Listing: listing, + }) +} + func applyCommandOverrides(cmd string, outputFormat int, cfg config) config { // Some report types override the trim flag to false below. This is to make // sure the default heuristics of excluding insignificant nodes and edges |
