Skip to contentSkip to conversation

package/libtraceevent: new package

PATCH Superseded Giulio Benetti 2 participants 5 messages Sep 26, 2023 – Sep 30, 2023

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#2 lore raw

PATCH v2 3/4 package/linux-tools: add rtla

In reply to Giulio Benetti

From: Maxime Chevallier <[email protected]>

The RealTime Linux Analysis tool includes a set of commands that relies on the osnoise and timerlat tracers from the ftrace kernel subsystem, allowing to analyze the lantency sources coming from the hardware and the kernel itself.

This tool was introduced in v5.17, and relies on libtracefs and libtraceevent, although libtraceevent itself is already a dependency for libtracefs.

[Giulio: fix install with recent Linux versions]

---
Giulio:
V1->V2:
* fix install with recent Linux versions

---
 DEVELOPERS                                |  1 +
 package/linux-tools/Config.in             | 10 +++++++
 package/linux-tools/linux-tool-rtla.mk.in | 36 +++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-rtla.mk.in
DEVELOPERS +1 -0
index 835c269461..31bfc67c8a 100644
@@ -2099,6 +2099,7 @@ F:	package/timescaledb/
 N:	Maxime Chevallier <[email protected]>
 F:	package/libtraceevent/
 F:	package/libtracefs
+F:	package/linux-tools/linux-tool-rtla.mk.in
 
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
package/linux-tools/Config.in +10 -0
index 451b0eeff5..63e2796e45 100644
@@ -102,6 +102,16 @@ config BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3
 
 endif
 
+config BR2_PACKAGE_LINUX_TOOLS_RTLA
+	bool "rtla"
+	select BR2_PACKAGE_LINUX_TOOLS
+	select BR2_PACKAGE_LIBTRACEFS
+	help
+	  Linux 5.17 and later has 2 new tracers, osnoise and timerlat.
+	  There tracers allow performing latency analysis, for which
+	  the rtla tool provides wrapper commands to visualize and
+	  extrace latency traces and reports.
+
 config BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
 	bool"selftests"
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
package/linux-tools/linux-tool-rtla.mk.in new file +36 -0
new file mode 100644
index 0000000000..a14571bb1c
@@ -0,0 +1,36 @@
+################################################################################
+#
+# rtla
+#
+################################################################################
+
+LINUX_TOOLS += rtla
+
+RTLA_DEPENDENCIES = host-pkgconf libtracefs
+RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+
+define RTLA_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/tracing/rtla/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not implement the rtla tool." ; \
+		echo "At least kernel 5.17 must be used." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) \
+	$(MAKE) $(RTLA_MAKE_OPTS) \
+	-C $(LINUX_DIR)/tools/tracing rtla
+endef
+
+# make rtla_install build and install by default documentation using rst2man
+# but it's not available in Buildroot and we don't want manual files in target
+# folder so let's simply install the resulting rtla binary and create symlinks
+# like Linux does in its tools/tracing/rtla/Makefile
+define RTLA_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla $(TARGET_DIR)/usr/bin
+	ln -sf rtla $(TARGET_DIR)/usr/bin/osnoise
+	ln -sf rtla $(TARGET_DIR)/usr/bin/hwnoise
+	ln -sf rtla $(TARGET_DIR)/usr/bin/timerlat
+endef
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH v2 4/4 package/trace-cmd: bump to 3.1.7

In reply to Giulio Benetti

From: Maxime Chevallier <[email protected]>

trace-cmd's dependencies 'libtracefs' and 'libtraceevent' were split into dedicated projects, maintained outside of trace-cmd.

This release, on top of bumping the version, adds this new dependencies.

[Giulio: bump to version 3.1.7]

---
Giulio:
V1->V2:
* bump to version 3.1.7

---
 package/trace-cmd/Config.in      | 2 ++
 package/trace-cmd/trace-cmd.hash | 2 +-
 package/trace-cmd/trace-cmd.mk   | 6 ++++--
 3 files changed, 7 insertions(+), 3 deletions(-)
package/trace-cmd/Config.in +2 -0
index 2d0accd7ae..00b9ebbd9a 100644
@@ -4,6 +4,8 @@ config BR2_PACKAGE_TRACE_CMD
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_USE_MMU # fork()
 	depends on !BR2_STATIC_LIBS # dlopen()
+	select BR2_PACKAGE_LIBTRACEEVENT
+	select BR2_PACKAGE_LIBTRACEFS
 	help
 	  Command line reader for ftrace.
 
package/trace-cmd/trace-cmd.hash +1 -1
index 4d39e4d5ea..6edcaf0e1c 100644
@@ -1,5 +1,5 @@
 # Locally computed
