Documentation ¶
Index ¶
- Constants
- Variables
- func ResolvePerfBits(bitstr string) (uint64, error)
- func ResolvePerfConfig(configstr string) (uint64, error)
- func ResolvePerfFlag(flagstr string) (uint64, error)
- func ResolvePerfReadFormat(formatstr string) (uint64, error)
- func ResolvePerfType(typestr string) (uint64, error)
- type CpuEvents
- type EventConfig
- type EventKey
- type PerfCollector
- type PerfEvent
- type PerfEventConf
- type PerfEventGroup
- type PreValue
- type ProfileResultSet
- type ProfileValue
- type Profiler
- type ReadableProfiler
- func (p *ReadableProfiler) AddEvent(config EventConfig) error
- func (p *ReadableProfiler) Close() error
- func (p *ReadableProfiler) HasEvent() bool
- func (p *ReadableProfiler) Read(result *ReadableResultSet) error
- func (p *ReadableProfiler) Reset() error
- func (p *ReadableProfiler) Start() error
- func (p *ReadableProfiler) Stop() error
- type ReadableResultSet
Constants ¶
View Source
const ( DefaultPerfReadFormat = unix.PERF_FORMAT_TOTAL_TIME_RUNNING | unix.PERF_FORMAT_TOTAL_TIME_ENABLED | unix.PERF_FORMAT_GROUP | unix.PERF_FORMAT_ID DefaultPerfBits = unix.PerfBitDisabled )
View Source
const (
// PERF_SAMPLE_IDENTIFIER is not defined in x/sys/unix.
PERF_SAMPLE_IDENTIFIER = 1 << 16
)
Variables ¶
View Source
var PerfBitMap = map[string]uint64{ "PerfBitDisabled": unix.PerfBitDisabled, "PerfBitInherit": unix.PerfBitInherit, "PerfBitPinned": unix.PerfBitPinned, "PerfBitExclusive": unix.PerfBitExclusive, "PerfBitExcludeUser": unix.PerfBitExcludeUser, "PerfBitExcludeKernel": unix.PerfBitExcludeKernel, "PerfBitExcludeHv": unix.PerfBitExcludeHv, "PerfBitExcludeIdle": unix.PerfBitExcludeIdle, "PerfBitMmap": unix.PerfBitMmap, "PerfBitComm": unix.PerfBitComm, "PerfBitFreq": unix.PerfBitFreq, "PerfBitInheritStat": unix.PerfBitInheritStat, "PerfBitEnableOnExec": unix.PerfBitEnableOnExec, "PerfBitTask": unix.PerfBitTask, "PerfBitWatermark": unix.PerfBitWatermark, "PerfBitPreciseIPBit1": unix.PerfBitPreciseIPBit1, "PerfBitPreciseIPBit2": unix.PerfBitPreciseIPBit2, "PerfBitMmapData": unix.PerfBitMmapData, "PerfBitSampleIDAll": unix.PerfBitSampleIDAll, "PerfBitExcludeHost": unix.PerfBitExcludeHost, "PerfBitExcludeGuest": unix.PerfBitExcludeGuest, "PerfBitExcludeCallchainKernel": unix.PerfBitExcludeCallchainKernel, "PerfBitExcludeCallchainUser": unix.PerfBitExcludeCallchainUser, "PerfBitMmap2": unix.PerfBitMmap2, "PerfBitCommExec": unix.PerfBitCommExec, "PerfBitUseClockID": unix.PerfBitUseClockID, "PerfBitContextSwitch": unix.PerfBitContextSwitch, }
View Source
var PerfConfigMap = map[string]uint64{ "PERF_COUNT_HW_CPU_CYCLES": unix.PERF_COUNT_HW_CPU_CYCLES, "PERF_COUNT_HW_INSTRUCTIONS": unix.PERF_COUNT_HW_INSTRUCTIONS, "PERF_COUNT_HW_CACHE_REFERENCES": unix.PERF_COUNT_HW_CACHE_REFERENCES, "PERF_COUNT_HW_CACHE_MISSES": unix.PERF_COUNT_HW_CACHE_MISSES, "PERF_COUNT_HW_BRANCH_INSTRUCTIONS": unix.PERF_COUNT_HW_BRANCH_INSTRUCTIONS, "PERF_COUNT_HW_BRANCH_MISSES": unix.PERF_COUNT_HW_BRANCH_MISSES, "PERF_COUNT_HW_BUS_CYCLES": unix.PERF_COUNT_HW_BUS_CYCLES, "PERF_COUNT_HW_STALLED_CYCLES_FRONTEND": unix.PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, "PERF_COUNT_HW_STALLED_CYCLES_BACKEND": unix.PERF_COUNT_HW_STALLED_CYCLES_BACKEND, "PERF_COUNT_HW_REF_CPU_CYCLES": unix.PERF_COUNT_HW_REF_CPU_CYCLES, "PERF_COUNT_HW_MAX": unix.PERF_COUNT_HW_MAX, "PERF_COUNT_HW_CACHE_L1D": unix.PERF_COUNT_HW_CACHE_L1D, "PERF_COUNT_HW_CACHE_L1I": unix.PERF_COUNT_HW_CACHE_L1I, "PERF_COUNT_HW_CACHE_LL": unix.PERF_COUNT_HW_CACHE_LL, "PERF_COUNT_HW_CACHE_DTLB": unix.PERF_COUNT_HW_CACHE_DTLB, "PERF_COUNT_HW_CACHE_ITLB": unix.PERF_COUNT_HW_CACHE_ITLB, "PERF_COUNT_HW_CACHE_BPU": unix.PERF_COUNT_HW_CACHE_BPU, "PERF_COUNT_HW_CACHE_NODE": unix.PERF_COUNT_HW_CACHE_NODE, "PERF_COUNT_HW_CACHE_MAX": unix.PERF_COUNT_HW_CACHE_MAX, "PERF_COUNT_HW_CACHE_OP_READ": unix.PERF_COUNT_HW_CACHE_OP_READ, "PERF_COUNT_HW_CACHE_OP_WRITE": unix.PERF_COUNT_HW_CACHE_OP_WRITE, "PERF_COUNT_HW_CACHE_OP_PREFETCH": unix.PERF_COUNT_HW_CACHE_OP_PREFETCH, "PERF_COUNT_HW_CACHE_OP_MAX": unix.PERF_COUNT_HW_CACHE_OP_MAX, "PERF_COUNT_HW_CACHE_RESULT_ACCESS": unix.PERF_COUNT_HW_CACHE_RESULT_ACCESS, "PERF_COUNT_HW_CACHE_RESULT_MISS": unix.PERF_COUNT_HW_CACHE_RESULT_MISS, "PERF_COUNT_HW_CACHE_RESULT_MAX": unix.PERF_COUNT_HW_CACHE_RESULT_MAX, "PERF_COUNT_SW_CPU_CLOCK": unix.PERF_COUNT_SW_CPU_CLOCK, "PERF_COUNT_SW_TASK_CLOCK": unix.PERF_COUNT_SW_TASK_CLOCK, "PERF_COUNT_SW_PAGE_FAULTS": unix.PERF_COUNT_SW_PAGE_FAULTS, "PERF_COUNT_SW_CONTEXT_SWITCHES": unix.PERF_COUNT_SW_CONTEXT_SWITCHES, "PERF_COUNT_SW_CPU_MIGRATIONS": unix.PERF_COUNT_SW_CPU_MIGRATIONS, "PERF_COUNT_SW_PAGE_FAULTS_MIN": unix.PERF_COUNT_SW_PAGE_FAULTS_MIN, "PERF_COUNT_SW_PAGE_FAULTS_MAJ": unix.PERF_COUNT_SW_PAGE_FAULTS_MAJ, "PERF_COUNT_SW_ALIGNMENT_FAULTS": unix.PERF_COUNT_SW_ALIGNMENT_FAULTS, "PERF_COUNT_SW_EMULATION_FAULTS": unix.PERF_COUNT_SW_EMULATION_FAULTS, "PERF_COUNT_SW_DUMMY": unix.PERF_COUNT_SW_DUMMY, "PERF_COUNT_SW_BPF_OUTPUT": unix.PERF_COUNT_SW_BPF_OUTPUT, "PERF_COUNT_SW_MAX": unix.PERF_COUNT_SW_MAX, }
View Source
var PerfFlagMap = map[string]uint64{ "PERF_FLAG_FD_CLOEXEC": unix.PERF_FLAG_FD_CLOEXEC, "PERF_FLAG_FD_NO_GROUP": unix.PERF_FLAG_FD_NO_GROUP, "PERF_FLAG_FD_OUTPUT": unix.PERF_FLAG_FD_OUTPUT, "PERF_FLAG_PID_CGROUP": unix.PERF_FLAG_PID_CGROUP, }
View Source
var PerfReadFormatMap = map[string]uint64{ "PERF_FORMAT_TOTAL_TIME_ENABLED": unix.PERF_FORMAT_TOTAL_TIME_ENABLED, "PERF_FORMAT_TOTAL_TIME_RUNNING": unix.PERF_FORMAT_TOTAL_TIME_RUNNING, "PERF_FORMAT_ID": unix.PERF_FORMAT_ID, "PERF_FORMAT_GROUP": unix.PERF_FORMAT_GROUP, }
View Source
var PerfTypeMap = map[string]uint64{ "PERF_TYPE_HARDWARE": unix.PERF_TYPE_HARDWARE, "PERF_TYPE_SOFTWARE": unix.PERF_TYPE_SOFTWARE, "PERF_TYPE_TRACEPOINT": unix.PERF_TYPE_TRACEPOINT, "PERF_TYPE_HW_CACHE": unix.PERF_TYPE_HW_CACHE, "PERF_TYPE_RAW": unix.PERF_TYPE_RAW, "PERF_TYPE_BREAKPOINT": unix.PERF_TYPE_BREAKPOINT, }
Functions ¶
func ResolvePerfBits ¶
func ResolvePerfConfig ¶
func ResolvePerfFlag ¶
func ResolvePerfReadFormat ¶
func ResolvePerfType ¶
Types ¶
type CpuEvents ¶
type CpuEvents struct { CpuModel string `yaml:"cpu_model"` EventGroups []PerfEventGroup `yaml:"event_groups"` }
type EventConfig ¶
type PerfCollector ¶
type PerfCollector struct {
// contains filtered or unexported fields
}
func (*PerfCollector) Collect ¶
func (c *PerfCollector) Collect(out map[string]interface{}) error
Collect collect metric
func (*PerfCollector) Stop ¶
func (c *PerfCollector) Stop() error
type PerfEventConf ¶
type PerfEventConf struct {
CpuEvents []CpuEvents `yaml:"cpu_events"`
}
type PerfEventGroup ¶
type ProfileResultSet ¶
type ProfileResultSet struct { Num uint64 TimeEnabled uint64 TimeRunning uint64 Values []ProfileValue }
type ProfileValue ¶
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
func NewProfiler ¶
func NewProfiler() *Profiler
func (*Profiler) Read ¶
func (p *Profiler) Read(val *ProfileResultSet) error
Profile returns the current Profile.
type ReadableProfiler ¶
func NewReadableProfiler ¶
func NewReadableProfiler(name string, cpuid int) *ReadableProfiler
func (*ReadableProfiler) AddEvent ¶
func (p *ReadableProfiler) AddEvent(config EventConfig) error
func (*ReadableProfiler) Close ¶
func (p *ReadableProfiler) Close() error
func (*ReadableProfiler) HasEvent ¶
func (p *ReadableProfiler) HasEvent() bool
func (*ReadableProfiler) Read ¶
func (p *ReadableProfiler) Read(result *ReadableResultSet) error
func (*ReadableProfiler) Reset ¶
func (p *ReadableProfiler) Reset() error
func (*ReadableProfiler) Start ¶
func (p *ReadableProfiler) Start() error
func (*ReadableProfiler) Stop ¶
func (p *ReadableProfiler) Stop() error
Click to show internal directories.
Click to hide internal directories.