All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/heaptrack: new package
@ 2026-07-31 17:25 Luca Ceresoli via buildroot
  2026-07-31 18:59 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Ceresoli via buildroot @ 2026-07-31 17:25 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Luca Ceresoli

Add heaptrack, a memory allocation tracer toolkit.

This implementation builds all the command line components, not the
heaptrack_gui graphical visualization program.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 package/Config.in                |  1 +
 package/heaptrack/Config.in      | 26 ++++++++++++++++++++++++++
 package/heaptrack/heaptrack.hash |  1 +
 package/heaptrack/heaptrack.mk   | 25 +++++++++++++++++++++++++
 4 files changed, 53 insertions(+)

diff --git a/package/Config.in b/package/Config.in
index fc1e57d30dd7..7caf56e6de6f 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -106,6 +106,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/fwts/Config.in"
 	source "package/gdb/Config.in"
 	source "package/google-breakpad/Config.in"
+	source "package/heaptrack/Config.in"
 	source "package/hyperfine/Config.in"
 	source "package/iozone/Config.in"
 	source "package/k3conf/Config.in"
diff --git a/package/heaptrack/Config.in b/package/heaptrack/Config.in
new file mode 100644
index 000000000000..ea54195c9318
--- /dev/null
+++ b/package/heaptrack/Config.in
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_HEAPTRACK
+	bool "heaptrack"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_LINUX_KERNEL
+	select BR2_PACKAGE_BOOST
+	select BR2_PACKAGE_BOOST_IOSTREAMS
+	select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS
+	# For heaptrack_print
+	select BR2_PACKAGE_BOOST_FILESYSTEM
+	select BR2_PACKAGE_LIBUNWIND
+	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_ELFUTILS
+	help
+	  Heaptrack traces all memory allocations and annotates these
+	  events with stack traces. Dedicated analysis tools then allow
+	  you to interpret the heap memory profile to find hotspots,
+	  memory leaks, allocation hotspots and temporary allocations.
+
+	  Zstandard offers better (de)compression performance compared
+	  with gzip/zlib, making heaptrack faster and datafiles smaller,
+	  so enabling BR2_PACKAGE_ZSTD is recommended.
+
+	  https://apps.kde.org/heaptrack/
+
+comment "heaptrack needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/heaptrack/heaptrack.hash b/package/heaptrack/heaptrack.hash
new file mode 100644
index 000000000000..d9eb6010ac18
--- /dev/null
+++ b/package/heaptrack/heaptrack.hash
@@ -0,0 +1 @@
+sha256  e69de2209ab0e16c8e26c1b60feeb852b3a88e46a4f16588c08254e1bd81a183  heaptrack-3e6cce3d210a6672fe6f92de0bed567c49b7a9c5-git4.tar.gz
diff --git a/package/heaptrack/heaptrack.mk b/package/heaptrack/heaptrack.mk
new file mode 100644
index 000000000000..6349e7aeb04d
--- /dev/null
+++ b/package/heaptrack/heaptrack.mk
@@ -0,0 +1,25 @@
+################################################################################
+#
+# heaptrack
+#
+################################################################################
+
+HEAPTRACK_SITE_METHOD = git
+HEAPTRACK_SITE = https://invent.kde.org/sdk/heaptrack.git
+HEAPTRACK_VERSION = 3e6cce3d210a6672fe6f92de0bed567c49b7a9c5
+HEAPTRACK_LICENSE = LGPL-2.1-or-later, GPL-2.0-or-later (heaptrack_interpret)
+HEAPTRACK_LICENSE_FILES = LICENSES/LGPL-2.1-only.txt \
+			  LICENSES/GPL-2.0-or-later.txt \
+			  LICENSES/LGPL-2.1-or-later.txt \
+			  LICENSES/BSL-1.0.txt \
+			  LICENSES/MIT.txt \
+			  LICENSES/Apache-2.0.txt \
+			  LICENSES/BSD-3-Clause.txt
+HEAPTRACK_DEPENDENCIES = host-pkgconf linux boost libunwind zlib elfutils
+HEAPTRACK_CONF_OPTS += -DHEAPTRACK_BUILD_GUI=OFF -DHEAPTRACK_BUILD_PRINT=ON
+
+ifeq ($(BR2_PACKAGE_ZSTD),y)
+HEAPTRACK_DEPENDENCIES += zstd
+endif
+
+$(eval $(cmake-package))

---
base-commit: 9bc585a804b2ce7b5f82f538f6108cca27c3116a
change-id: 20260731-heaptrack-cd4f6f8fcec8

Best regards,
--  
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH] package/heaptrack: new package
  2026-07-31 17:25 [Buildroot] [PATCH] package/heaptrack: new package Luca Ceresoli via buildroot
@ 2026-07-31 18:59 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-07-31 18:59 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: buildroot

Hello,

