From 97238c15a8f350ad197009263edf42b1084b02cd Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 4 Jul 2010 17:08:13 +0000 Subject: [PATCH] Add linux-tools- package containing the perf tool (Closes: #548715) svn path=/dists/sid/linux-2.6/; revision=15932 --- debian/bin/perf | 11 ++++++++++ debian/changelog | 2 ++ debian/perf.1 | 19 +++++++++++++++++ debian/rules | 2 +- debian/rules.real | 34 +++++++++++++++++++++++++++++- debian/templates/control.main.in | 12 +++++++++++ debian/templates/control.source.in | 4 ++-- 7 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 debian/bin/perf create mode 100644 debian/perf.1 diff --git a/debian/bin/perf b/debian/bin/perf new file mode 100644 index 000000000..fc2c0797d --- /dev/null +++ b/debian/bin/perf @@ -0,0 +1,11 @@ +#!/bin/bash + +# Execute the right version of perf for the current kernel. +version="$(uname -r)" +version="${version%%-*}" +shopt -s execfail +exec "perf_$version" "$@" + +# Not found? Tell the user which package to install. +echo >&2 "E: linux-tools-$version is not installed." +exit 1 diff --git a/debian/changelog b/debian/changelog index 6756b179a..f4bdbf642 100644 --- a/debian/changelog +++ b/debian/changelog @@ -56,6 +56,8 @@ linux-2.6 (2.6.32-16) UNRELEASED; urgency=low not called wlan0 (Closes: #582972) - Correct device ID table (Closes: #584945, #587985) * Add r8192u_usb driver + * Add linux-tools- package containing the perf tool + (Closes: #548715) [ Aurelien Jarno ] * [sh4] fix sh_tmu clocksource following recent nohz changes. diff --git a/debian/perf.1 b/debian/perf.1 new file mode 100644 index 000000000..1bda2acf3 --- /dev/null +++ b/debian/perf.1 @@ -0,0 +1,19 @@ +.TH PERF 1 "4 July 2010" +.SH NAME +perf \- performance analysis tools for Linux +.SH SYNOPSIS +.HP +\fBperf\fR [\fB\-\-version\fR] [\fB\-\-help\fR] \fICOMMAND\fR [\fIARGS\fR] +.SH DESCRIPTION +.LP +Performance counters for Linux are are a new kernel\-based subsystem +that provide a framework for all things performance analysis. It +covers hardware level (CPU/PMU, Performance Monitoring Unit) features +and software features (software counters, tracepoints) as well. +.LP +Each version of the perf tools may depend on new kernel features, so +you must install a different version for each kernel version. The +\fBperf\fR command will automatically run the correct version for the +running kernel version. +.SH SEE ALSO +perf_\fIversion\fR(1) diff --git a/debian/rules b/debian/rules index 4c1553ac7..2c64da311 100755 --- a/debian/rules +++ b/debian/rules @@ -56,7 +56,7 @@ maintainerclean: clean: debian/control dh_testdir - rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/linux-headers-* debian/linux-image-* + rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/linux-headers-* debian/linux-image-* debian/linux-tools-* dh_clean binary-indep: $(STAMPS_DIR)/source-base diff --git a/debian/rules.real b/debian/rules.real index 11e85298a..e053c81b1 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -32,12 +32,14 @@ setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTION_UPLOADER=$(UPLOADER) DIS MAKE_CLEAN = $(setup_env) $(MAKE) MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES) MAKEOVERRIDES = +MAKE_PERF_VARS = prefix=/usr NO_PERL=1 MBITS= # # Targets # binary-arch-arch: install-headers_$(ARCH) binary-arch-arch: install-libc-dev_$(ARCH) +binary-arch-arch: install-tools_$(ARCH) binary-arch-featureset: install-headers_$(ARCH)_$(FEATURESET) binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) ifeq ($(DEBUG),True) @@ -133,6 +135,14 @@ $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: python debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR) @$(stamp) +$(STAMPS_DIR)/build-tools_$(ARCH): SOURCE_DIR=$(BUILD_DIR)/source +$(STAMPS_DIR)/build-tools_$(ARCH): DIR=$(BUILD_DIR)/build-tools_$(ARCH) +$(STAMPS_DIR)/build-tools_$(ARCH): $(STAMPS_DIR)/source + rm -rf $(DIR) + cp -al $(SOURCE_DIR) $(DIR) + +$(MAKE_CLEAN) -C '$(DIR)/tools/perf' $(JOBS_ARG) $(MAKE_PERF_VARS) all man + @$(stamp) + $(STAMPS_DIR)/build-doc: SOURCE_DIR=$(BUILD_DIR)/source $(STAMPS_DIR)/build-doc: DIR=$(BUILD_DIR)/build-doc $(STAMPS_DIR)/build-doc: $(STAMPS_DIR)/source @@ -468,6 +478,27 @@ ifeq ($(MODULES),True) endif +$(MAKE_SELF) install-base BUILDDEB_ARGS="-Zbzip2" +install-tools_$(ARCH): PACKAGE_NAME = linux-tools-$(UPSTREAMVERSION) +install-tools_$(ARCH): PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-tools_$(ARCH): DIR = $(BUILD_DIR)/build-tools_$(ARCH) +install-tools_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-tools_$(ARCH): $(STAMPS_DIR)/build-tools_$(ARCH) + dh_testdir + dh_testroot + dh_prep + dh_installdirs usr/bin + +$(MAKE_CLEAN) -C '$(DIR)/tools/perf' $(MAKE_PERF_VARS) \ + DESTDIR='$(CURDIR)/$(PACKAGE_DIR)' install install-man + # Rename command and manual pages to include version + mv $(PACKAGE_DIR)/usr/bin/perf $(PACKAGE_DIR)/usr/bin/perf_$(UPSTREAMVERSION) + for manpage in $(PACKAGE_DIR)/usr/share/man/*/*; do \ + mv "$$manpage" "$$(echo "$$manpage" | sed 's,/perf,&_$(UPSTREAMVERSION),')" || exit; \ + done + # Fix up cross-references + sed -i '/^\.SH "SEE ALSO"/,/^\.SH/ { s/perf-/perf_$(UPSTREAMVERSION)-/g }' \ + $(PACKAGE_DIR)/usr/share/man/*/* + +$(MAKE_SELF) install-base + install-patch: PACKAGE = linux-patch-debian-$(VERSION) install-patch: pbase := /usr/src/kernel-patches/all/$(UPSTREAMVERSION) install-patch: pfull := debian/$(PACKAGE)$(pbase) @@ -510,7 +541,8 @@ install-linux-base: dh_testdir dh_testroot dh_prep - dh_install -X.svn + dh_install debian/bin/perf /usr/bin + dh_installman debian/perf.1 dh_installdebconf +$(MAKE_SELF) install-base diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index 261ee2b07..3ad15802a 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -1,3 +1,15 @@ +Package: linux-tools-@version@ +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: linux-base (>= 2.6.32-16) +Suggests: linux-doc-@version@ +Description: Performance analysis tools for Linux @upstreamversion@ + This package contains the 'perf' performance analysis tools for Linux + kernel version @upstreamversion@. + . + The linux-base package contains a 'perf' command which will invoke the + appropriate version for the running kernel. + Package: linux-source-@version@ Architecture: all Section: kernel diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in index fa5bd5768..89e601894 100644 --- a/debian/templates/control.source.in +++ b/debian/templates/control.source.in @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian Kernel Team Uploaders: Bastian Blank , Frederik Schüler , maximilian attems , Ben Hutchings Standards-Version: 3.8.4 -Build-Depends: debhelper (>> 7), cpio, module-init-tools, python, lzma [armel] -Build-Depends-Indep: bzip2, python-support, xmlto +Build-Depends: debhelper (>> 7), cpio, module-init-tools, python, lzma [armel], libelf-dev, asciidoc, xmlto +Build-Depends-Indep: bzip2, python-support Vcs-Svn: svn://svn.debian.org/svn/kernel/dists/sid/linux-2.6/ Vcs-Browser: http://svn.debian.org/wsvn/kernel/dists/sid/linux-2.6/?op=log