Documentation ¶
Index ¶
- Constants
- Variables
- type BranchEntry
- type CommRecord
- type CounterEventDecoderFn
- type CounterEventGroupMember
- type CounterEventValue
- type CounterGroup
- type CounterValue
- type EventAttr
- type EventMonitor
- func (monitor *EventMonitor) Close() error
- func (monitor *EventMonitor) Disable(eventid uint64)
- func (monitor *EventMonitor) DisableAll()
- func (monitor *EventMonitor) DisableGroup(groupID int32) error
- func (monitor *EventMonitor) Enable(eventid uint64)
- func (monitor *EventMonitor) EnableAll()
- func (monitor *EventMonitor) EnableGroup(groupID int32) error
- func (monitor *EventMonitor) EnqueueExternalSample(eventID uint64, sampleID SampleID, decodedData TraceEventSampleData) error
- func (monitor *EventMonitor) RegisterCounterEventGroup(name string, counters []CounterEventGroupMember, ...) (int32, uint64, error)
- func (monitor *EventMonitor) RegisterEventGroup(name string) (int32, error)
- func (monitor *EventMonitor) RegisterExternalEvent(name string, decoderFn TraceEventDecoderFn) (uint64, error)
- func (monitor *EventMonitor) RegisterKprobe(address string, onReturn bool, output string, fn TraceEventDecoderFn, ...) (uint64, error)
- func (monitor *EventMonitor) RegisterTracepoint(name string, fn TraceEventDecoderFn, options ...RegisterEventOption) (uint64, error)
- func (monitor *EventMonitor) RegisterUprobe(bin string, address string, onReturn bool, output string, ...) (uint64, error)
- func (monitor *EventMonitor) RegisteredEventFields(eventID uint64) map[string]int32
- func (monitor *EventMonitor) RegisteredEventType(eventID uint64) (EventType, bool)
- func (monitor *EventMonitor) Run(fn SampleDispatchFn) error
- func (monitor *EventMonitor) SetFilter(eventid uint64, filter string) error
- func (monitor *EventMonitor) Stop(wait bool)
- func (monitor *EventMonitor) UnregisterEvent(eventid uint64) error
- func (monitor *EventMonitor) UnregisterEventGroup(groupID int32) error
- type EventMonitorOption
- func WithCgroup(cgroup string) EventMonitorOption
- func WithCgroups(cgroups []string) EventMonitorOption
- func WithDefaultEventAttr(defaultEventAttr *EventAttr) EventMonitorOption
- func WithFlags(flags uintptr) EventMonitorOption
- func WithPerfEventDir(dir string) EventMonitorOption
- func WithPid(pid int) EventMonitorOption
- func WithPids(pids []int) EventMonitorOption
- func WithRingBufferNumPages(numPages int) EventMonitorOption
- func WithTracingDir(dir string) EventMonitorOption
- type EventMonitorSample
- type EventType
- type ExitRecord
- type ForkRecord
- type LostRecord
- type RegisterEventOption
- type Sample
- type SampleDispatchFn
- type SampleID
- type SampleRecord
- type TraceEvent
- type TraceEventDecoderFn
- type TraceEventSampleData
Constants ¶
const ( PERF_EVENT_IOC_ENABLE uintptr = 0x2400 + 0 PERF_EVENT_IOC_DISABLE = 0x2400 + 1 PERF_EVENT_IOC_REFRESH = 0x2400 + 2 PERF_EVENT_IOC_RESET = 0x2400 + 3 PERF_EVENT_IOC_PERIOD = 0x40080000 | (0x2400 + 4) PERF_EVENT_IOC_SET_OUTPUT = 0x2400 + 5 PERF_EVENT_IOC_SET_FILTER = 0x40080000 | (0x2400 + 6) PERF_EVENT_IOC_ID = 0x80080000 | (0x2400 + 7) PERF_EVENT_IOC_SET_BPF = 0x40040000 | (0x2400 + 8) PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40040000 | (0x2400 + 9) )
const ( PERF_FLAG_FD_NO_GROUP uintptr = 1 << iota PERF_FLAG_FD_OUTPUT PERF_FLAG_PID_CGROUP PERF_FLAG_FD_CLOEXEC )
const ( PERF_FORMAT_TOTAL_TIME_ENABLED uint64 = 1 << iota PERF_FORMAT_TOTAL_TIME_RUNNING PERF_FORMAT_ID PERF_FORMAT_GROUP )
const ( PERF_TYPE_HARDWARE uint32 = iota PERF_TYPE_SOFTWARE PERF_TYPE_TRACEPOINT PERF_TYPE_HW_CACHE PERF_TYPE_RAW PERF_TYPE_BREAKPOINT PERF_TYPE_MAX )
const ( PERF_COUNT_HW_CPU_CYCLES uint64 = iota PERF_COUNT_HW_INSTRUCTIONS PERF_COUNT_HW_CACHE_REFERENCES PERF_COUNT_HW_CACHE_MISSES PERF_COUNT_HW_BRANCH_INSTRUCTIONS PERF_COUNT_HW_BRANCH_MISSES PERF_COUNT_HW_BUS_CYCLES PERF_COUNT_HW_STALLED_CYCLES_FRONTEND PERF_COUNT_HW_STALLED_CYCLES_BACKEND PERF_COUNT_HW_REF_CPU_CYCLES PERF_COUNT_HW_MAX )
const ( PERF_COUNT_HW_CACHE_L1D uint64 = iota PERF_COUNT_HW_CACHE_L1I PERF_COUNT_HW_CACHE_LL PERF_COUNT_HW_CACHE_DTLB PERF_COUNT_HW_CACHE_ITLB PERF_COUNT_HW_CACHE_BPU PERF_COUNT_HW_CACHE_NODE PERF_COUNT_HW_CACHE_MAX )
const ( PERF_COUNT_HW_CACHE_OP_READ uint64 = iota PERF_COUNT_HW_CACHE_OP_WRITE PERF_COUNT_HW_CACHE_OP_PREFETCH PERF_COUNT_HW_CACHE_OP_MAX )
const ( PERF_COUNT_HW_CACHE_RESULT_ACCESS uint64 = iota PERF_COUNT_HW_CACHE_RESULT_MISS PERF_COUNT_HW_CACHE_RESULT_MAX )
const ( PERF_COUNT_SW_CPU_CLOCK uint64 = iota PERF_COUNT_SW_TASK_CLOCK PERF_COUNT_SW_PAGE_FAULTS PERF_COUNT_SW_CONTEXT_SWITCHES PERF_COUNT_SW_CPU_MIGRATIONS PERF_COUNT_SW_PAGE_FAULTS_MIN PERF_COUNT_SW_PAGE_FAULTS_MAJ PERF_COUNT_SW_ALIGNMENT_FAULTS PERF_COUNT_SW_EMULATION_FAULTS PERF_COUNT_SW_DUMMY PERF_COUNT_BPF_OUTPUT PERF_COUNT_SW_MAX )
const ( PERF_RECORD_INVALID uint32 = iota PERF_RECORD_MMAP PERF_RECORD_LOST PERF_RECORD_COMM PERF_RECORD_EXIT PERF_RECORD_THROTTLE PERF_RECORD_UNTHROTTLE PERF_RECORD_FORK PERF_RECORD_READ PERF_RECORD_SAMPLE PERF_RECORD_MMAP2 PERF_RECORD_AUX PERF_RECORD_ITRACE_START PERF_RECORD_LOST_SAMPLES PERF_RECORD_SWITCH PERF_RECORD_SWITCH_CPU_WIDE PERF_RECORD_MAX )
const ( PERF_SAMPLE_IP uint64 = 1 << iota PERF_SAMPLE_TID PERF_SAMPLE_TIME PERF_SAMPLE_ADDR PERF_SAMPLE_READ PERF_SAMPLE_CALLCHAIN PERF_SAMPLE_ID PERF_SAMPLE_CPU PERF_SAMPLE_PERIOD PERF_SAMPLE_STREAM_ID PERF_SAMPLE_RAW PERF_SAMPLE_BRANCH_STACK PERF_SAMPLE_REGS_USER PERF_SAMPLE_STACK_USER PERF_SAMPLE_WEIGHT PERF_SAMPLE_DATA_SRC PERF_SAMPLE_IDENTIFIER PERF_SAMPLE_TRANSACTION PERF_SAMPLE_REGS_INTR PERF_SAMPLE_MAX )
const ( // TraceEventFieldTypeString is a string. TraceEventFieldTypeString int32 // TraceEventFieldTypeSignedInt8 is an 8-bit signed integer. TraceEventFieldTypeSignedInt8 // TraceEventFieldTypeSignedInt16 is a 16-bit signed integer. TraceEventFieldTypeSignedInt16 // TraceEventFieldTypeSignedInt32 is a 32-bit signed integer. TraceEventFieldTypeSignedInt32 // TraceEventFieldTypeSignedInt64 is a 64-bit signed integer. TraceEventFieldTypeSignedInt64 // TraceEventFieldTypeUnsignedInt8 is an 8-bit unsigned integer. TraceEventFieldTypeUnsignedInt8 // TraceEventFieldTypeUnsignedInt16 is a 16-bit unsigned integer. TraceEventFieldTypeUnsignedInt16 // TraceEventFieldTypeUnsignedInt32 is a 32-bit unsigned integer. TraceEventFieldTypeUnsignedInt32 // TraceEventFieldTypeUnsignedInt64 is a 64-bit unsigned integer. TraceEventFieldTypeUnsignedInt64 )
const (
PERF_EVENT_IOC_FLAG_GROUP uintptr = 1 << iota
)
const (
PERF_RECORD_MISC_COMM_EXEC uint16 = (1 << 13)
)
Variables ¶
var EventTypeNames = map[EventType]string{ EventTypeTracepoint: "EventTypeTracepoint", EventTypeKprobe: "EventTypeKprobe", EventTypeUprobe: "EventTypeUprobe", EventTypeHardware: "EventTypeHardware", EventTypeSoftware: "EventTypeSoftware", EventTypeHardwareCache: "EventTypeHardwareCache", EventTypeRaw: "EventTypeRaw", EventTypeBreakpoint: "EventTypeBreakpoint", EventTypeDynamicPMU: "EventTypeDynamicPMU", EventTypeExternal: "EventTypeExternal", }
EventTypeNames is a mapping of EventType to a human-readable string that is the name of the symbolic constant.
Functions ¶
This section is empty.
Types ¶
type BranchEntry ¶
type BranchEntry struct { From uint64 To uint64 Mispred bool Predicted bool InTx bool Abort bool Cycles uint16 }
BranchEntry is a translation of the Linux kernel's struct perf_branch_entry into Go. It may appear in SampleRecord if PERF_SAMPLE_BRANCH_STACK is set.
type CommRecord ¶
CommRecord is a translation of the structure used by the Linux kernel for PERF_RECORD_COMM samples into Go.
type CounterEventDecoderFn ¶
type CounterEventDecoderFn func(*SampleRecord, []CounterEventValue, uint64, uint64) (interface{}, error)
CounterEventDecoderFn is the signature of a function to call to decode a counter event sample. The first argument is the sample to be decoded, the second is a map of event counter IDs to values, the third is the total time the event has been enabled, and the fourth is the total time the event has been running.
type CounterEventGroupMember ¶
CounterEventGroupMember defines a counter event group member at registration time. Each member must have an event type of software, hardware, or hardware cache, as well as a configuration value that specifies what counter information to return.
type CounterEventValue ¶
CounterEventValue is a counter value returned from the kernel. The EventType and Config values are what were used to register the counter group member, and Value is the value returned with the sample.
type CounterGroup ¶
type CounterGroup struct { TimeEnabled uint64 TimeRunning uint64 Values []CounterValue }
CounterGroup represents the read values of a group of counter events
type CounterValue ¶
type CounterValue struct { // Globally unique identifier for this counter event. Only // present if PERF_FORMAT_ID was specified. ID uint64 // The counter result Value uint64 }
CounterValue resepresents the read value of a counter event
type EventAttr ¶
type EventAttr struct { Type uint32 Size uint32 Config uint64 SamplePeriod uint64 SampleFreq uint64 SampleType uint64 ReadFormat uint64 Disabled bool Inherit bool Pinned bool Exclusive bool ExclusiveUser bool ExclusiveKernel bool ExclusiveHV bool ExclusiveIdle bool Mmap bool Comm bool Freq bool InheritStat bool EnableOnExec bool Task bool Watermark bool PreciseIP uint8 MmapData bool SampleIDAll bool ExcludeHost bool ExcludeGuest bool ExcludeCallchainKernel bool ExcludeCallchainUser bool Mmap2 bool CommExec bool UseClockID bool ContextSwitch bool WakeupEvents uint32 WakeupWatermark uint32 BPType uint32 BPAddr uint64 Config1 uint64 BPLen uint64 Config2 uint64 BranchSampleType uint64 SampleRegsUser uint64 SampleStackUser uint32 ClockID int32 SampleRegsIntr uint64 AuxWatermark uint32 SampleMaxStack uint16 }
EventAttr is a translation of the Linux kernel's struct perf_event_attr into Go. It provides detailed configuration information for the event being created.
type EventMonitor ¶
type EventMonitor struct {
// contains filtered or unexported fields
}
EventMonitor is a high-level interface to the Linux kernel's perf_event infrastructure.
func NewEventMonitor ¶
func NewEventMonitor(options ...EventMonitorOption) (*EventMonitor, error)
NewEventMonitor creates a new EventMonitor instance in the stopped state. Once an EventMonitor instance is returned from this function, its Close method must be called to clean it up gracefully, even if no events are registered or it is never put into the running state.
func (*EventMonitor) Close ¶
func (monitor *EventMonitor) Close() error
Close gracefully cleans up an EventMonitor instance. If the EventMonitor is still running when Close is called, it will first be stopped. After Close completes, the EventMonitor instance cannot be reused.
func (*EventMonitor) Disable ¶
func (monitor *EventMonitor) Disable(eventid uint64)
Disable is used to disable a registered event. The event to disable is specified by its event ID as returned when the event was initially registered with the EventMonitor.
func (*EventMonitor) DisableAll ¶
func (monitor *EventMonitor) DisableAll()
DisableAll disables all events that are registered with the EventMonitor.
func (*EventMonitor) DisableGroup ¶
func (monitor *EventMonitor) DisableGroup(groupID int32) error
DisableGroup disables all events for an event group.
func (*EventMonitor) Enable ¶
func (monitor *EventMonitor) Enable(eventid uint64)
Enable is used to enable a registered event. The event to enable is specified by its event ID as returned when the event was initially registered with the EventMonitor.
func (*EventMonitor) EnableAll ¶
func (monitor *EventMonitor) EnableAll()
EnableAll enables all events that are registered with the EventMonitor.
func (*EventMonitor) EnableGroup ¶
func (monitor *EventMonitor) EnableGroup(groupID int32) error
EnableGroup enables all events for an event group.
func (*EventMonitor) EnqueueExternalSample ¶
func (monitor *EventMonitor) EnqueueExternalSample( eventID uint64, sampleID SampleID, decodedData TraceEventSampleData, ) error
EnqueueExternalSample enqueues an external sample to a registered external eventID. Events may not be enqueued for eventIDs that are not registered or not registered as external. Events with timestamps that fall outside the eventstream will be dropped.
func (*EventMonitor) RegisterCounterEventGroup ¶
func (monitor *EventMonitor) RegisterCounterEventGroup( name string, counters []CounterEventGroupMember, decoderFn CounterEventDecoderFn, options ...RegisterEventOption, ) (int32, uint64, error)
RegisterCounterEventGroup registers a performance counter event group.
func (*EventMonitor) RegisterEventGroup ¶
func (monitor *EventMonitor) RegisterEventGroup(name string) (int32, error)
RegisterEventGroup creates a new event group that can be used for grouping events.
func (*EventMonitor) RegisterExternalEvent ¶
func (monitor *EventMonitor) RegisterExternalEvent( name string, decoderFn TraceEventDecoderFn, ) (uint64, error)
RegisterExternalEvent is used to register an event that can be injected into the EventMonitor event stream from an external source. An event ID is returned that is unique to the EventMonitor and is to be used to unregister the event. The event ID will also be passed to the EventMonitor's dispatch function.
func (*EventMonitor) RegisterKprobe ¶
func (monitor *EventMonitor) RegisterKprobe( address string, onReturn bool, output string, fn TraceEventDecoderFn, options ...RegisterEventOption, ) (uint64, error)
RegisterKprobe is used to register a kprobe with an EventMonitor. The kprobe will first be registered with the kernel, and then registered with the EventMonitor. An event ID is returned that is unqiue to the EventMonitor and is to be used to unregister the event. The event ID will also be passed to the EventMonitor's dispatch function.
func (*EventMonitor) RegisterTracepoint ¶
func (monitor *EventMonitor) RegisterTracepoint( name string, fn TraceEventDecoderFn, options ...RegisterEventOption, ) (uint64, error)
RegisterTracepoint is used to register a tracepoint with an EventMonitor. The tracepoint is selected by name and it must exist in the running Linux kernel. An event ID is returned that is unique to the EventMonitor and is to be used to unregister the event. The event ID will also be passed to the EventMonitor's dispatch function.
func (*EventMonitor) RegisterUprobe ¶
func (monitor *EventMonitor) RegisterUprobe( bin string, address string, onReturn bool, output string, fn TraceEventDecoderFn, options ...RegisterEventOption, ) (uint64, error)
RegisterUprobe is used to register a uprobe with an EventMonitor. The uprobe will first be registered with the kernel, and then registered with the EventMonitor. An event ID is returned that is unique to the EventMonitor and is to be used to unregister the event. The event ID will also be passed to the EventMonitor's dispatch function.
func (*EventMonitor) RegisteredEventFields ¶
func (monitor *EventMonitor) RegisteredEventFields( eventID uint64, ) map[string]int32
RegisteredEventFields returns the fields that are defined for the specified event identifier.
func (*EventMonitor) RegisteredEventType ¶
func (monitor *EventMonitor) RegisteredEventType( eventID uint64, ) (EventType, bool)
RegisteredEventType returns the type of an event
func (*EventMonitor) Run ¶
func (monitor *EventMonitor) Run(fn SampleDispatchFn) error
Run puts an EventMonitor into the running state. While an EventMonitor is running, samples will be pulled from event sources, decoded, and dispatched to a function that is specified here.
func (*EventMonitor) SetFilter ¶
func (monitor *EventMonitor) SetFilter(eventid uint64, filter string) error
SetFilter is used to set or remove a filter from a registered event.
func (*EventMonitor) Stop ¶
func (monitor *EventMonitor) Stop(wait bool)
Stop stops a running EventMonitor. If the EventMonitor is not running, this function does nothing. Once an EventMonitor has been stopped, it may be restarted again. Whether Stop waits for the EventMonitor to fully stop is optional, but if the caller does not wait there is no other mechanism by which the caller may learn whether the EventMonitor is stopped.
func (*EventMonitor) UnregisterEvent ¶
func (monitor *EventMonitor) UnregisterEvent(eventid uint64) error
UnregisterEvent is used to remove a previously registered event from an EventMonitor. The event can be of any type and is specified by the event ID that was returned when the event was initially registered with the EventMonitor.
func (*EventMonitor) UnregisterEventGroup ¶
func (monitor *EventMonitor) UnregisterEventGroup(groupID int32) error
UnregisterEventGroup removes a registered event group. If there are any events registered with the event group, they will be unregistered as well.
type EventMonitorOption ¶
type EventMonitorOption func(*eventMonitorOptions)
EventMonitorOption is used to implement optional arguments for NewEventMonitor. It must be exported, but it is not typically used directly.
func WithCgroup ¶
func WithCgroup(cgroup string) EventMonitorOption
WithCgroup is used to add a cgroup to the set of sources to monitor.
func WithCgroups ¶
func WithCgroups(cgroups []string) EventMonitorOption
WithCgroups is used to add a list of cgroups to the set of sources to monitor.
func WithDefaultEventAttr ¶
func WithDefaultEventAttr(defaultEventAttr *EventAttr) EventMonitorOption
WithDefaultEventAttr is used to set an optional EventAttr struct to be used by default when registering events and no EventAttr is specified as part of the registration.
func WithFlags ¶
func WithFlags(flags uintptr) EventMonitorOption
WithFlags is used to set optional flags when creating a new EventMonitor. The flags are passed to the low-level perf_event_open() system call.
func WithPerfEventDir ¶
func WithPerfEventDir(dir string) EventMonitorOption
WithPerfEventDir is used to set an optional directory to use for monitoring cgroups. This should only be necessary if the perf_event cgroup fs is not mounted in the usual location.
func WithPid ¶
func WithPid(pid int) EventMonitorOption
WithPid is used to add a pid to the set of sources to monitor.
func WithPids ¶
func WithPids(pids []int) EventMonitorOption
WithPids is used to add a list of pids to the set of sources to monitor.
func WithRingBufferNumPages ¶
func WithRingBufferNumPages(numPages int) EventMonitorOption
WithRingBufferNumPages is used to set the size of the ringbuffers used to retrieve samples from the kernel.
func WithTracingDir ¶
func WithTracingDir(dir string) EventMonitorOption
WithTracingDir is used to set an alternate mountpoint to use for managing tracepoints, kprobes, and uprobes.
type EventMonitorSample ¶
type EventMonitorSample struct { // EventID is the event ID that generated the sample. This is the ID // returned by one of the event registration functions. EventID uint64 // RawSample is the raw sample from the perf_event interface. RawSample Sample // DecodedData is the sample data decoded from RawSample.Record.RawData // if RawSample is of type *SampleRecord; otherwise, it will be nil. DecodedData TraceEventSampleData // DecodedSample is the value returned from calling the registered // decoder for RawSample and DecodedData together. DecodedSample interface{} // Err will be non-nil if any occurred during processing of RawSample. Err error }
EventMonitorSample is an encapsulation of a sample from the EventMonitor interface. It contains the raw sample, decoded data, translated sample, and any error that may have occurred while processing the sample.
type EventType ¶
type EventType int
EventType represents the type of an event (tracepoint, external, etc.)
const ( // EventTypeInvalid is not a valid event type EventTypeInvalid EventType = iota // EventTypeTracepoint is a trace event (PERF_TYPE_TRACEPOINT) EventTypeTracepoint // EventTypeKprobe is a kernel probe EventTypeKprobe // EventTypeUprobe is a user probe EventTypeUprobe // EventTypeHardware is a hardware event (PERF_TYPE_HARDWARE) EventTypeHardware // EventTypeSoftware is a software event (PERF_TYPE_SOFTWARE) EventTypeSoftware // EventTypeHardwareCache is a hardware cache event (PERF_TYPE_HW_CACHE) EventTypeHardwareCache // EventTypeRaw is a raw event (PERF_TYPE_RAW) EventTypeRaw // EventTypeBreakpoint is a breakpoint event (PERF_TYPE_BREAKPOINT) EventTypeBreakpoint // EventTypeDynamicPMU is a dynamic PMU event EventTypeDynamicPMU // EventTypeExternal is an external event EventTypeExternal )
type ExitRecord ¶
ExitRecord is a translation of the structure used by the Linux kernel for PERF_RECORD_EXIT samples into Go.
type ForkRecord ¶
ForkRecord is a translation of the structure used by the Linux kernel for PERF_RECORD_FORK samples into Go.
type LostRecord ¶
LostRecord is a translation of the structure used by the Linux kernel for PERF_RECORD_LOST samples into Go.
type RegisterEventOption ¶
type RegisterEventOption func(*registerEventOptions)
RegisterEventOption is used to implement optional arguments for event registration methods. It must be exported, but it is not typically used directly.
func WithEventAttr ¶
func WithEventAttr(eventAttr *EventAttr) RegisterEventOption
WithEventAttr is used to register the event with an EventAttr struct instead of using the EventMonitor's default.
func WithEventDisabled ¶
func WithEventDisabled() RegisterEventOption
WithEventDisabled is used to register the event in a disabled state.
func WithEventEnabled ¶
func WithEventEnabled() RegisterEventOption
WithEventEnabled is used to register the event in an enabled state.
func WithEventGroup ¶
func WithEventGroup(groupID int32) RegisterEventOption
WithEventGroup is used to register the event to a specific event group.
func WithFilter ¶
func WithFilter(filter string) RegisterEventOption
WithFilter is used to set a filter for the event.
type Sample ¶
type Sample struct { Record interface{} SampleID // contains filtered or unexported fields }
Sample is the representation of a perf_event sample retrieved from the Linux kernel. It includes the header information, a translation of the sample data, and metadata depending on the flags set in the EventAttr used to enable the event that generated the sample.
type SampleDispatchFn ¶
type SampleDispatchFn func([]EventMonitorSample)
SampleDispatchFn is the signature of a function called to dispatch samples. Samples are dispatched in batches as they become available.
type SampleID ¶
SampleID is a translation of the structure used by the Linux kernel for all samples when SampleIDAll is set in the EventAttr used for a sample.
type SampleRecord ¶
type SampleRecord struct { SampleID uint64 IP uint64 Pid uint32 Tid uint32 Time uint64 Addr uint64 ID uint64 StreamID uint64 CPU uint32 Period uint64 V CounterGroup IPs []uint64 RawData []byte Branches []BranchEntry UserABI uint64 UserRegs []uint64 StackData []uint64 Weight uint64 DataSrc uint64 Transaction uint64 IntrABI uint64 IntrRegs []uint64 }
SampleRecord is a translation of the structure used by the Linux kernel for PERF_RECORD_SAMPLE samples into Go.
type TraceEvent ¶
TraceEvent represents the common header on all trace events
type TraceEventDecoderFn ¶
type TraceEventDecoderFn func(*SampleRecord, TraceEventSampleData) (interface{}, error)
TraceEventDecoderFn is the signature of a function to call to decode a sample. The first argument is the sample to be decoded, and the second is the parsed sample data.
type TraceEventSampleData ¶
type TraceEventSampleData map[string]interface{}
TraceEventSampleData is a type alias for map[string]interface{}, which is the representation of sample data parsed from a Linux kernel sample.