Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/internal/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Run struct {
// to the workload it's profiling. Above the budget = regression.
// - KernelResolutionRate: fraction of kernel-side samples in
// perf-agent #1's own pprof that resolved to a named symbol
// instead of "0x<hex>". A drop = blazesym + kallsyms fallback
// instead of "0x<hex>". A drop = blazesym kernel symbolization
// broke (the original v1.2.0 lockdown class of bug).
type SelfMetrics struct {
WorkloadPID int `json:"workload_pid"`
Expand Down
Binary file modified cpu/cpu_arm64_bpfel.o
Binary file not shown.
Binary file modified cpu/cpu_x86_bpfel.o
Binary file not shown.
Binary file modified offcpu/offcpu_arm64_bpfel.o
Binary file not shown.
Binary file modified offcpu/offcpu_x86_bpfel.o
Binary file not shown.
6 changes: 2 additions & 4 deletions perfagent/metrics_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ func metricsHandlerFor(getCounters func() symbolize.CountersSnapshot) http.Handl
writeMetricLine(w, "perf_agent_symbolize_kernel_input_ips_total",
"counter", "total kernel IPs handed into SymbolizeKernel", s.KernelInputIPs)
writeMetricLine(w, "perf_agent_symbolize_kernel_batch_failures_total",
"counter", "batches where every symbolizer (blazesym + kallsyms) failed", s.KernelBatchFailures)
writeMetricLine(w, "perf_agent_symbolize_kernel_fallback_engaged",
"gauge", "1 when symbolizer switched to pure-Go kallsyms (lockdown-class hosts)", s.KernelFallbackEngaged)
"counter", "batches where blazesym kernel symbolization failed", s.KernelBatchFailures)
writeMetricLine(w, "perf_agent_symbolize_kernel_raw_addr_frames_total",
"counter", "kernel IPs that fell to raw-hex synthesis (both symbolizers failed)", s.KernelRawAddrFrames)
"counter", "kernel IPs that fell to raw-hex synthesis (blazesym failed)", s.KernelRawAddrFrames)
writeMetricLine(w, "perf_agent_symbolize_kernel_lockdown_eperm_total",
"counter", "BLAZE_ERR_PERMISSION_DENIED events from blazesym (canonical lockdown signature)", s.KernelLockdownEPERM)
writeMetricLine(w, "perf_agent_symbolize_kernel_other_err_total",
Expand Down
15 changes: 6 additions & 9 deletions perfagent/metrics_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import (
// dashboards downstream.
func TestMetricsHandler_PrometheusFormat(t *testing.T) {
snap := symbolize.CountersSnapshot{
KernelBatches: 5,
KernelInputIPs: 42,
KernelBatchFailures: 1,
KernelFallbackEngaged: 1,
KernelRawAddrFrames: 3,
KernelLockdownEPERM: 7,
KernelOtherErr: 2,
KernelBatches: 5,
KernelInputIPs: 42,
KernelBatchFailures: 1,
KernelRawAddrFrames: 3,
KernelLockdownEPERM: 7,
KernelOtherErr: 2,
}
h := metricsHandlerFor(func() symbolize.CountersSnapshot { return snap })

Expand All @@ -44,8 +43,6 @@ func TestMetricsHandler_PrometheusFormat(t *testing.T) {
"# HELP perf_agent_symbolize_kernel_batches_total",
"# TYPE perf_agent_symbolize_kernel_batches_total counter",
"perf_agent_symbolize_kernel_batches_total 5",
"# TYPE perf_agent_symbolize_kernel_fallback_engaged gauge",
"perf_agent_symbolize_kernel_fallback_engaged 1",
"perf_agent_symbolize_kernel_lockdown_eperm_total 7",
"perf_agent_symbolize_kernel_other_err_total 2",
"perf_agent_symbolize_kernel_raw_addr_frames_total 3",
Expand Down
Binary file modified profile/offcpu_dwarf_arm64_bpfel.o
Binary file not shown.
Binary file modified profile/offcpu_dwarf_x86_bpfel.o
Binary file not shown.
Binary file modified profile/perf_arm64_bpfel.o
Binary file not shown.
Binary file modified profile/perf_dwarf_arm64_bpfel.o
Binary file not shown.
Binary file modified profile/perf_dwarf_x86_bpfel.o
Binary file not shown.
Binary file modified profile/perf_x86_bpfel.o
Binary file not shown.
41 changes: 0 additions & 41 deletions symbolize/allocs_budget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,6 @@ import (
"testing"
)

// TestAllocsBudget_ParseKallsymsLine asserts the per-line parser
// remains allocation-free. Catches PRs that accidentally
// reintroduce strings.Fields / strconv.ParseUint or other
// allocating helpers into the hot path (the regression that
// dogfood iter 5 surfaced via mallocgc / sweepone in user-side
// profiles).
//
// Budget: 0 allocs per call. Anything > 0 indicates a regression.
func TestAllocsBudget_ParseKallsymsLine(t *testing.T) {
const budget = 0
line := []byte("ffffffffc0001234 T kvm_vcpu_ioctl [kvm]")
got := testing.AllocsPerRun(1000, func() {
_, _, _, _, _ = parseKallsymsLine(line)
})
if got > float64(budget) {
t.Errorf("parseKallsymsLine allocs/op = %.2f, want <= %d", got, budget)
}
}

// TestAllocsBudget_ResolveKernelIPs caps the per-Resolve-call
// allocation count. The current implementation allocates exactly
// one []Frame slice per call (the return value), so the budget
// is 1. Going above means someone added per-IP allocation —
// likely a [Name string conversion inside the hot loop instead
// of using pre-interned strings.
func TestAllocsBudget_ResolveKernelIPs(t *testing.T) {
const budget = 1
k := &kallsymsSymbolizer{
addrs: []uint64{0xffffffff80001000, 0xffffffff80002000, 0xffffffff80003000},
names: []string{"sym_a", "sym_b", "sym_c"},
modules: []string{"", "", ""},
}
ips := []uint64{0xffffffff80001042, 0xffffffff80002042, 0xffffffff80003042}
got := testing.AllocsPerRun(1000, func() {
_ = k.Resolve(ips)
})
if got > float64(budget) {
t.Errorf("Resolve allocs/op = %.2f, want <= %d", got, budget)
}
}

// TestAllocsBudget_LatencyHistRecord caps the per-Record cost
// of the histogram on the hot path. Record runs under a mutex
// but should never allocate — the ring buffer is fixed-size.
Expand Down
78 changes: 0 additions & 78 deletions symbolize/blazesym_eperm_marker_test.go

This file was deleted.

Loading
Loading