summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVlad Glagolev2019-08-18 02:07:03 +0000
committerVlad Glagolev2019-08-18 02:07:03 +0000
commit9666e5568810fc015769dcc185119d581d73b289 (patch)
tree4bd713abbdae09ac66ca3f34bec40ee8dc1b261a /utils
parent85845bc118c7c01346481fbb884ce9f59603b92e (diff)
perf: new spell, Linux performance analyzing tool
Diffstat (limited to 'utils')
-rwxr-xr-xutils/perf/BUILD11
-rwxr-xr-xutils/perf/DEPENDS55
-rwxr-xr-xutils/perf/DETAILS14
-rw-r--r--utils/perf/HISTORY3
-rwxr-xr-xutils/perf/INSTALL11
-rwxr-xr-xutils/perf/PREPARE7
-rwxr-xr-xutils/perf/PRE_BUILD18
-rwxr-xr-xutils/perf/TRIGGERS1
-rw-r--r--utils/perf/elf.patch23
9 files changed, 143 insertions, 0 deletions
diff --git a/utils/perf/BUILD b/utils/perf/BUILD
new file mode 100755
index 0000000000..855971c75e
--- /dev/null
+++ b/utils/perf/BUILD
@@ -0,0 +1,11 @@
+cd "${SOURCE_DIRECTORY}/perf" &&
+
+local _targets="all" &&
+
+if is_depends_enabled ${SPELL} asciidoc; then
+ _targets="all man"
+fi &&
+
+make CFLAGS="${CFLAGS}" EXTRA_CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+ V=1 WERROR=0 DESTDIR="${INSTALL_ROOT}" prefix=/usr lib=lib/perf \
+ ${OPTS} $_targets
diff --git a/utils/perf/DEPENDS b/utils/perf/DEPENDS
new file mode 100755
index 0000000000..94084654ae
--- /dev/null
+++ b/utils/perf/DEPENDS
@@ -0,0 +1,55 @@
+optional_depends gtk+2 \
+ "NO_GTK=" \
+ "NO_GTK=1" \
+ "for GTK+2 support" &&
+
+optional_depends audit \
+ "NO_LIBAUDIT=" \
+ "NO_LIBAUDIT=1" \
+ "for trace tool support" &&
+
+optional_depends LIBELF \
+ "NO_LIBELF=" \
+ "NO_LIBELF=1" \
+ "for probe tool support" &&
+
+optional_depends perl \
+ "NO_LIBPERL=" \
+ "NO_LIBPERL=1" \
+ "for Perl scripting support" &&
+
+optional_depends python \
+ "NO_LIBPYTHON=" \
+ "NO_LIBPYTHON=1" \
+ "for Python support" &&
+
+optional_depends slang \
+ "NO_SLANG=" \
+ "NO_SLANG=1" \
+ "for TUI support" &&
+
+optional_depends SSL \
+ "NO_LIBCRYPTO=" \
+ "NO_LIBCRYPTO=1" \
+ "for jitted code injection" &&
+
+optional_depends libunwind \
+ "NO_LIBUNWIND=" \
+ "NO_LIBUNWIND=1" \
+ "for post unwind support" &&
+
+optional_depends zlib \
+ "NO_ZLIB=" \
+ "NO_ZLIB=1" \
+ "for kernel module decompression support" &&
+
+optional_depends xz-utils \
+ "NO_LZMA=" \
+ "NO_LZMA=1" \
+ "for xz kernel module decompression support" &&
+
+optional_depends asciidoc "" "" "to build documentation" &&
+
+if is_depends_enabled ${SPELL} asciidoc; then
+ depends xmlto
+fi
diff --git a/utils/perf/DETAILS b/utils/perf/DETAILS
new file mode 100755
index 0000000000..0ca8901e4a
--- /dev/null
+++ b/utils/perf/DETAILS
@@ -0,0 +1,14 @@
+ SPELL=perf
+ VERSION=$(uname -r)
+SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}"
+ WEB_SITE=https://perf.wiki.kernel.org/
+ ENTERED=20190817
+ LICENSE=GPL
+ KEYWORDS="kernel"
+ SHORT="Linux performance analyzing tool"
+cat << EOF
+Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU
+hardware differences in Linux performance measurements and presents a simple
+commandline interface. Perf is based on the perf_events interface exported by
+recent versions of the Linux kernel.
+EOF
diff --git a/utils/perf/HISTORY b/utils/perf/HISTORY
new file mode 100644
index 0000000000..76b89cbe6c
--- /dev/null
+++ b/utils/perf/HISTORY
@@ -0,0 +1,3 @@
+2019-08-17 Vlad Glagolev <stealth@sourcemage.org>
+ * DETAILS, DEPENDS, {PRE_,}BUILD, INSTALL, PREPARE, TRIGGERS,
+ elf.patch: created spell, version synced with running kernel
diff --git a/utils/perf/INSTALL b/utils/perf/INSTALL
new file mode 100755
index 0000000000..fb62904d44
--- /dev/null
+++ b/utils/perf/INSTALL
@@ -0,0 +1,11 @@
+cd "${SOURCE_DIRECTORY}/perf" &&
+
+local _targets="install" &&
+
+if is_depends_enabled ${SPELL} asciidoc; then
+ _targets="install install-man"
+fi &&
+
+make CFLAGS="${CFLAGS}" EXTRA_CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+ V=1 WERROR=0 DESTDIR="${INSTALL_ROOT}" prefix=/usr lib=lib/perf \
+ ${OPTS} $_targets
diff --git a/utils/perf/PREPARE b/utils/perf/PREPARE
new file mode 100755
index 0000000000..02cd6c1b30
--- /dev/null
+++ b/utils/perf/PREPARE
@@ -0,0 +1,7 @@
+if [ ! -d "${INSTALL_ROOT}/usr/src/linux/tools/perf" ]; then
+ message "\n${PROBLEM_COLOR}ERROR: Linux kernel sources under ${FILE_COLOR}${INSTALL_ROOT}/usr/src/linux${PROBLEM_COLOR} are required"
+ message "to build this spell, either install the ${SPELL_COLOR}linux${PROBLEM_COLOR} spell or unpack"
+ message "kernel sources matching your running kernel manually.${DEFAULT_COLOR}\n"
+
+ return 1
+fi
diff --git a/utils/perf/PRE_BUILD b/utils/perf/PRE_BUILD
new file mode 100755
index 0000000000..913c728f71
--- /dev/null
+++ b/utils/perf/PRE_BUILD
@@ -0,0 +1,18 @@
+mk_source_dir "${SOURCE_DIRECTORY}" &&
+cd "${SOURCE_DIRECTORY}" &&
+
+if grep -q Werror ../linux/tools/lib/bpf/Makefile; then
+ sedit "s:-Werror::" ../linux/tools/lib/bpf/Makefile
+fi &&
+
+ln -s ../linux/tools/perf perf &&
+
+cd perf &&
+
+if ! grep -q libdir_relative Makefile.perf; then
+ sedit "s:install_plugins:install_plugins libdir_relative=lib:" Makefile.perf
+fi &&
+
+if ! grep -q "GELF_ST_VISIBILITY" util/symbol-elf.c; then
+ patch -p0 "${SPELL_DIRECTORY}/elf.patch"
+fi
diff --git a/utils/perf/TRIGGERS b/utils/perf/TRIGGERS
new file mode 100755
index 0000000000..5c92593243
--- /dev/null
+++ b/utils/perf/TRIGGERS
@@ -0,0 +1 @@
+on_cast linux cast_self
diff --git a/utils/perf/elf.patch b/utils/perf/elf.patch
new file mode 100644
index 0000000000..e557cd3c80
--- /dev/null
+++ b/utils/perf/elf.patch
@@ -0,0 +1,23 @@
+--- util/symbol-elf.c.orig 2017-11-12 10:46:13.000000000 -0800
++++ util/symbol-elf.c 2019-08-17 14:48:59.906991518 -0700
+@@ -19,6 +19,20 @@
+ #define EM_AARCH64 183 /* ARM 64 bit */
+ #endif
+
++#ifndef ELF32_ST_VISIBILITY
++#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
++#endif
++
++/* For ELF64 the definitions are the same. */
++#ifndef ELF64_ST_VISIBILITY
++#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
++#endif
++
++/* How to extract information held in the st_other field. */
++#ifndef GELF_ST_VISIBILITY
++#define GELF_ST_VISIBILITY(val) ELF64_ST_VISIBILITY (val)
++#endif
++
+ typedef Elf64_Nhdr GElf_Nhdr;
+
+ #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT