Documentation ¶
Index ¶
- Constants
- Variables
- type Maps
- func (m *Maps) AddInterpreter(pid int, interpreter runtime.Interpreter) error
- func (m *Maps) AddUnwindTableForProcess(pid int, executableMappings unwind.ExecutableMappings, checkCache bool) error
- func (m *Maps) AdjustMapSizes(debugEnabled bool, unwindTableShards, eventsBufferSize uint32) error
- func (m *Maps) Close() error
- func (m *Maps) Create() error
- func (m *Maps) FinalizeProfileLoop() error
- func (m *Maps) InterpreterSymbolTable() (map[uint32]*profile.Function, error)
- func (m *Maps) PersistUnwindTable() error
- func (m *Maps) ReadStack(stackID uint64, stack []uint64) error
- func (m *Maps) ReadStackCount(keyBytes []byte) (uint64, error)
- func (m *Maps) RefreshProcessInfo(pid int)
- func (m *Maps) ReuseMaps() error
- func (m *Maps) SetDebugPIDs(pids []int) error
- func (m *Maps) SetInterpreterData() error
- func (m *Maps) UpdateTailCallsMap() error
- type ProfilerModuleType
Constants ¶
const ( StackCountsMapName = "stack_counts" StackTracesMapName = "stack_traces" // rbperf maps. RubyPIDToRubyThreadMapName = "pid_to_rb_thread" RubyVersionSpecificOffsetMapName = "version_specific_offsets" // pyperf maps. PythonPIDToInterpreterInfoMapName = "pid_to_interpreter_info" PythonVersionSpecificOffsetMapName = "version_specific_offsets" UnwindInfoChunksMapName = "unwind_info_chunks" UnwindTablesMapName = "unwind_tables" ProcessInfoMapName = "process_info" ProgramsMapName = "programs" PerCPUStatsMapName = "percpu_stats" // With the current compact rows, the max items we can store in the kernels // we have tested is 262k per map, which we rounded it down to 250k. MaxUnwindShards = 50 // How many unwind table shards we have. )
const ( RequestUnwindInformation = 1 << 63 RequestProcessMappings = 1 << 62 RequestRefreshProcInfo = 1 << 61 )
Variables ¶
var ( ErrMissing = errors.New("missing stack trace") ErrUnwindFailed = errors.New("stack ID is 0, probably stack unwinding failed") ErrUnrecoverable = errors.New("unrecoverable error") ErrTooManyExecutableMappings = errors.New("too many executable mappings") ErrNeedMoreProfilingRounds = errors.New("not enough profiling rounds with this unwind info") )
Functions ¶
This section is empty.
Types ¶
type Maps ¶
func New ¶
func New(logger log.Logger, reg prometheus.Registerer, byteOrder binary.ByteOrder, arch elf.Machine, modules map[ProfilerModuleType]*libbpf.Module) (*Maps, error)
func (*Maps) AddInterpreter ¶
func (m *Maps) AddInterpreter(pid int, interpreter runtime.Interpreter) error
AddInterpreter adds the interpreter information to the relevant BPF maps. It is a lookup table for the BPF program to find the interpreter information for corresponding PID. Process information is stored in a separate map and needs to be updated separately.
func (*Maps) AddUnwindTableForProcess ¶
func (m *Maps) AddUnwindTableForProcess(pid int, executableMappings unwind.ExecutableMappings, checkCache bool) error
1. Find executable sections 2. For each section, generate compact table 3. Add table to maps 4. Add map metadata to process
func (*Maps) AdjustMapSizes ¶
AdjustMapSizes updates the amount of unwind shards.
Note: It must be called before `BPFLoadObject()`.
func (*Maps) FinalizeProfileLoop ¶
func (*Maps) InterpreterSymbolTable ¶ added in v0.27.0
PERF: This code presents (at least) presents two possible performance opportunities that we should measure.
- Preallocating the lookup table. - Batch the BPF map calls to read and update them.
func (*Maps) PersistUnwindTable ¶
PersistUnwindTable calls persistUnwindTable but holding the mutex to ensure that shared state is mutated safely.
Never use this function from addUnwindTableForProcess, as it holds this same mutex.
func (*Maps) ReadStack ¶ added in v0.27.0
ReadStack reads the walked stacktrace into the given buffer.
func (*Maps) ReadStackCount ¶
ReadStackCount reads the value of the given key from the counts ebpf map.
func (*Maps) RefreshProcessInfo ¶
RefreshProcessInfo updates the process information such as mappings and unwind information if the executable mappings have changed.
func (*Maps) SetDebugPIDs ¶
func (*Maps) SetInterpreterData ¶
func (*Maps) UpdateTailCallsMap ¶
type ProfilerModuleType ¶
type ProfilerModuleType int
const ( NativeModule ProfilerModuleType = iota RbperfModule PyperfModule )