report

package
v0.0.0-...-a892ee0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package report summarizes a performance profile into a human-readable report.

Index

Constants

View Source
const (
	Callgrind = iota
	Comments
	Dis
	Dot
	List
	Proto
	Raw
	Tags
	Text
	TopProto
	Traces
	Tree
	WebList
)

Output formats.

Variables

This section is empty.

Functions

func AddSourceTemplates

func AddSourceTemplates(t *template.Template)

AddSourceTemplates adds templates used by PrintWebList to t.

func Generate

func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error

Generate generates a report as directed by the Report.

func GetDOT

func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig)

GetDOT returns a graph suitable for dot processing along with some configuration information.

func PrintAssembly

func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error

PrintAssembly prints annotated disassembly of rpt to w.

func ProfileLabels

func ProfileLabels(rpt *Report) []string

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

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

func NewDefault(prof *profile.Profile, options Options) *Report

NewDefault builds a new report indexing the last sample value available.

func (*Report) OutputFormat

func (rpt *Report) OutputFormat() int

OutputFormat returns the output format for the report.

func (*Report) Stacks

func (rpt *Report) Stacks() StackSet

Stacks returns a StackSet for the profile in rpt.

func (*Report) Total

func (rpt *Report) Total() int64

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
}

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 StackSlot

type StackSlot struct {
	Stack int // Index in StackSet.Stacks
	Pos   int // Index in Stack.Sources
}

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

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.

type WebListCall

type WebListCall struct {
	SrcLine  string
	FileBase string
	Line     int
}

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

func MakeWebList(rpt *Report, obj plugin.ObjTool, maxFiles int) (WebListData, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL