package report
import "github.com/google/pprof/internal/report"
Package report summarizes a performance profile into a human-readable report.
Index ¶
- Constants
- func AddSourceTemplates(t *template.Template)
- func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error
- func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig)
- func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error
- func ProfileLabels(rpt *Report) []string
- type Options
- type Report
- func New(prof *profile.Profile, o *Options) *Report
- func NewDefault(prof *profile.Profile, options Options) *Report
- func (rpt *Report) DocURL() string
- func (rpt *Report) OutputFormat() int
- func (rpt *Report) Stacks() StackSet
- func (rpt *Report) Total() int64
- type Stack
- type StackSet
- type StackSlot
- type StackSource
- type TextItem
- type WebListCall
- type WebListData
- type WebListFile
- type WebListFunc
- type WebListInstruction
- type WebListLine
Constants ¶
const ( Callgrind = iota Comments Dis Dot List Proto Raw Tags Text TopProto Traces Tree WebList )
Output formats.
Functions ¶
func AddSourceTemplates ¶
AddSourceTemplates adds templates used by PrintWebList to t.
func Generate ¶
Generate generates a report as directed by the Report.
func GetDOT ¶
GetDOT returns a graph suitable for dot processing along with some configuration information.
func PrintAssembly ¶
PrintAssembly prints annotated disassembly of rpt to w.
func ProfileLabels ¶
ProfileLabels returns printable labels for a profile.
Types ¶
type Options ¶
type Options struct {
OutputFormat int
CumSort bool
CallTree bool
DropNegative bool
CompactLabels bool
Ratio float64
Title string
ProfileLabels []string
ActiveFilters []string
NumLabelUnits map[string]string
NodeCount int
NodeFraction float64
EdgeFraction float64
SampleValue func(s []int64) int64
SampleMeanDivisor func(s []int64) int64
SampleType string
SampleUnit string // Unit for the sample data from the profile.
OutputUnit string // Units for data formatting in report.
Symbol *regexp.Regexp // Symbols to include on disassembly report.
SourcePath string // Search path for source files.
TrimPath string // Paths to trim from source file paths.
IntelSyntax bool // Whether or not to print assembly in Intel syntax.
}
Options are the formatting and filtering options used to generate a profile.
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report contains the data and associated routines to extract a report from a profile.
func New ¶
New builds a new report indexing the sample values interpreting the samples with the provided function.
func NewDefault ¶
NewDefault builds a new report indexing the last sample value available.
func (*Report) DocURL ¶
DocURL returns the documentation URL for Report, or "" if not available.
func (*Report) OutputFormat ¶
OutputFormat returns the output format for the report.
func (*Report) Stacks ¶
Stacks returns a StackSet for the profile in rpt.
func (*Report) Total ¶
Total returns the total number of samples in a report.
type Stack ¶
type Stack struct {
Value int64 // Total value for all samples of this stack.
Sources []int // Indices in StackSet.Sources (callers before callees).
}
Stack holds a single stack instance.
type StackSet ¶
type StackSet struct {
Total int64 // Total value of the profile.
Scale float64 // Multiplier to generate displayed value
Type string // Profile type. E.g., "cpu".
Unit string // One of "B", "s", "GCU", or "" (if unknown)
Stacks []Stack // List of stored stacks
Sources []StackSource // Mapping from source index to info
// contains filtered or unexported fields
}
StackSet holds a set of stacks corresponding to a profile.
Slices in StackSet and the types it contains are always non-nil, which makes Javascript code that uses the JSON encoding less error-prone.
func (*StackSet) Legend ¶
Legend returns the list of lines to display as the legend.
type StackSlot ¶
StackSlot identifies a particular StackSlot.
type StackSource ¶
type StackSource struct {
FullName string
FileName string
UniqueName string // Disambiguates functions with same names
Inlined bool // If true this source was inlined into its caller
// Alternative names to display (with decreasing lengths) to make text fit.
// Guaranteed to be non-empty.
Display []string
// Places holds the list of stack slots where this source occurs.
// In particular, if [a,b] is an element in Places,
// StackSet.Stacks[a].Sources[b] points to this source.
//
// No stack will be referenced twice in the Places slice for a given
// StackSource. In case of recursion, Places will contain the outer-most
// entry in the recursive stack. E.g., if stack S has source X at positions
// 4,6,9,10, the Places entry for X will contain [S,4].
Places []StackSlot
// Combined count of stacks where this source is the leaf.
Self int64
// Color number to use for this source.
// Colors with high numbers than supported may be treated as zero.
Color int
}
StackSource holds function/location info for a stack entry.
type TextItem ¶
type TextItem struct {
Name string
InlineLabel string // Not empty if inlined
Flat, Cum int64 // Raw values
FlatFormat, CumFormat string // Formatted values
}
TextItem holds a single text report entry.
func TextItems ¶
TextItems returns a list of text items from the report and a list of labels that describe the report.
type WebListCall ¶
WebListCall holds the per-inlined-call information for HTML source code listing.
type WebListData ¶
type WebListData struct {
Total string
Files []WebListFile
}
WebListData holds the data needed to generate HTML source code listing.
func MakeWebList ¶
MakeWebList returns an annotated source listing of rpt. rpt.prof should contain inlined call info.
type WebListFile ¶
type WebListFile struct {
Funcs []WebListFunc
}
WebListFile holds the per-file information for HTML source code listing.
type WebListFunc ¶
type WebListFunc struct {
Name string
File string
Flat string
Cumulative string
Percent string
Lines []WebListLine
}
WebListFunc holds the per-function information for HTML source code listing.
type WebListInstruction ¶
type WebListInstruction struct {
NewBlock bool // Insert marker that indicates separation from previous block
Flat string
Cumulative string
Synthetic bool
Address uint64
Disasm string
FileLine string
InlinedCalls []WebListCall
}
WebListInstruction holds the per-instruction information for HTML source code listing.
type WebListLine ¶
type WebListLine struct {
SrcLine string
HTMLClass string
Line int
Flat string
Cumulative string
Instructions []WebListInstruction
}
WebListLine holds the per-source-line information for HTML source code listing.
Source Files ¶
package.go report.go shortnames.go source.go source_html.go stacks.go synth.go
- Version
- v0.0.0-20250607225305-033d6d78b36a (latest)
- Published
- Jun 7, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 1 month ago –
Tools for package owners.