Skip to contentSkip to conversation

package/uftrace: new package

PATCH Superseded Asaf Kahlon 3 participants 5 messages Apr 3, 2021 – Apr 8, 2021

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/uftrace: new package

The uftrace tool is to trace and analyze execution of a program written in C/C++. It was heavily inspired by the ftrace framework of the Linux kernel (especially function graph tracer) and supports userspace programs. It supports various kind of commands and filters to help analysis of the program execution and performance.

---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/busybox/busybox.     |  0
 package/uftrace/Config.in    | 12 ++++++++++++
 package/uftrace/uftrace.hash |  3 +++
 package/uftrace/uftrace.mk   | 26 ++++++++++++++++++++++++++
 6 files changed, 43 insertions(+)
 create mode 100644 package/busybox/busybox.
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +1 -0
index c6d4f1919f..33607f8b30 100644
@@ -240,6 +240,7 @@ F:	package/python*
 F:	package/snmpclitools/
 F:	package/spdlog/
 F:	package/uftp/
+F:	package/uftrace/
 F:	package/uvw/
 F:	package/zeromq/
 
package/Config.in +1 -0
index 1269bc7b51..cd5cd17576 100644
@@ -144,6 +144,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/trace-cmd/Config.in"
 	source "package/trinity/Config.in"
 	source "package/uclibc-ng-test/Config.in"
+	source "package/uftrace/Config.in"
 	source "package/valgrind/Config.in"
 	source "package/vmtouch/Config.in"
 	source "package/whetstone/Config.in"
package/busybox/busybox. new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
package/uftrace/Config.in new file +12 -0
new file mode 100644
index 0000000000..ca3041195e
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_arm || BR2_aarch64 || BR2_x86_64
+	help
+	  The uftrace tool is to trace and analyze execution of a
+	  program written in C/C++. It was heavily inspired by the
+	  ftrace framework of the Linux kernel (especially function
+	  graph tracer) and supports userspace programs.
+	  It supports various kind of commands and filters to help
+	  analysis of the program execution and performance.
+
+	  https://github.com/namhyung/uftrace
package/uftrace/uftrace.hash new file +3 -0
new file mode 100644
index 0000000000..be0464d8e9
@@ -0,0 +1,3 @@
+# Locally computed
+sha256	418d30c959d3b6d0dcafd55e588a5d414a9984b30f2522a5af004a268824a5a2  v0.9.4.tar.gz
+sha256	8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/uftrace/uftrace.mk new file +26 -0
new file mode 100644
index 0000000000..b696ac4c6e
@@ -0,0 +1,26 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = 0.9.4
+UFTRACE_SITE = https://github.com/namhyung/uftrace/archive/refs/tags
+UFTRACE_SOURCE = v0.9.4.tar.gz
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) ARCH=$(BR2_ARCH) $(MAKE) -C $(@D) $(UFTRACE_MAKE_OPTS)
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) \
+		$(UFTRACE_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 package/uftrace: new package

Asaf, All,

On 2021-04-03 22:16 +0300, Asaf Kahlon spake thusly:

Quoted 6 lines

The uftrace tool is to trace and analyze execution of a program written in C/C++. It was heavily inspired by the ftrace framework of the Linux kernel (especially function graph tracer) and supports userspace programs. It supports various kind of commands and filters to help analysis of the program execution and performance.

Rather than duplicate the package description in the commit log, I think it makes more sense that it contains explanations about the packaging in Buildroot. See below.

Quoted 5 lines
---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/busybox/busybox.     |  0

Uh? ;-)

[--SNIP--]

package/uftrace/Config.in line 3

Quoted 9 lines
package/uftrace/Config.in new file +3 -0
new file mode 100644
index 0000000000..ca3041195e
@@ -0,0 +1,12 @@ 
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_arm || BR2_aarch64 || BR2_x86_64

AFAICS, it also support i386...

Even though the architecture dependencies are pretty trivial today, I think it would be good to introduce a _ARCH_SUPPORTS symbol:

