Skip to contentSkip to conversation

perf: new package

PATCH New Thomas Petazzoni 3 participants 9 messages Jan 3, 2013 – Jan 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: new package

This patch adds a new package that allows to build the 'perf' userspace tool that comes in the tools/perf directory of the kernel sources.

It is an alternative proposal to the one done by Kaiwan Billimoria <[email protected]>, in that it creates the package in package/perf/. It therefore properly integrates with the Buildroot package infrastructure.

Of course, the package depends on the Linux kernel to be built by Buildroot, in order to get Perf sources matching the version of the kernel that will be executed.

One remaining issue is that this package only builds properly with kernel >= v3.7 (but it was the same with Kaiwan proposal) : the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7. If we want to support older kernel versions, we'll have to create a package for libelf.

---
 package/Config.in      |    1 +
 package/perf/Config.in |   22 ++++++++++++++++++++++
 package/perf/perf.mk   |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 package/perf/Config.in
 create mode 100644 package/perf/perf.mk
package/Config.in +1 -0
index 7860f3f..9e392d8 100644
@@ -35,6 +35,7 @@ source "package/ltrace/Config.in"
 source "package/memstat/Config.in"
 source "package/netperf/Config.in"
 source "package/oprofile/Config.in"
+source "package/perf/Config.in"
 source "package/ramspeed/Config.in"
 source "package/rt-tests/Config.in"
 source "package/strace/Config.in"
package/perf/Config.in new file +22 -0
new file mode 100644
index 0000000..54b24fe
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_PERF
+	bool "perf"
+	depends on BR2_LINUX_KERNEL
+	depends on BR2_LARGEFILE
+	help
+	  perf (sometimes "Perf Events" or perf tools, originally
+	  "Performance Counters for Linux") - is a performance
+	  analyzing tool in Linux, available from kernel version
+	  2.6.31. User-space controlling utility, called 'perf' has
+	  git-like interface with subcommands. It is capable of
+	  statistical profiling of entire system (both kernel and user
+	  code), single CPU or severals threads.
+
+	  This package builds and install the userspace 'perf'
+	  command. It is up to the user to ensure that the kernel
+	  configuration has all suitable options enable to allow a
+	  proper operation of 'perf'.
+
+	  https://perf.wiki.kernel.org/
+
+comment "perf only available if Linux kernel is enabled, and requires largefile support"
+	depends on !BR2_LINUX_KERNEL || !BR2_LARGEFILE
package/perf/perf.mk new file +38 -0
new file mode 100644
index 0000000..7774dae
@@ -0,0 +1,38 @@
+#############################################################
+#
+# perf
+#
+#############################################################
+
+# Source taken from the Linux kernel tree
+PERF_SOURCE =
+PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+PERF_DEPENDENCIES = linux
+
+PERF_MAKE_FLAGS = \
+	$(LINUX_MAKE_FLAGS) \
+	NO_LIBELF=1 \
+	NO_DWARF=1 \
+	NO_LIBAUDIT=1 \
+	NO_NEWT=1 \
+	NO_GTK2=1 \
+	NO_LIBPERL=1 \
+	NO_LIBPYTHON=1 \
+	DESTDIR=$(TARGET_DIR) \
+	prefix=/usr
+
+define PERF_BUILD_CMDS
+	$(MAKE) -C $(LINUX_DIR)/tools/perf \
+		$(PERF_MAKE_FLAGS) O=$(@D)
+endef
+
+# After installation, we remove the Perl and Python scripts from the
+# target.
+define PERF_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(LINUX_DIR)/tools/perf \
+		$(PERF_MAKE_FLAGS) O=$(@D) install
+	$(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 perf: new package

3.1.2013 17:07, Thomas Petazzoni kirjoitti:

Quoted 13 lines

This patch adds a new package that allows to build the 'perf' userspace tool that comes in the tools/perf directory of the kernel sources.

It is an alternative proposal to the one done by Kaiwan Billimoria <[email protected]>, in that it creates the package in package/perf/. It therefore properly integrates with the Buildroot package infrastructure.

Of course, the package depends on the Linux kernel to be built by Buildroot, in order to get Perf sources matching the version of the kernel that will be executed.

Quoted 5 lines

One remaining issue is that this package only builds properly with kernel >= v3.7 (but it was the same with Kaiwan proposal) : the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7. If we want to support older kernel versions, we'll have to create a package for libelf.

Here is an elfutils 0.155 (which contains libelf) for buildroot that I posted some time ago.
Patch #4 is missing from that list because it was too big to submit to this list.

http://lists.busybox.net/pipermail/buildroot/2012-December/063855.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063856.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063864.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063858.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063857.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063859.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063861.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063860.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063863.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063862.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063865.html

Regards
Stefan

#2 lore raw

PATCH 1/1 perf: new package

3.1.2013 17:24, Stefan Fr?berg kirjoitti:

Quoted 36 lines

3.1.2013 17:07, Thomas Petazzoni kirjoitti:

Quoted 13 lines

This patch adds a new package that allows to build the 'perf' userspace tool that comes in the tools/perf directory of the kernel sources.

It is an alternative proposal to the one done by Kaiwan Billimoria <[email protected]>, in that it creates the package in package/perf/. It therefore properly integrates with the Buildroot package infrastructure.

Of course, the package depends on the Linux kernel to be built by Buildroot, in order to get Perf sources matching the version of the kernel that will be executed.

Quoted 5 lines

One remaining issue is that this package only builds properly with kernel >= v3.7 (but it was the same with Kaiwan proposal) : the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7. If we want to support older kernel versions, we'll have to create a package for libelf.

Here is an elfutils 0.155 (which contains libelf) for buildroot that I posted some time ago.
Patch #4 is missing from that list because it was too big to submit to this list.

http://lists.busybox.net/pipermail/buildroot/2012-December/063855.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063856.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063864.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063858.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063857.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063859.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063861.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063860.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063863.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063862.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063865.html

Quoted 3 lines

Regards
Stefan

And now while i *still* remember, that first patch, patch #1 should be replaced with this

http://lists.busybox.net/pipermail/buildroot/2012-December/063876.html

Quoted 4 lines

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

#3 lore raw

PATCH 1/1 perf: new package

In reply to Stefan Fröberg

Dear Stefan Fr?berg,

Quoted 5 lines · Stefan Fr?berg

Here is an elfutils 0.155 (which contains libelf) for buildroot that I posted some time ago.
Patch #4 is missing from that list because it was too big to submit to this list.

Quoted 11 lines

http://lists.busybox.net/pipermail/buildroot/2012-December/063855.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063856.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063864.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063858.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063857.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063859.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063861.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063860.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063863.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063862.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063865.html

I've started having a real look at this, and started refactoring your patch series.

Could you point me to the missing PATCH #4, so that I can see your entire series? At least send it by private e-mail to me, so that we don't get limited by the list.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 perf: new package

Hi Thomas

4.1.2013 1:22, Thomas Petazzoni kirjoitti:

Quoted 20 lines

Dear Stefan Fr?berg,

Quoted 5 lines · Stefan Fr?berg

Here is an elfutils 0.155 (which contains libelf) for buildroot that I posted some time ago.
Patch #4 is missing from that list because it was too big to submit to this list.

Quoted 11 lines

http://lists.busybox.net/pipermail/buildroot/2012-December/063855.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063856.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063864.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063858.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063857.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063859.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063861.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063860.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063863.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063862.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063865.html

Quoted 6 lines

I've started having a real look at this, and started refactoring your patch series.

Could you point me to the missing PATCH #4, so that I can see your entire series? At least send it by private e-mail to me, so that we don't get limited by the list.

I can do that but I have to warn you that it's huge (1.5 MB). Only one of the grub patches in buildroot is bigger (1.6 MB).

It's because uClibc is missing obstack_printf functionality and almost half of it goes
to implementing it by gnulib portability library
(https://www.gnu.org/software/gnulib/)

Another half goes to enabling fts interface (because it's not enabled by default in buildroot).

Ofcourse enabling it buy default in buildroot or even better, giving user a choice of enabling it
in buildroot will help cutting size of that patch.

Anyway, I try to send it to you privately.

And also within few hours I will be kicking my old
crappy server online again, upload that patch there and submit link to that patch for
everybody to work on.

Regards
Stefan

Quoted 3 lines

Thanks,

Thomas

#5 lore raw

PATCH 1/1 perf: new package

In reply to Thomas Petazzoni

4.1.2013 1:22, Thomas Petazzoni kirjoitti:

Quoted 20 lines

Dear Stefan Fr?berg,

Quoted 5 lines · Stefan Fr?berg

Here is an elfutils 0.155 (which contains libelf) for buildroot that I posted some time ago.
Patch #4 is missing from that list because it was too big to submit to this list.

Quoted 11 lines

http://lists.busybox.net/pipermail/buildroot/2012-December/063855.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063856.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063864.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063858.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063857.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063859.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063861.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063860.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063863.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063862.html
http://lists.busybox.net/pipermail/buildroot/2012-December/063865.html

Quoted 6 lines

I've started having a real look at this, and started refactoring your patch series.

Could you point me to the missing PATCH #4, so that I can see your entire series? At least send it by private e-mail to me, so that we don't get limited by the list.

Link to that patch #4

http://www.micro-os.com/elfutils.001-gnulib.patch

(some day I have to get my lazy ass up and make a real web page ... )

Stefan

Quoted 3 lines

Thanks,

Thomas

#6 lore raw

PATCH 1/1 perf: new package

Dear Stefan Fr?berg,

Quoted 5 lines · Stefan Fr?berg

Link to that patch #4

http://www.micro-os.com/elfutils.001-gnulib.patch

(some day I have to get my lazy ass up and make a real web page ... )

Thanks. I started to have a look, I have some ideas on how to make that a bit more reasonable.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw

PATCH 1/1 perf: new package

In reply to Thomas Petazzoni

Hello Thomas,

Great work! ..of course :)

Just checking / asking:
1. what about the kernel patch to be applied such that kernel build for perf is successful (i sent in the patch yesterday)

2. In my patch (linux.mk), I make a validity check to confirm that the kernel version is >= 2.6.31 (as perf is only supported from that ver onward). Should we keep that check?

3. You mention :

Quoted 2 lines

the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7.

I did test my patches on the 3.2.21 vanilla kernel and it seems to work okay..

Thanks,
Kaiwan.

Quoted 115 lines · Thomas Petazzoni

This patch adds a new package that allows to build the 'perf' userspace tool that comes in the tools/perf directory of the kernel sources.

It is an alternative proposal to the one done by Kaiwan Billimoria <[email protected]>, in that it creates the package in package/perf/. It therefore properly integrates with the Buildroot package infrastructure.

Of course, the package depends on the Linux kernel to be built by Buildroot, in order to get Perf sources matching the version of the kernel that will be executed.

One remaining issue is that this package only builds properly with kernel >= v3.7 (but it was the same with Kaiwan proposal) : the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7. If we want to support older kernel versions, we'll have to create a package for libelf.

---
 package/Config.in      |    1 +
 package/perf/Config.in |   22 ++++++++++++++++++++++
 package/perf/perf.mk   |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 package/perf/Config.in
 create mode 100644 package/perf/perf.mk
package/Config.in +1 -0
index 7860f3f..9e392d8 100644
@@ -35,6 +35,7 @@ source "package/ltrace/Config.in"
 source "package/memstat/Config.in"
 source "package/netperf/Config.in"
 source "package/oprofile/Config.in"
+source "package/perf/Config.in"
 source "package/ramspeed/Config.in"
 source "package/rt-tests/Config.in"
 source "package/strace/Config.in"
package/perf/Config.in new file +22 -0
new file mode 100644
index 0000000..54b24fe
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_PERF
+       bool "perf"
+       depends on BR2_LINUX_KERNEL
+       depends on BR2_LARGEFILE
+       help
+         perf (sometimes "Perf Events" or perf tools, originally
+         "Performance Counters for Linux") - is a performance
+         analyzing tool in Linux, available from kernel version
+         2.6.31. User-space controlling utility, called 'perf' has
+         git-like interface with subcommands. It is capable of
+         statistical profiling of entire system (both kernel and user
+         code), single CPU or severals threads.
+
+         This package builds and install the userspace 'perf'
+         command. It is up to the user to ensure that the kernel
+         configuration has all suitable options enable to allow a
+         proper operation of 'perf'.
+
+         https://perf.wiki.kernel.org/
+
+comment "perf only available if Linux kernel is enabled, and requires largefile support"
+       depends on !BR2_LINUX_KERNEL || !BR2_LARGEFILE
package/perf/perf.mk new file +38 -1
new file mode 100644
index 0000000..7774dae
@@ -0,0 +1,38 @@
+#############################################################
+#
+# perf
+#
+#############################################################
+
+# Source taken from the Linux kernel tree
+PERF_SOURCE =
+PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+PERF_DEPENDENCIES = linux
+
+PERF_MAKE_FLAGS = \
+       $(LINUX_MAKE_FLAGS) \
+       NO_LIBELF=1 \
+       NO_DWARF=1 \
+       NO_LIBAUDIT=1 \
+       NO_NEWT=1 \
+       NO_GTK2=1 \
+       NO_LIBPERL=1 \
+       NO_LIBPYTHON=1 \
+       DESTDIR=$(TARGET_DIR) \
+       prefix=/usr
+
+define PERF_BUILD_CMDS
+       $(MAKE) -C $(LINUX_DIR)/tools/perf \
+               $(PERF_MAKE_FLAGS) O=$(@D)
+endef
+
+# After installation, we remove the Perl and Python scripts from the
+# target.
+define PERF_INSTALL_TARGET_CMDS
+       $(MAKE) -C $(LINUX_DIR)/tools/perf \
+               $(PERF_MAKE_FLAGS) O=$(@D) install
+       $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
+endef
+
+$(eval $(generic-package))
--

1.7.9.5

#8 lore raw

PATCH 1/1 perf: new package

Dear Kaiwan Billimoria,

Quoted 3 lines · Kaiwan Billimoria

Just checking / asking:
1. what about the kernel patch to be applied such that kernel build for perf is successful (i sent in the patch yesterday)

It apparently wasn't needed to build perf on a 3.7 kernel.

Quoted 3 lines

2. In my patch (linux.mk), I make a validity check to confirm that the kernel version is >= 2.6.31 (as perf is only supported from that ver onward). Should we keep that check?

For now, I did not introduce it, due to the fact that the kernel versions for which perf is usable are not clear yet. According to you, it's 2.6.31, according to me it's 3.7. Once we figure that out, we can introduce a version check if needed.

Quoted 4 lines

3. You mention :

Quoted 2 lines

the NO_LIBELF variable, which allows to get rid of the libelf dependency, has only been introduced between 3.6 and 3.7.

I did test my patches on the 3.2.21 vanilla kernel and it seems to work okay..

Here is the tools/perf/Makefile from 3.2.21 :
https://git.kernel.org/?p=linux/kernel/git/bwh/linux-3.2.y.git;a=blob;f=tools/perf/Makefile;h=b98e3075646b43f8f3218f45289f65068ea7ef31;hb=8499e79e9ee4c946ae38fd12e5d3afe8b68f2dfd

As you can see, it does not understand the NO_LIBELF variable, but requires the libelf library to be present. So I'm not sure how you manage to build perf without libelf with 3.2.21.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com