Structs
            
            
               
                  Options
                  struct
                  #
               
               
               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
OutputUnit string
Symbol *regexp.Regexp
SourcePath string
TrimPath string
IntelSyntax bool
}
            
            
            
               
                  Report
                  struct
                  #
               
               
               Report contains the data and associated routines to extract a
report from a profile.
               
               type Report struct {
prof *profile.Profile
total int64
options *Options
formatValue func(int64) string
}
            
            
            
               
                  Stack
                  struct
                  #
               
               
               Stack holds a single stack instance.
               
               type Stack struct {
Value int64
Sources []int
}
            
            
            
               
                  StackSet
                  struct
                  #
               
               
               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
Scale float64
Type string
Unit string
Stacks []Stack
Sources []StackSource
report *Report
}
            
            
            
               
                  StackSlot
                  struct
                  #
               
               
               StackSlot identifies a particular StackSlot.
               
               type StackSlot struct {
Stack int
Pos int
}
            
            
            
               
                  StackSource
                  struct
                  #
               
               
               StackSource holds function/location info for a stack entry.
               
               type StackSource struct {
FullName string
FileName string
UniqueName string
Inlined bool
Display []string
Places []StackSlot
Self int64
Color int
}
            
            
            
               
                  TextItem
                  struct
                  #
               
               
               TextItem holds a single text report entry.
               
               type TextItem struct {
Name string
InlineLabel string
Flat int64
Cum int64
FlatFormat string
CumFormat string
}
            
            
            
               
                  WebListCall
                  struct
                  #
               
               
               WebListCall holds the per-inlined-call information for HTML source code listing.
               
               type WebListCall struct {
SrcLine string
FileBase string
Line int
}
            
            
            
               
                  WebListData
                  struct
                  #
               
               
               WebListData holds the data needed to generate HTML source code listing.
               
               type WebListData struct {
Total string
Files []WebListFile
}
            
            
            
               
                  WebListFile
                  struct
                  #
               
               
               WebListFile holds the per-file information for HTML source code listing.
               
               type WebListFile struct {
Funcs []WebListFunc
}
            
            
            
               
                  WebListFunc
                  struct
                  #
               
               
               WebListFunc holds the per-function information for HTML source code listing.
               
               type WebListFunc struct {
Name string
File string
Flat string
Cumulative string
Percent string
Lines []WebListLine
}
            
            
            
               
                  WebListInstruction
                  struct
                  #
               
               
               WebListInstruction holds the per-instruction information for HTML source code listing.
               
               type WebListInstruction struct {
NewBlock bool
Flat string
Cumulative string
Synthetic bool
Address uint64
Disasm string
FileLine string
InlinedCalls []WebListCall
}
            
            
            
               
                  WebListLine
                  struct
                  #
               
               
               WebListLine holds the per-source-line information for HTML source code listing.
               
               type WebListLine struct {
SrcLine string
HTMLClass string
Line int
Flat string
Cumulative string
Instructions []WebListInstruction
}
            
            
            
               
                  addrInfo
                  struct
                  #
               
               
               addrInfo holds information for an address we are interested in.
               
               type addrInfo struct {
loc *profile.Location
obj plugin.ObjFile
}
            
            
            
               
                  addressRange
                  struct
                  #
               
               
               addressRange is a range of addresses plus the object file that contains it.
               
               type addressRange struct {
begin uint64
end uint64
obj plugin.ObjFile
mapping *profile.Mapping
score int64
}
            
            
            
               
                  assemblyInstruction
                  struct
                  #
               
               
               type assemblyInstruction struct {
address uint64
instruction string
function string
file string
line int
flat int64
cum int64
flatDiv int64
cumDiv int64
startsBlock bool
inlineCalls []callID
}
            
            
            
               
                  callID
                  struct
                  #
               
               
               type callID struct {
file string
line int
}
            
            
            
               
                  instructionInfo
                  struct
                  #
               
               
               instructionInfo holds collected information for an instruction.
               
               type instructionInfo struct {
objAddr uint64
length int
disasm string
file string
line int
flat int64
cum int64
}
            
            
            
               
                  objSymbol
                  struct
                  #
               
               
               objSym represents a symbol identified from a binary. It includes
