Output formats.
const ( Callgrind = iota Comments Dis Dot List Proto Raw Tags Text TopProto Traces Tree WebList )
func AddSourceTemplates(t *template.Template)
AddSourceTemplates adds templates used by PrintWebList to t.
func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error
Generate generates a report as directed by the Report.
func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig)
GetDOT returns a graph suitable for dot processing along with some configuration information.
func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error
PrintAssembly prints annotated disassembly of rpt to w.
func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) error
PrintWebList prints annotated source listing of rpt to w. rpt.prof should contain inlined call info.
func ProfileLabels(rpt *Report) []string
ProfileLabels returns printable labels for a profile.
Options are the formatting and filtering options used to generate a profile.
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. }
Report contains the data and associated routines to extract a report from a profile.
type Report struct {
// contains filtered or unexported fields
}
func New(prof *profile.Profile, o *Options) *Report
New builds a new report indexing the sample values interpreting the samples with the provided function.
func NewDefault(prof *profile.Profile, options Options) *Report
NewDefault builds a new report indexing the last sample value available.
func (rpt *Report) Stacks() StackSet
Stacks returns a StackSet for the profile in rpt.
func (rpt *Report) Total() int64
Total returns the total number of samples in a report.
Stack holds a single stack instance.
type Stack struct { Value int64 // Total value for all samples of this stack. Sources []int // Indices in StackSet.Sources (callers before callees). }
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.
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 }
StackSlot identifies a particular StackSlot.
type StackSlot struct { Stack int // Index in StackSet.Stacks Pos int // Index in Stack.Sources }
StackSource holds function/location info for a stack entry.
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 // Regular expression (anchored) that matches exactly FullName. RE 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 }
TextItem holds a single text report entry.
type TextItem struct { Name string InlineLabel string // Not empty if inlined Flat, Cum int64 // Raw values FlatFormat, CumFormat string // Formatted values }
func TextItems(rpt *Report) ([]TextItem, []string)
TextItems returns a list of text items from the report and a list of labels that describe the report.