Files
irozzo-1A b511b54d21 chore(build): add support for gperftools CPU profiler
Add comprehensive support for gperftools CPU profiler to enable performance
profiling of Falco. This commit introduces:

- New CMake options:
  * USE_GPERFTOOLS: Enable gperftools CPU profiler support (default: OFF)
  * USE_FRAME_POINTER: Enable frame pointers for accurate profiling (default: OFF)

- Automatic frame pointer enabling: When USE_GPERFTOOLS is enabled, frame
  pointers are automatically enabled to ensure accurate stack traces in
  profiling output.

- Support for both system and bundled gperftools:
  * System gperftools: Automatically detected via find_path/find_library
  * Bundled gperftools: Built from source (version 2.15) when
    USE_BUNDLED_GPERFTOOLS is enabled

- Enhanced stack trace support: Automatically detects and enables libunwind
  when available for better stack traces, falling back to frame pointers
  otherwise.

- Proper library linking: Uses --whole-archive linker flags to ensure
  profiler initialization code is linked even when ProfilerStart() is not
  called directly, enabling CPUPROFILE environment variable support.

- Compile-time detection: Adds HAS_GPERFTOOLS preprocessor definition
  for conditional compilation.

The profiler can be activated at runtime by setting the CPUPROFILE
environment variable to a file path where profiling data should be written.

Usage:
  cmake -DUSE_GPERFTOOLS=ON ..
  make
  CPUPROFILE=/tmp/falco.prof ./falco

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-02-12 11:32:11 +01:00
..
2026-02-05 13:15:54 +01:00