the SymbolInfo from the disasm package and the base that must be
added to correspond to sample addresses
               
               type objSymbol struct {
sym *plugin.Sym
file plugin.ObjFile
}
            
            
            
               
                  orderSyms
                  struct
                  #
               
               
               orderSyms is a wrapper type to sort []*objSymbol by a supplied comparator.
               
               type orderSyms struct {
v []*objSymbol
less func(a *objSymbol, b *objSymbol) bool
}
            
            
            
               
                  sourceFile
                  struct
                  #
               
               
               sourceFile contains collected information for files we will print.
               
               type sourceFile struct {
fname string
cum int64
flat int64
lines map[int][]sourceInst
funcName map[int]string
}
            
            
            
               
                  sourceFunction
                  struct
                  #
               
               
               sourceFunction contains information for a contiguous range of lines per function we
will print.
               
               type sourceFunction struct {
name string
begin int
end int
flat int64
cum int64
}
            
            
            
               
                  sourceInst
                  struct
                  #
               
               
               sourceInst holds information for an instruction to be displayed.
               
               type sourceInst struct {
addr uint64
stack []callID
}
            
            
            
               
                  sourcePrinter
                  struct
                  #
               
               
               sourcePrinter holds state needed for generating source+asm HTML listing.
               
               type sourcePrinter struct {
reader *sourceReader
synth *synthCode
objectTool plugin.ObjTool
objects map[string]plugin.ObjFile
sym *regexp.Regexp
files map[string]*sourceFile
insts map[uint64]instructionInfo
interest map[string]bool
prettyNames map[string]string
}
            
            
            
               
                  sourceReader
                  struct
                  #
               
               
               sourceReader provides access to source code with caching of file contents.
               
               type sourceReader struct {
searchPath string
trimPath string
files map[string][]string
errors map[string]error
}
            
            
            
               
                  synthCode
                  struct
                  #
               
               
               synthCode assigns addresses to locations without an address.
               
               type synthCode struct {
next uint64
addr map[*profile.Location]uint64
}
            
            
         
          
         
            Functions
            
            
               
                  AddSourceTemplates 
                  function
                  
                  #
               
               
               AddSourceTemplates adds templates used by PrintWebList to t.
               
               func AddSourceTemplates(t *template.Template)
            
            
            
               
                  DocURL 
                  method
                  
                  #
               
               
               DocURL returns the documentation URL for Report, or "" if not available.
               
               func (rpt *Report) DocURL() string
            
            
            
               
                  Generate 
                  function
                  
                  #
               
               
               Generate generates a report as directed by the Report.
               
               func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error
            
            
            
               
                  GetDOT 
                  function
                  
                  #
               
               
               GetDOT returns a graph suitable for dot processing along with some
configuration information.
               
               func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig)
            
            
            
               
                  Legend 
                  method
                  
                  #
               
               
               Legend returns the list of lines to display as the legend.
               
               func (s *StackSet) Legend() []string
            
            
            
               
                  Len 
                  method
                  
                  #
               
               
               func (o orderSyms) Len() int
            
            
            
               
                  Less 
                  method
                  
                  #
               
               
               func (o orderSyms) Less(i int, j int) bool
            
            
            
               
                  MakeWebList 
                  function
                  
                  #
               
               
               MakeWebList returns an annotated source listing of rpt.
rpt.prof should contain inlined call info.
               
               func MakeWebList(rpt *Report, obj plugin.ObjTool, maxFiles int) (WebListData, error)
            
            
            
               
                  New 
                  function
                  
                  #
               
               
               New builds a new report indexing the sample values interpreting the