config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
bool
default y if BR2_arm
default y if BR2_aarch64
default y if BR2_i386
default y if BR2_x86_64

config BR2_PACKAGE_UFTRACE
bool "uftrace"
depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS

[--SNIP--]

Quoted 6 lines
package/uftrace/uftrace.mk new file +0 -0
new file mode 100644
index 0000000000..b696ac4c6e

package/uftrace/uftrace.mk line 8

Quoted 8 lines
package/uftrace/uftrace.mk new file +8 -0
@@ -0,0 +1,26 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = 0.9.4
+UFTRACE_SITE = https://github.com/namhyung/uftrace/archive/refs/tags

Please use the github macro; see e.g. boot/shim/shim.mk and the manual:
https://buildroot.org/downloads/manual/manual.html#github-download-url

package/uftrace/uftrace.mk line 9

Quoted 1 line
package/uftrace/uftrace.mk new file +1 -0
+UFTRACE_SOURCE = v0.9.4.tar.gz

No need to specify _SOURCE when using the github macro.

package/uftrace/uftrace.mk line 18

Quoted 9 lines
package/uftrace/uftrace.mk new file +9 -0
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) ARCH=$(BR2_ARCH) $(MAKE) -C $(@D) $(UFTRACE_MAKE_OPTS)

You are not setting UFTRACE_MAKE_OPTS anywhere that I can see...

package/uftrace/uftrace.mk line 26

Quoted 8 lines
package/uftrace/uftrace.mk new file +7 -0
+endef
 
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) \
+		$(UFTRACE_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))

There is a ./configure script (but it is not autotools, so this truly is a generic-package indeed): any reason why you are not using it? A little note about it in the commit log would be nice.

I was wondering if having a host variant would not be interesting too. Indeed, uftrace has a record mode, where it has a 'record' mode where it stores all the traces into a file, and replay/report/graph modes where it reads from that file to do off-sire analysis. So one might be interested in running in record mode in the target, and doing the analysis on the development machine...

Thoughts?

Regards,
Yann E. MORIN.

Quoted 7 lines
Signature · 6 lines
2.27.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 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.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/uftrace: new package

Hello,

(In addition to Yann comments)

Quoted 6 lines · On Sun, 4 Apr 2021 11:03:38 +0200 "Yann E. MORIN" <[email protected]>…

package/uftrace/uftrace.mk line 15

Quoted 6 lines
package/uftrace/uftrace.mk new file +6 -0
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif

This optional dependency is a bit odd. How does the uftrace build system detects the availability of elfutils? You're not passing any specific option when elfutils is available or not available.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 package/uftrace: new package

Hello Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello,

(In addition to Yann comments)

On Sun, 4 Apr 2021 11:03:38 +0200
"Yann E. MORIN" <[email protected]> wrote:

Quoted 10 lines
Quoted 6 lines

package/uftrace/uftrace.mk line 15

Quoted 6 lines
package/uftrace/uftrace.mk new file +6 -0
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif

This optional dependency is a bit odd. How does the uftrace build system detects the availability of elfutils? You're not passing any specific option when elfutils is available or not available.

uftrace does it strangely - it has a bunch of C files that check if a possible extension exists.
Those test files are compiled anyway, or at least uftrace tries to compile them and ignore the error in case of a failure. After that, it checks if an executable with a specific name was created. If yes, it adds the dependency.
So there's no flag that enables this dependency, it just has to be installed and uftrace will try to add it.

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Regards,
Asaf

#4 lore raw

PATCH 1/1 package/uftrace: new package

In reply to Yann E. MORIN

Hello Yann,

Quoted 11 lines · Yann E. MORIN

Asaf, All,

On 2021-04-03 22:16 +0300, Asaf Kahlon spake thusly:

Quoted 6 lines

The uftrace tool is to trace and analyze execution of a program written in C/C++. It was heavily inspired by the ftrace framework of the Linux kernel (especially function graph tracer) and supports userspace programs. It supports various kind of commands and filters to help analysis of the program execution and performance.

Quoted 3 lines

Rather than duplicate the package description in the commit log, I think it makes more sense that it contains explanations about the packaging in Buildroot. See below.

I'll amend the message, thanks.

Quoted 8 lines
Quoted 6 lines
---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/busybox/busybox.     |  0

Uh? ;-)

Oops :) Will be fixed.

Quoted 24 lines

[--SNIP--]

package/uftrace/Config.in line 3

Quoted 9 lines
package/uftrace/Config.in new file +3 -0
new file mode 100644
index 0000000000..ca3041195e
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_UFTRACE
+     bool "uftrace"
+     depends on BR2_arm || BR2_aarch64 || BR2_x86_64

AFAICS, it also support i386...

Even though the architecture dependencies are pretty trivial today, I think it would be good to introduce a _ARCH_SUPPORTS symbol:

config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
bool
default y if BR2_arm
default y if BR2_aarch64
default y if BR2_i386
default y if BR2_x86_64

Quoted 4 lines

config BR2_PACKAGE_UFTRACE
bool "uftrace"
depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS

Done on v2.

Quoted 10 lines

[--SNIP--]

Quoted 9 lines
package/uftrace/uftrace.mk new file +3 -0
new file mode 100644
index 0000000000..b696ac4c6e
@@ -0,0 +1,26 @@
+################################################################################
+#
+# uftrace
Quoted 9 lines

package/uftrace/uftrace.mk line 8

Quoted 5 lines
package/uftrace/uftrace.mk new file +5 -0
+#
+################################################################################
+
+UFTRACE_VERSION = 0.9.4
+UFTRACE_SITE = https://github.com/namhyung/uftrace/archive/refs/tags

Please use the github macro; see e.g. boot/shim/shim.mk and the manual:
https://buildroot.org/downloads/manual/manual.html#github-download-url

Done in v2.

Quoted 4 lines

package/uftrace/uftrace.mk line 9

Quoted 1 line
package/uftrace/uftrace.mk new file +1 -0
+UFTRACE_SOURCE = v0.9.4.tar.gz

No need to specify _SOURCE when using the github macro.

Quoted 11 lines

package/uftrace/uftrace.mk line 18

Quoted 9 lines
package/uftrace/uftrace.mk new file +9 -0
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif
+
+define UFTRACE_BUILD_CMDS
+     $(TARGET_CONFIGURE_OPTS) ARCH=$(BR2_ARCH) $(MAKE) -C $(@D) $(UFTRACE_MAKE_OPTS)

You are not setting UFTRACE_MAKE_OPTS anywhere that I can see...

You're right, removed.

Quoted 13 lines

package/uftrace/uftrace.mk line 26

Quoted 9 lines
package/uftrace/uftrace.mk new file +7 -0
+endef
 
+define UFTRACE_INSTALL_TARGET_CMDS
+     $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) \
+             $(UFTRACE_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))

There is a ./configure script (but it is not autotools, so this truly is a generic-package indeed): any reason why you are not using it? A little note about it in the commit log would be nice.

Well, the ./configure script is called from the Makefile, and actually I don't see any reason to run it separately.
But I agree a proper commit message should be added in order to make the compilation process clean.

Quoted 7 lines

I was wondering if having a host variant would not be interesting too. Indeed, uftrace has a record mode, where it has a 'record' mode where it stores all the traces into a file, and replay/report/graph modes where it reads from that file to do off-sire analysis. So one might be interested in running in record mode in the target, and doing the analysis on the development machine...

That's an interesting idea. I admit I didn't try this use case.

I'll send a v2 soon, and I'll invest some time later to check the option to add a host.
Anyway, thanks for the review!

Quoted 14 lines

Thoughts?

Regards,
Yann E. MORIN.

Quoted 7 lines

--
2.27.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Quoted 7 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.  |

'------------------------------^-------^------------------^--------------------'

Regards,
Asaf.