On Fri, Jul 31, 2026 at 07:25:35PM +0200, Luca Ceresoli wrote:

> diff --git a/package/heaptrack/Config.in b/package/heaptrack/Config.in
> new file mode 100644
> index 000000000000..ea54195c9318
> --- /dev/null
> +++ b/package/heaptrack/Config.in
> @@ -0,0 +1,26 @@
> +config BR2_PACKAGE_HEAPTRACK
> +	bool "heaptrack"
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_LINUX_KERNEL

You also need to replicate the "depends on" the things you select, so:

	depends on BR2_TOOLCHAIN_HAS_THREADS # boost, libunwind, elfutils
	depends on BR2_USE_WCHAR # boost, elfutils
	depends on BR2_PACKAGE_LIBUNWIND_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libunwind
	depends on !BR2_STATIC_LIBS # libunwind, elfutils

Also, I'm curious about the BR2_LINUX_KERNEL dependency. heaptrack
builds its own kernel modules?

> +	select BR2_PACKAGE_BOOST
> +	select BR2_PACKAGE_BOOST_IOSTREAMS
> +	select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS
> +	# For heaptrack_print
> +	select BR2_PACKAGE_BOOST_FILESYSTEM
> +	select BR2_PACKAGE_LIBUNWIND
> +	select BR2_PACKAGE_ZLIB
> +	select BR2_PACKAGE_ELFUTILS

Also, these selects should be sorted alphabetically.

> +	help
> +	  Heaptrack traces all memory allocations and annotates these
> +	  events with stack traces. Dedicated analysis tools then allow
> +	  you to interpret the heap memory profile to find hotspots,
> +	  memory leaks, allocation hotspots and temporary allocations.
> +
> +	  Zstandard offers better (de)compression performance compared
> +	  with gzip/zlib, making heaptrack faster and datafiles smaller,
> +	  so enabling BR2_PACKAGE_ZSTD is recommended.
> +
> +	  https://apps.kde.org/heaptrack/
> +
> +comment "heaptrack needs a toolchain w/ C++"
> +	depends on !BR2_INSTALL_LIBSTDCPP

This needs to be updated with the dependencies above.

> diff --git a/package/heaptrack/heaptrack.hash b/package/heaptrack/heaptrack.hash
> new file mode 100644
> index 000000000000..d9eb6010ac18
> --- /dev/null
> +++ b/package/heaptrack/heaptrack.hash
> @@ -0,0 +1 @@
> +sha256  e69de2209ab0e16c8e26c1b60feeb852b3a88e46a4f16588c08254e1bd81a183  heaptrack-3e6cce3d210a6672fe6f92de0bed567c49b7a9c5-git4.tar.gz

Add comment indicating the provenance of this hash.

Add the hashes of the license files.

> diff --git a/package/heaptrack/heaptrack.mk b/package/heaptrack/heaptrack.mk
> new file mode 100644
> index 000000000000..6349e7aeb04d
> --- /dev/null
> +++ b/package/heaptrack/heaptrack.mk
> @@ -0,0 +1,25 @@
> +################################################################################
> +#
> +# heaptrack
> +#
> +################################################################################
> +
> +HEAPTRACK_SITE_METHOD = git
> +HEAPTRACK_SITE = https://invent.kde.org/sdk/heaptrack.git
> +HEAPTRACK_VERSION = 3e6cce3d210a6672fe6f92de0bed567c49b7a9c5
> +HEAPTRACK_LICENSE = LGPL-2.1-or-later, GPL-2.0-or-later (heaptrack_interpret)
> +HEAPTRACK_LICENSE_FILES = LICENSES/LGPL-2.1-only.txt \
> +			  LICENSES/GPL-2.0-or-later.txt \
> +			  LICENSES/LGPL-2.1-or-later.txt \
> +			  LICENSES/BSL-1.0.txt \
> +			  LICENSES/MIT.txt \
> +			  LICENSES/Apache-2.0.txt \
> +			  LICENSES/BSD-3-Clause.txt

One tab indentation for follow-up lines is enough.

> +HEAPTRACK_DEPENDENCIES = host-pkgconf linux boost libunwind zlib elfutils
> +HEAPTRACK_CONF_OPTS += -DHEAPTRACK_BUILD_GUI=OFF -DHEAPTRACK_BUILD_PRINT=ON
> +
> +ifeq ($(BR2_PACKAGE_ZSTD),y)
> +HEAPTRACK_DEPENDENCIES += zstd
> +endif
> +
> +$(eval $(cmake-package))
> 
> ---
> base-commit: 9bc585a804b2ce7b5f82f538f6108cca27c3116a
> change-id: 20260731-heaptrack-cd4f6f8fcec8

Would it be difficult to add a test case in support/testing/?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-31 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 17:25 [Buildroot] [PATCH] package/heaptrack: new package Luca Ceresoli via buildroot
2026-07-31 18:59 ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.