samples with the provided function.
               
               func New(prof *profile.Profile, o *Options) *Report
            
            
            
               
                  NewDefault 
                  function
                  
                  #
               
               
               NewDefault builds a new report indexing the last sample value
available.
               
               func NewDefault(prof *profile.Profile, options Options) *Report
            
            
            
               
                  OutputFormat 
                  method
                  
                  #
               
               
               OutputFormat returns the output format for the report.
               
               func (rpt *Report) OutputFormat() int
            
            
            
               
                  PrintAssembly 
                  function
                  
                  #
               
               
               PrintAssembly prints annotated disassembly of rpt to w.
               
               func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error
            
            
            
               
                  ProfileLabels 
                  function
                  
                  #
               
               
               ProfileLabels returns printable labels for a profile.
               
               func ProfileLabels(rpt *Report) []string
            
            
            
               
                  Stacks 
                  method
                  
                  #
               
               
               Stacks returns a StackSet for the profile in rpt.
               
               func (rpt *Report) Stacks() StackSet
            
            
            
               
                  Swap 
                  method
                  
                  #
               
               
               func (o orderSyms) Swap(i int, j int)
            
            
            
               
                  TextItems 
                  function
                  
                  #
               
               
               TextItems returns a list of text items from the report and a list
of labels that describe the report.
               
               func TextItems(rpt *Report) ([]TextItem, []string)
            
            
            
               
                  Total 
                  method
                  
                  #
               
               
               Total returns the total number of samples in a report.
               
               func (rpt *Report) Total() int64
            
            
            
               
                  abs64 
                  function
                  
                  #
               
               
               func abs64(i int64) int64
            
            
            
               
                  absoluteURL 
                  function
                  
                  #
               
               
               func absoluteURL(str string) bool
            
            
            
               
                  addLineInfo 
                  function
                  
                  #
               
               
               func addLineInfo(str string, line profile.Line) string
            
            
            
               
                  addStack 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) addStack(addr uint64, frames []plugin.Frame)
            
            
            
               
                  address 
                  method
                  
                  #
               
               
               address returns the synthetic address for loc, creating one if needed.
               
               func (s *synthCode) address(loc *profile.Location) uint64
            
            
            
               
                  allSuffixes 
                  function
                  
                  #
               
               
               allSuffixes returns a list of suffixes (in order of decreasing length)
found by splitting at re.
               
               func allSuffixes(name string, re *regexp.Regexp) []string
            
            
            
               
                  annotateAssembly 
                  function
                  
                  #
               
               
               annotateAssembly annotates a set of assembly instructions with a
set of samples. It returns a set of nodes to display. base is an
offset to adjust the sample addresses.
               
               func annotateAssembly(insts []plugin.Inst, samples graph.Nodes, file plugin.ObjFile) []assemblyInstruction
            
            
            
               
                  callgrindAddress 
                  function
                  
                  #
               
               
               callgrindAddress implements the callgrind subposition compression scheme if
possible. If prevInfo != nil, it contains the previous address. The current
address can be given relative to the previous address, with an explicit +/-
to indicate it is relative, or * for the same address.
               
               func callgrindAddress(prevInfo *graph.NodeInfo, curr uint64) string
            
            
            
               
                  callgrindName 
                  function
                  
                  #
               
               
               callgrindName implements the callgrind naming compression scheme.
For names not previously seen returns "(N) name", where N is a
unique index. For names previously seen returns "(N)" where N is
the index returned the first time.
               
               func callgrindName(names map[string]int, name string) string
            
            
            
               
                  canonicalizeFileName 
                  function
                  
                  #
               
               
               func canonicalizeFileName(fname string) string
            
            
            
               
                  close 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) close()
            
            
            
               
                  computeTotal 
                  function
                  
                  #
               
               
               computeTotal computes the sum of the absolute value of all sample values.
If any samples have label indicating they belong to the diff base, then the
total will only include samples with that label.
               
               func computeTotal(prof *profile.Profile, value func(v []int64) int64, meanDiv func(v []int64) int64) int64
            
            
            
               
                  cumValue 
                  method
                  
                  #
               
               
               func (a *assemblyInstruction) cumValue() int64
            
            
            
               
                  expandAddresses 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) expandAddresses(rpt *Report, addrs map[uint64]addrInfo, flat map[uint64]int64)
            
            
            
               
                  fileError 
                  method
                  
                  #
               
               
               func (reader *sourceReader) fileError(path string) error
            
            
            
               
                  fileNameSuffixes 
                  function
                  
                  #
               
               
               fileNameSuffixes returns a non-empty sequence of shortened file names
(in decreasing preference) that can be used to represent name.
               
               func fileNameSuffixes(name string) []string
            
            
            
               
                  fillPlaces 
                  method
                  
                  #
               
               
               func (s *StackSet) fillPlaces()
            
            
            
               
                  findOrAdd 
                  method
                  
                  #
               
               
               findOrAdd takes a node representing a function, adds the function
represented by the node to the map if the function is not already present,
and returns the function the node represents. This also returns a boolean,
which is true if the function was added and false otherwise.
               
               func (fm functionMap) findOrAdd(ni graph.NodeInfo) (*profile.Function, bool)
            
            
            
               
                  flatValue 
                  method
                  
                  #
               
               
               func (a *assemblyInstruction) flatValue() int64
            
            
            
               
                  functions 
                  method
                  
                  #
               
               
               functions splits apart the lines to show in a file into a list of per-function ranges.
               
               func (sp *sourcePrinter) functions(f *sourceFile) []sourceFunction
            
            
            
               
                  genLabel 
                  function
                  
                  #
               
               
               func genLabel(d int, n string, l string, f string) string
            
            
            
               
                  generate 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) generate(maxFiles int, rpt *Report) WebListData
            
            
            
               
                  generateFile 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) generateFile(f *sourceFile, rpt *Report) WebListFile
            
            
            
               
                  getDisambiguatedNames 
                  function
                  
                  #
               
               
               getDisambiguatedNames returns a map from each node in the graph to
the name to use in the callgrind output. Callgrind merges all
functions with the same [file name, function name]. Add a [%d/n]
suffix to disambiguate nodes with different values of
node.Function, which we want to keep separate. In particular, this
affects graphs created with --call_tree, where nodes from different
contexts are associated to different Functions.
               
               func getDisambiguatedNames(g *graph.Graph) map[*graph.Node]string
            
            
            
               
                  getSourceFromFile 
                  function
                  
                  #
               
               
               getSourceFromFile collects the sources of a function from a source
file and annotates it with the samples in fns. Returns the sources
as nodes, using the info.name field to hold the source code.
               
               func getSourceFromFile(file string, reader *sourceReader, fns graph.Nodes, start int, end int) (graph.Nodes, string, error)
            
            
            
               
                  graphTotal 
                  function
                  
                  #
               
               
               func graphTotal(g *graph.Graph) int64
            
            
            
               
                  handleUnprocessed 
                  method
                  
                  #
               
               
               handleUnprocessed handles addresses that were skipped by splitIntoRanges because they
