summaryrefslogtreecommitdiff
path: root/src/GNUmakefile
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-05 11:17:58 -0700
committerScott Gasch <[email protected]>2026-10-05 11:17:58 -0700
commit5d9a5cf4036d07252e81d51e78e6dd36e65c9275 (patch)
treef1c80ddb37f32b3a165e11903427efd3e8c60aa8 /src/GNUmakefile
parente5c845d7e0b936641158909dbc516a79958c74e8 (diff)
Document root-free profiling on Linux (gprof) and FreeBSD (pmcstat).
The original PROFILE notes were lost (never committed, per CLAUDE.md's scratch-file guidance). Recovered the FreeBSD pmcstat+gprof workflow from a ZFS snapshot on wannabe.house and verified it live: contrary to the recovered notes' assumption, process-mode sampling (-P) and the gprof conversion pipeline run fine as a non-root user once hwpmc.ko is loaded (only the kldload itself needs root, and it's usually already loaded). On this Linux box, perf is blocked (perf_event_paranoid=4, no CAP_PERFMON) with no non-root workaround, so added a GPROF=1 gmake flag (-pg) and verified the full gprof flat-profile/call-graph pipeline end to end. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/GNUmakefile')
-rw-r--r--src/GNUmakefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index eb7eb2d..14fa65a 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -27,6 +27,11 @@
# compiled either way -- this flag only flips which side of each
# macro-swap wins, it doesn't remove anything.
# EVERYTHING=1: everything everything everything everything
+# GPROF=1: instrument with -pg for gprof(1)-based profiling (see
+# PROFILE.md) -- root-free on both FreeBSD and Linux, unlike
+# hardware-counter-based profiling (pmcstat/perf). Requires a
+# `gmake clean` first/after, since -pg changes codegen for every
+# translation unit.
#
# $Id$
#
@@ -83,6 +88,10 @@ ifdef GENETIC
PROFILE += -DGENETIC
endif
+ifdef GPROF
+ PROFILE += -pg
+endif
+
ifdef DEBUG
PROFILE += -g -DDEBUG
BINARY = _typhoon