-sha256  a74d9ade2633b88d0ad199360d51996427e23f4835594133e456cd6e3bd3a651  trace-cmd-v2.9.7.tar.gz
+sha256  e496d41e599f8ef3c9a74675da05f86be0d8d48d524f0182c73ab98cd16da0b0  trace-cmd-v3.1.7.tar.gz
 sha256  b1d04b850c1c7471b0f0896f6c6f0fcfc9f07e2dd183a5f5826af269fe9e88fb  COPYING
 sha256  70f297763149e72306919c924e164f83041d5e512868d4c8c1826c171b3e49f9  COPYING.LIB
 sha256  f6b78c087c3ebdf0f3c13415070dd480a3f35d8fc76f3d02180a407c1c812f79  LICENSES/GPL-2.0
package/trace-cmd/trace-cmd.mk +4 -2
index 52bb99036c..3d4d88c964 100644
@@ -4,14 +4,14 @@
 #
 ################################################################################
 
-TRACE_CMD_VERSION = 2.9.7
+TRACE_CMD_VERSION = 3.1.7
 TRACE_CMD_SOURCE = trace-cmd-v$(TRACE_CMD_VERSION).tar.gz
 TRACE_CMD_SITE = \
 	https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/snapshot
 TRACE_CMD_LICENSE = GPL-2.0, LGPL-2.1
 TRACE_CMD_LICENSE_FILES = COPYING COPYING.LIB LICENSES/GPL-2.0 LICENSES/LGPL-2.1
 
-TRACE_CMD_DEPENDENCIES = host-pkgconf
+TRACE_CMD_DEPENDENCIES = host-pkgconf libtracefs libtraceevent
 TRACE_CMD_MAKE_OPTS = prefix=/usr etcdir=/etc
 
 ifeq ($(BR2_PACKAGE_AUDIT),y)
@@ -34,6 +34,8 @@ ifeq ($(BR2_sparc64),y)
 TRACE_CMD_CFLAGS += -fPIC
 endif
 
+TRACE_CMD_CFLAGS += $($(HOST_DIR)/bin/pkg-config --cflags libtracefs)
+
 # trace-cmd use CPPFLAGS to add some extra flags.
 # But like for CFLAGS, $(TARGET_CPPFLAGS) contains _LARGEFILE64_SOURCE
 # that causes build problems.
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#0 lore raw

PATCH v2 1/4 package/libtraceevent: new package

From: Maxime Chevallier <[email protected]>

Introduce the libtraceevent library, that used to be bundled with the trace-cmd tool. This library is now used by several tools and libraries such as trace-cmd, libtracefs and rtla.

This package tries to install libraries in /usr/local/lib by default, hence the redefinition of the "prefix" variable, so that the library gets installed in "/usr/lib" instead.

The same applies to the pkgconfig handling of the proved Makefile, which installs the .pc files in the /usr/local area by default, hence the redefinition of the pkgconfig_dir to either the correct directory within the staging area, or to empty value for the target to avoid installing the .pc in that case.

[Giulio: bump version to 1.7.3 and add hash file]

---
Giulio:
V1->V2:
* bump to version 1.7.3
* add hash file

---
 DEVELOPERS                               |  3 +++
 package/Config.in                        |  1 +
 package/libtraceevent/Config.in          |  9 +++++++
 package/libtraceevent/libtraceevent.hash |  4 +++
 package/libtraceevent/libtraceevent.mk   | 33 ++++++++++++++++++++++++
 5 files changed, 50 insertions(+)
 create mode 100644 package/libtraceevent/Config.in
 create mode 100644 package/libtraceevent/libtraceevent.hash
 create mode 100644 package/libtraceevent/libtraceevent.mk
DEVELOPERS +3 -0
index 38973a75dc..306c3cf2be 100644
@@ -2096,6 +2096,9 @@ F:	package/postgresql/
 F:	package/protozero/
 F:	package/timescaledb/
 
+N:	Maxime Chevallier <[email protected]>
+F:	package/libtraceevent/
+
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
package/Config.in +1 -0
index 1e8b6f90c1..cb7afd188e 100644
@@ -117,6 +117,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/kyua/Config.in"
 	source "package/latencytop/Config.in"
 	source "package/libbpf/Config.in"
+	source "package/libtraceevent/Config.in"
 	source "package/lmbench/Config.in"
 	source "package/lsof/Config.in"
 	source "package/ltp-testsuite/Config.in"