did not belong to a known object file.
               
               func (sp *sourcePrinter) handleUnprocessed(addrs map[uint64]addrInfo, unprocessed []uint64)
            
            
            
               
                  indentation 
                  function
                  
                  #
               
               
               func indentation(line string) int
            
            
            
               
                  initSamples 
                  method
                  
                  #
               
               
               func (sp *sourcePrinter) initSamples(flat map[uint64]int64, cum map[uint64]int64)
            
            
            
               
                  legendActiveFilters 
                  function
                  
                  #
               
               
               func legendActiveFilters(activeFilters []string) []string
            
            
            
               
                  line 
                  method
                  
                  #
               
               
               line returns the line numbered "lineno" in path, or _,false if lineno is out of range.
               
               func (reader *sourceReader) line(path string, lineno int) (string, bool)
            
            
            
               
                  makeInitialStacks 
                  method
                  
                  #
               
               
               func (s *StackSet) makeInitialStacks(rpt *Report)
            
            
            
               
                  makeWebListInstructions 
                  function
                  
                  #
               
               
               func makeWebListInstructions(srcIndent int, assembly []assemblyInstruction, reader *sourceReader, rpt *Report) []WebListInstruction
            
            
            
               
                  makeWebListLine 
                  function
                  
                  #
               
               
               makeWebListLine returns the contents of a single line in a web listing. This includes
the source line and the corresponding assembly.
               
               func makeWebListLine(lineNo int, flat int64, cum int64, lineContents string, assembly []assemblyInstruction, reader *sourceReader, rpt *Report) WebListLine
            
            
            
               
                  newGraph 
                  method
                  
                  #
               
               
               newGraph creates a new graph for this report. If nodes is non-nil,
only nodes whose info matches are included. Otherwise, all nodes
are included, without trimming.
               
               func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph
            
            
            
               
                  newSourcePrinter 
                  function
                  
                  #
               
               
               func newSourcePrinter(rpt *Report, obj plugin.ObjTool, sourcePath string) *sourcePrinter
            
            
            
               
                  newSourceReader 
                  function
                  
                  #
               
               
               func newSourceReader(searchPath string, trimPath string) *sourceReader
            
            
            
               
                  newSynthCode 
                  function
                  
                  #
               
               
               func newSynthCode(mappings []*profile.Mapping) *synthCode
            
            
            
               
                  newTrimmedGraph 
                  method
                  
                  #
               
               
               newTrimmedGraph creates a graph for this report, trimmed according
to the report options.
               
               func (rpt *Report) newTrimmedGraph() (g *graph.Graph, origCount int, droppedNodes int, droppedEdges int)
            
            
            
               
                  nodesPerSymbol 
                  function
                  
                  #
               
               
               nodesPerSymbol classifies nodes into a group of symbols.
               
               func nodesPerSymbol(ns graph.Nodes, symbols []*objSymbol) map[*objSymbol]graph.Nodes
            
            
            
               
                  objectFile 
                  method
                  
                  #
               
               
               objectFile return the object for the specified mapping, opening it if necessary.
It returns nil on error.
               
               func (sp *sourcePrinter) objectFile(m *profile.Mapping) plugin.ObjFile
            
            
            
               
                  openSourceFile 
                  function
                  
                  #
               
               
               openSourceFile opens a source file from a name encoded in a profile. File
names in a profile after can be relative paths, so search them in each of
the paths in searchPath and their parents. In case the profile contains
absolute paths, additional paths may be configured to trim from the source
paths in the profile. This effectively turns the path into a relative path
searching it using searchPath as usual).
               
               func openSourceFile(path string, searchPath string, trim string) (*os.File, error)
            
            
            
               
                  packageName 
                  function
                  
                  #
               
               
               packageName returns the package name of the named symbol, or "" if not found.
               
               func packageName(name string) string
            
            
            
               
                  pickColor 
                  function
                  
                  #
               
               
               pickColor picks a color for key.
               
               func pickColor(key string) int
            
            
            
               
                  printAssembly 
                  function
                  
                  #
               
               
               printAssembly prints an annotated assembly listing.
               
               func printAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool) error
            
            
            
               
                  printCallgrind 
                  function
                  
                  #
               
               
               printCallgrind prints a graph for a profile on callgrind format.
               
               func printCallgrind(w io.Writer, rpt *Report) error
            
            
            
            
            
               
                  printDOT 
                  function
                  
                  #
               
               
               printDOT prints an annotated callgraph in DOT format.
               
               func printDOT(w io.Writer, rpt *Report) error
            
            
            
               
                  printProto 
                  function
                  
                  #
               
               
               printProto writes the incoming proto via the writer w.
