Profiling and Performance Monitoring¶
This document describes how to set up and use the profiling tools available in the suckless-ogl project.
Profiling with perf¶
The make perf target uses the Linux perf tool to record and report performance data. Since the build environment often runs inside a container (like Distrobox), certain kernel security settings on the host must be adjusted.
Resolving Access Permissions¶
If you encounter an error like Access to performance monitoring and observability operations is limited, you need to adjust the perf_event_paranoid setting.
1. Temporary Fix (Immediate)¶
Run this command on your host machine:
2. Permanent Fix (Survives Reboot)¶
Add the setting to a sysctl configuration file:
Advanced Profiling Settings¶
Kernel Pointer Access¶
To see kernel symbols in your profiles (useful for identifying overhead in drivers or syscalls):
Usage¶
-
Build and Record:
This will build the project with profiling symbols (RelWithDebInfo), runperf record, and then automatically openperf report. -
View Report Manually: If you want to view an existing
perf.datafile:
Other Tools¶
- Apitrace: Use
make apitraceto capture OpenGL calls andmake qapitraceto inspect them. - Valgrind (Primary): Use
make memcheckto run a deep analysis for leaks and uninitialized memory. Recommended for thorough verification. - AddressSanitizer (ASan): Use
make asanto build with memory instrumentation andmake memcheck-asanto run. Much faster, ideal for runtime error hunting.