package/libtraceevent/Config.in new file +9 -0
new file mode 100644
index 0000000000..d351e3b4de
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTRACEEVENT
+	bool "libtraceevent"
+	help
+	  libtraceevent is a library that interfaces with the ftrace
+	  subsystem in the linux kernel.
+	  It used to be bundled directly in the trace-cmd
+	  tool, but it was eventually extracted so that it can be used
+	  by multiple other tools and libraries, such as libtracefs and
+	  rtla.
package/libtraceevent/libtraceevent.hash new file +4 -0
new file mode 100644
index 0000000000..15c4883afd
@@ -0,0 +1,4 @@
+# Locally computed
+sha256  097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541  libtraceevent-1.7.3.tar.gz
+sha256  f6b78c087c3ebdf0f3c13415070dd480a3f35d8fc76f3d02180a407c1c812f79  GPL-2.0
+sha256  0b9a4febcdee6de55872501d5c1a8f5d8b0d1650cd4d5351995ceb22e889f8ca  LGPL-2.1
package/libtraceevent/libtraceevent.mk new file +33 -0
new file mode 100644
index 0000000000..75c23f7410
@@ -0,0 +1,33 @@
+################################################################################
+#
+# libtraceevent
+#
+################################################################################
+
+LIBTRACEEVENT_VERSION = 1.7.3
+LIBTRACEEVENT_SITE = https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot
+LIBTRACEEVENT_INSTALL_STAGING = YES
+LIBTRACEEVENT_LICENSE = GPL-2.0, LGPL-2.1
+LIBTRACEEVENT_LICENSE_FILES = LICENSES/GPL-2.0 LICENSES/LGPL-2.1
+
+define LIBTRACEEVENT_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
+endef
+
+define LIBTRACEEVENT_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(STAGING_DIR) \
+	pkgconfig_dir="/usr/lib/pkgconfig" \
+	prefix="/usr" \
+	install
+endef
+
+define LIBTRACEEVENT_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	pkgconfig_dir="" \
+	prefix="/usr" \
+	install
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/4 package/libtracefs: new package

From: Maxime Chevallier <[email protected]>

Introduce the libtracefs library, that used to be bundled with the trace-cmd tool. This library is now used by several tools and libraries such as trace-cmd and rtla, and is used as an interface to the ftrace kernel subsystem through tracefs.

This package tries to install libraries in /usr/local/lib by default, hence the redefinition of the "prefix" variable, so that the library gets installed in "/usr/lib" instead.

The same applies to the pkgconfig handling of the proved Makefile, which installs the .pc files in the /usr/local area by default, hence the redefinition of the pkgconfig_dir to either the correct directory within the staging area, or to empty value for the target to avoid installing the .pc in that case.

[Giulio: bump version to 1.7.0 and add hash file]

---
Giulio:
V1->V2:
* bump to version 1.7.0
* add hash file

---
 DEVELOPERS                         |  1 +
 package/Config.in                  |  1 +
 package/libtracefs/Config.in       |  6 +++++
 package/libtracefs/libtracefs.hash |  4 ++++
 package/libtracefs/libtracefs.mk   | 35 ++++++++++++++++++++++++++++++
 5 files changed, 47 insertions(+)
 create mode 100644 package/libtracefs/Config.in
 create mode 100644 package/libtracefs/libtracefs.hash
 create mode 100644 package/libtracefs/libtracefs.mk
DEVELOPERS +1 -0
index 306c3cf2be..835c269461 100644
@@ -2098,6 +2098,7 @@ F:	package/timescaledb/
 
 N:	Maxime Chevallier <[email protected]>
 F:	package/libtraceevent/
+F:	package/libtracefs
 
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
package/Config.in +1 -0
index cb7afd188e..bd30e956bd 100644
@@ -118,6 +118,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/latencytop/Config.in"
 	source "package/libbpf/Config.in"
 	source "package/libtraceevent/Config.in"
+	source "package/libtracefs/Config.in"
 	source "package/lmbench/Config.in"
 	source "package/lsof/Config.in"
 	source "package/ltp-testsuite/Config.in"