If the divide_by option has been specified, samples are scaled appropriately.
               
               func printProto(w io.Writer, rpt *Report) error
            
            
            
               
                  printSource 
                  function
                  
                  #
               
               
               printSource prints an annotated source listing, include all
functions with samples that match the regexp rpt.options.symbol.
The sources are sorted by function name and then by filename to
eliminate potential nondeterminism.
               
               func printSource(w io.Writer, rpt *Report) error
            
            
            
               
                  printTags 
                  function
                  
                  #
               
               
               printTags collects all tags referenced in the profile and prints
them in a sorted table.
               
               func printTags(w io.Writer, rpt *Report) error
            
            
            
               
                  printText 
                  function
                  
                  #
               
               
               printText prints a flat text report for a profile.
               
               func printText(w io.Writer, rpt *Report) error
            
            
            
               
                  printTopProto 
                  function
                  
                  #
               
               
               printTopProto writes a list of the hottest routines in a profile as a profile.proto.
               
               func printTopProto(w io.Writer, rpt *Report) error
            
            
            
               
                  printTraces 
                  function
                  
                  #
               
               
               printTraces prints all traces from a profile.
               
               func printTraces(w io.Writer, rpt *Report) error
            
            
            
               
                  printTree 
                  function
                  
                  #
               
               
               printTree prints a tree-based report in text form.
               
               func printTree(w io.Writer, rpt *Report) error
            
            
            
               
                  reportLabels 
                  function
                  
                  #
               
               
               reportLabels returns printable labels for a report. Includes
profileLabels.
               
               func reportLabels(rpt *Report, shownTotal int64, nodeCount int, origCount int, droppedNodes int, droppedEdges int, fullHeaders bool) []string
            
            
            
               
                  rightPad 
                  function
                  
                  #
               
               
               rightPad pads the input with spaces on the right-hand-side to make it have
at least width n. It treats tabs as enough spaces that lead to the next
8-aligned tab-stop.
               
               func rightPad(s string, n int) string
            
            
            
               
                  selectOutputUnit 
                  method
                  
                  #
               
               
               func (rpt *Report) selectOutputUnit(g *graph.Graph)
            
            
            
               
                  shortNameList 
                  function
                  
                  #
               
               
               shortNameList returns a non-empty sequence of shortened names
(in decreasing preference) that can be used to represent name.
               
               func shortNameList(name string) []string
            
            
            
               
                  splitIntoRanges 
                  method
                  
                  #
               
               
               splitIntoRanges converts the set of addresses we are interested in into a set of address
ranges to disassemble. It also returns the set of addresses found that did not have an
associated object file and were therefore not added to an address range.
               
               func (sp *sourcePrinter) splitIntoRanges(prof *profile.Profile, addrMap map[uint64]addrInfo, flat map[uint64]int64) ([]addressRange, []uint64)
            
            
            
               
                  symbolsFromBinaries 
                  function
                  
                  #
               
               
               symbolsFromBinaries examines the binaries listed on the profile that have
associated samples, and returns the identified symbols matching rx.
               
               func symbolsFromBinaries(prof *profile.Profile, g *graph.Graph, rx *regexp.Regexp, address *uint64, obj plugin.ObjTool) []*objSymbol
            
            
            
               
                  trimPath 
                  function
                  
                  #
               
               
               trimPath cleans up a path by removing prefixes that are commonly
found on profiles plus configured prefixes.
TODO(aalexand): Consider optimizing out the redundant work done in this
function if it proves to matter.
               
               func trimPath(path string, trimPath string, searchPath string) string
            
            
            
               
                  valueOrDot 
                  function
                  
                  #
               
               
               valueOrDot formats a value according to a report, intercepting zero
values.
               
               func valueOrDot(value int64, rpt *Report) string