Documentation ¶
Index ¶
- func AvailableCacheEvents() []string
- func AvailableHardwareEvents() []string
- func AvailableSoftwareEvents() []string
- func AvailableTraceEvents() []string
- func IsAvailable(ev perf.Configurator) bool
- func MultiErr(errs []error) error
- func NameToConfig(name string) (perf.Configurator, error)
- func NewTableWriter(w io.Writer) *tablewriter.Table
- func ParseRegion(s string, bin *bininfo.BinFile) (*utrace.AddressRegion, error)
- func SetLogger(l *log.Logger)
- type CSVWriter
- type Events
- type GroupProfiler
- type Metrics
- type MetricsWriter
- type MultiError
- type MultiProfiler
- type NamedMetrics
- type Profiler
- type Result
- type SingleProfiler
- type TotalMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableCacheEvents ¶
func AvailableCacheEvents() []string
AvailableCacheEvents returns the list of available cache events.
func AvailableHardwareEvents ¶
func AvailableHardwareEvents() []string
AvailableHardwareEvents returns the list of available hardware events.
func AvailableSoftwareEvents ¶
func AvailableSoftwareEvents() []string
AvailableSoftwareEvents returns the list of available software events.
func AvailableTraceEvents ¶
func AvailableTraceEvents() []string
AvailableTraceEvents returns the list of available trace events.
func IsAvailable ¶
func IsAvailable(ev perf.Configurator) bool
IsAvailable returns true if the given event is available on the current system.
func MultiErr ¶
MultiErr creates a MultiError from the given list of errors or returns nil if the list is empty.
func NameToConfig ¶
func NameToConfig(name string) (perf.Configurator, error)
NameToConfig converts a string representation of an event to a perf configurator.
func NewTableWriter ¶
func NewTableWriter(w io.Writer) *tablewriter.Table
NewTableWriter creates a MetricsWriter that writes a pretty-printed ASCII table.
func ParseRegion ¶
ParseRegion parses an address region. The region is written as loc-loc, where 'loc' is a location specified as either a file:line source code location (if the elf binary has DWARF debugging information), or a direct hexadecimal address in the form 0x...
Types ¶
type CSVWriter ¶
A CSVWriter is a MetricsWriter that outputs the information in CSV format.
func NewCSVWriter ¶
NewCSVWriter creates a CSVWriter that writes to the given output writer.
type Events ¶
type Events struct { Base []perf.Configurator Groups [][]perf.Configurator }
Events is a specification for which perf events should be tracked. A Base set of events is tracked using standard perf, and sets of groups of events may also be given to avoid multiplexing between events in the same group.
type GroupProfiler ¶
A GroupProfiler profiles a set of events as one group so that the events cannot be multiplexed with respect to each other.
func NewGroupProfiler ¶
func NewGroupProfiler(attrs []*perf.Attr, pid, cpu int) (*GroupProfiler, error)
NewGroupProfiler creates a profiler for measuring the set of given perf events as a group (no multiplexing).
func (*GroupProfiler) Metrics ¶
func (p *GroupProfiler) Metrics() Metrics
Metrics returns the collected group event metrics.
type MetricsWriter ¶
A MetricsWriter is an interface for writing tables.
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
MultiError stores multiple errors.
func (*MultiError) Error ¶
func (e *MultiError) Error() string
type MultiProfiler ¶
type MultiProfiler struct {
// contains filtered or unexported fields
}
A MultiProfiler runs multiple profilers, each of which may profile for groups of events.
func NewMultiProfiler ¶
func NewMultiProfiler(attrs []*perf.Attr, pid, cpu int) (*MultiProfiler, error)
NewMultiProfiler initializes a profiler for recording multiple perf events at once.
func (*MultiProfiler) Disable ¶
func (p *MultiProfiler) Disable() error
Disable recording of all events.
func (*MultiProfiler) Enable ¶
func (p *MultiProfiler) Enable() error
Enable recording of all events.
func (*MultiProfiler) Metrics ¶
func (p *MultiProfiler) Metrics() Metrics
Metrics returns the collected metrics.
type NamedMetrics ¶
NamedMetrics associates a metrics structure with a name. This is useful for associated metrics structures with regions.
func (NamedMetrics) WriteTo ¶
func (m NamedMetrics) WriteTo(table MetricsWriter)
WriteTo pretty-prints the metrics and writes the result to a MetricsWriter.
type Profiler ¶
A Profiler supports profiling for a certain amount of time and then reporting the results via a Metrics structure.
type Result ¶
A Result represents a single event, marked by Label, and the counter value returned by the perf monitor.
type SingleProfiler ¶
A SingleProfiler profiles one event
func NewSingleProfiler ¶
func NewSingleProfiler(attr *perf.Attr, pid, cpu int) (*SingleProfiler, error)
NewSingleProfiler opens a new profiler for the given event and process.
func (*SingleProfiler) Metrics ¶
func (p *SingleProfiler) Metrics() Metrics
Metrics returns the collected metrics.
func (*SingleProfiler) Reset ¶
func (p *SingleProfiler) Reset() error
Reset all metrics collected so far.
type TotalMetrics ¶
type TotalMetrics []NamedMetrics
TotalMetrics is a list of metrics and the region they are associated with.
func Run ¶
func Run(target string, args []string, regionNames []string, events Events, attropts perf.Options, immediate func() MetricsWriter) (TotalMetrics, error)
Run executes the given command with tracing for certain events enabled. A structure with all perf metrics is returned.
func (TotalMetrics) WriteTo ¶
func (t TotalMetrics) WriteTo(table MetricsWriter, sortKey string, reverse bool)
WriteTo pretty-prints the metrics and writes the result to a MetricsWriter. The sortKey and reverse parameters configure the table arrangement: which entry to sort by and whether the sort should be in reverse order.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bininfo provides functions for reading elf binary files and converting file/line pairs or functions to addresses.
|
Package bininfo provides functions for reading elf binary files and converting file/line pairs or functions to addresses. |
cmd
|
|
Package utrace provides an interface for tracing user-level code with ptrace.
|
Package utrace provides an interface for tracing user-level code with ptrace. |