package/libtracefs/Config.in new file +6 -0
new file mode 100644
index 0000000000..92ce0986df
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_LIBTRACEFS
+	bool "libtracefs"
+	select BR2_PACKAGE_LIBTRACEEVENT
+	help
+	  libtracefs is used to easily interface with the ftrace
+	  interface through the tracefs virtual filesystem.
package/libtracefs/libtracefs.hash new file +4 -0
new file mode 100644
index 0000000000..676fcf1111
@@ -0,0 +1,4 @@
+# Locally computed
+sha256  411fcbf3434ecbaefa6c2b1bf092266293a672e2d7ee46fdd6b402753cb8bd16  libtracefs-1.7.0.tar.gz
+sha256  f6b78c087c3ebdf0f3c13415070dd480a3f35d8fc76f3d02180a407c1c812f79  GPL-2.0
+sha256  0b9a4febcdee6de55872501d5c1a8f5d8b0d1650cd4d5351995ceb22e889f8ca  LGPL-2.1
package/libtracefs/libtracefs.mk new file +35 -0
new file mode 100644
index 0000000000..0b32b2102a
@@ -0,0 +1,35 @@
+################################################################################
+#
+# libtracefs
+#
+################################################################################
+
+LIBTRACEFS_VERSION = 1.7.0
+LIBTRACEFS_SITE = https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot
+LIBTRACEFS_INSTALL_STAGING = YES
+LIBTRACEFS_LICENSE = GPL-2.0, LGPL-2.1
+LIBTRACEFS_LICENSE_FILES = LICENSES/GPL-2.0 LICENSES/LGPL-2.1
+
+LIBTRACEFS_DEPENDENCIES = host-pkgconf libtraceevent
+
+define LIBTRACEFS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
+endef
+
+define LIBTRACEFS_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(STAGING_DIR) \
+	pkgconfig_dir="/usr/lib/pkgconfig" \
+	prefix="/usr" \
+	install
+endef
+
+define LIBTRACEFS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	pkgconfig_dir="" \
+	prefix="/usr" \
+	install
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 3/4] package/linux-tools: add rtla

In reply to Giulio Benetti

Giulio, All,

On 2023-09-26 11:11 +0200, Giulio Benetti spake thusly:

Quoted 7 lines

From: Maxime Chevallier <[email protected]>

The RealTime Linux Analysis tool includes a set of commands that relies on the osnoise and timerlat tracers from the ftrace kernel subsystem, allowing to analyze the lantency sources coming from the hardware and the kernel itself.

Quoted 8 lines

This tool was introduced in v5.17, and relies on libtracefs and libtraceevent, although libtraceevent itself is already a dependency for libtracefs.

[Giulio: fix install with recent Linux versions]

---

[--SNIP--]

Quoted 7 lines
package/linux-tools/Config.in +0 -0
index 451b0eeff5..63e2796e45 100644
@@ -102,6 +102,16 @@ config BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3
 
 endif

package/linux-tools/Config.in config BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3 · line 113

Quoted 10 lines
package/linux-tools/Config.in +9 -0
 
+config BR2_PACKAGE_LINUX_TOOLS_RTLA
+	bool "rtla"
+	select BR2_PACKAGE_LINUX_TOOLS
+	select BR2_PACKAGE_LIBTRACEFS
+	help
+	  Linux 5.17 and later has 2 new tracers, osnoise and timerlat.
+	  There tracers allow performing latency analysis, for which
+	  the rtla tool provides wrapper commands to visualize and
+	  extrace latency traces and reports.

I was a bit puzzled why you mentionned two tracers here, but [...]

[--SNIP--]

package/linux-tools/linux-tool-rtla.mk.in

Quoted 6 lines
package/linux-tools/linux-tool-rtla.mk.in new file +0 -0
new file mode 100644
index 0000000000..a14571bb1c
@@ -0,0 +1,36 @@

[--SNIP--]

package/linux-tools/linux-tool-rtla.mk.in line 35

Quoted 9 lines
package/linux-tools/linux-tool-rtla.mk.in new file +9 -0
+# make rtla_install build and install by default documentation using rst2man
+# but it's not available in Buildroot and we don't want manual files in target
+# folder so let's simply install the resulting rtla binary and create symlinks
+# like Linux does in its tools/tracing/rtla/Makefile
+define RTLA_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla $(TARGET_DIR)/usr/bin
+	ln -sf rtla $(TARGET_DIR)/usr/bin/osnoise
+	ln -sf rtla $(TARGET_DIR)/usr/bin/hwnoise
+	ln -sf rtla $(TARGET_DIR)/usr/bin/timerlat

[...] here you install three symlinks, with hwnoise not mentioned in the help text above.

In fact,v5.1 indtroduced osnoise and timerlat. hwnoise only arrived in 6.3, with commit 1f428356c38d (rtla: Add hwnoise tool).

So you cna't install the hwnoise symlink unconditionally.

Can you try to finda solution to that, please?

Maybe grep in Makefile to see what to install?

Regards,
Yann E. MORIN.

Quoted 8 lines
package/linux-tools/linux-tool-rtla.mk.in new file +1 -0
+endef
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot