Wire up Go's standard profiling toolkit so it's automatically available in dev builds and completely absent from production. The profiling package uses build tags (dev/!dev) to eliminate all pprof, trace, and timing code from release binaries with zero new dependencies. - backend/profiling: pprof HTTP server on :6060, /debug/trace endpoint, block/mutex profiling, and TimeOp helper for structured operation timing - scripts/profile.sh: interactive menu-driven script that auto-selects free ports (8080-8089) so multiple profiles can be open simultaneously - Instrumented key operations: app init, database init, player load/restore, queue set/restore - Makefile targets: profile, profile-cpu, profile-heap, profile-trace - .gitignore: exclude trace-*.out and *.pprof artifacts
14 lines
233 B
Go
14 lines
233 B
Go
//go:build !dev
|
|
|
|
package profiling
|
|
|
|
import "log/slog"
|
|
|
|
func noop() {}
|
|
|
|
// TimeOp is a no-op in production builds. The compiler will inline
|
|
// and eliminate this entirely.
|
|
func TimeOp(_ *slog.Logger, _ string) func() {
|
|
return noop
|
|
}
|