Skip to content

DAOS-18857 build: Support of Gperftools Heap Profiler#18068

Merged
daltonbohning merged 10 commits into
masterfrom
ckochhof/dev/master/daos-18857/patch-001
May 18, 2026
Merged

DAOS-18857 build: Support of Gperftools Heap Profiler#18068
daltonbohning merged 10 commits into
masterfrom
ckochhof/dev/master/daos-18857/patch-001

Conversation

@knard38
Copy link
Copy Markdown
Contributor

@knard38 knard38 commented Apr 21, 2026

Description

Adds optional heap profiling support to DAOS by integrating the Gperftools TCMalloc library. A new HEAP_PROFILER SCons build option allows linking DAOS executables (e.g. daos_engine) with libtcmalloc to enable heap profiling.

Changes

Build system (site_scons/): New HEAP_PROFILER=true SCons boolean option that links -ltcmalloc. Enforces mutual exclusion with Google Sanitizers at build time. Strips the flag from unit test environments to avoid corrupted test output.

Packaging (utils/rpms/, utils/scripts/, ci/): Adds gperftools-devel (EL/SUSE) or libgoogle-perftools-dev (Ubuntu) across all supported distros and RPM build definitions. Bumps daos.spec release to 3.

Documentation (docs/dev/development.md): Documents the HEAP_PROFILER build option and the alternative runtime approach via LD_PRELOAD=libtcmalloc.so + HEAPPROFILE env vars (no recompile needed).

Steps for the author:

  • Commit message follows the guidelines.
  • Appropriate Features or Test-tag pragmas were used.
  • Appropriate Functional Test Stages were run.
  • At least two positive code reviews including at least one code owner from each category referenced in the PR.
  • Testing is complete. If necessary, forced-landing label added and a reason added in a comment.

After all prior steps are complete:

  • Gatekeeper requested (daos-gatekeeper added as a reviewer).

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Ticket title is 'Support of Gperftools Heap Profiler'
Status is 'In Review'
https://daosio.atlassian.net/browse/DAOS-18857

@knard38 knard38 force-pushed the ckochhof/dev/master/daos-18857/patch-001 branch from a636a1b to dcfc328 Compare April 23, 2026 12:24
@knard38 knard38 changed the title DAOS-16501 build: Support of Gperftools Heap Profiler DAOS-18857 build: Support of Gperftools Heap Profiler Apr 23, 2026
@knard38 knard38 force-pushed the ckochhof/dev/master/daos-18857/patch-001 branch from dcfc328 to 18fa12e Compare April 23, 2026 12:28
Add a new HEAP_PROFILER SCons boolean option to optionally link DAOS
executables with the TCMalloc memory allocator from Gperftools, enabling
heap profiling of DAOS processes such as daos_engine.

When HEAP_PROFILER=true is set:
- DAOS executables are linked with -ltcmalloc.
- Google Sanitizers cannot be combined with the heap profiler (enforced
  at build time with a fatal error).
- The tcmalloc linker flag is stripped from unit test environments to
  avoid scrambling test output.

The Gperftools library can also be loaded at runtime via LD_PRELOAD
without recompiling, by setting LD_PRELOAD to libtcmalloc.so and the
relevant HEAPPROFILE env vars in daos_server.yml.

Add gperftools as a build dependency across all supported distributions:
- ci/unit/required_packages.sh and utils/scripts/install-*.sh: install
  gperftools-devel (EL/SUSE) or libgoogle-perftools-dev (Ubuntu).
- utils/rpms/package_info.sh: define distro-aware `gperftools_dev`
  variable for use in FPM packaging.
- utils/rpms/daos.sh: add `gperftools_dev` as a build dependency of
  the daos-devel package.
- utils/rpms/daos.spec: retain gperftools-devel BuildRequires (legacy
  spec path) and bump release to 3.
- utils/rpms/daos.changelog: add release 3 entry.

Document the Heap Profiler feature and usage in docs/dev/development.md.

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
@knard38 knard38 force-pushed the ckochhof/dev/master/daos-18857/patch-001 branch from 18fa12e to 7f4e9c4 Compare April 28, 2026 09:01
kanard38 added 8 commits May 4, 2026 06:49
Increment the DAOS release number.

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
Remove gperftools-devel dependency from deprecated rpm spec file.

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
Fix invalid RPM changelog date: 'may' -> 'May'. Lowercase month
abbreviation caused rpmbuild to fail when fpm embedded the changelog
into the generated spec file for all SUSE/Leap 15 packages.

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
@daosbuild3
Copy link
Copy Markdown
Collaborator

@knard38 knard38 marked this pull request as ready for review May 12, 2026 12:41
@knard38 knard38 requested review from a team as code owners May 12, 2026 12:41
@knard38 knard38 self-assigned this May 12, 2026
@knard38 knard38 requested a review from a team May 18, 2026 11:31
@knard38
Copy link
Copy Markdown
Contributor Author

knard38 commented May 18, 2026

@daos-stack/daos-gatekeeper please could you lend this PR with the following messages:

  • title: DAOS-18857 build: Support of Gperftools Heap Profiler
  • body:
Add a new `HEAP_PROFILER=true` SCons build option that links DAOS executables
with `-ltcmalloc` to enable heap profiling via the Gperftools Heap Profiler. The
option is mutually exclusive with Google Sanitizers and is stripped from unit
test environments to avoid corrupted test output.

Add `gperftools-devel` (EL/SUSE) and `libgoogle-perftools-dev` (Ubuntu) as
a build dependency of the `daos-devel` package and to all distro install scripts
so that developers can build with `HEAP_PROFILER=true` without installing extra
packages.

Document both the compile-time (`HEAP_PROFILER=true`) and runtime
(`LD_PRELOAD=libtcmalloc.so`) approaches in the development guide.


if 'SANITIZERS' in env and env['SANITIZERS'] != "":

if "HEAP_PROFILER" in env and env['HEAP_PROFILER']:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this could use get, which returns None by default

Suggested change
if "HEAP_PROFILER" in env and env['HEAP_PROFILER']:
if env.get('HEAP_PROFILER'):

(and similar for the SANITIZERS check above)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to do in a follow-up PR.

@daltonbohning daltonbohning merged commit 0a04d76 into master May 18, 2026
68 checks passed
@daltonbohning daltonbohning deleted the ckochhof/dev/master/daos-18857/patch-001 branch May 18, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants