]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf tools: Enable libtracefs dynamic linking
authorIan Rogers <irogers@google.com>
Thu, 23 Sep 2021 00:10:21 +0000 (17:10 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 28 Sep 2021 19:08:37 +0000 (16:08 -0300)
Currently libtracefs isn't used by perf, but there are potential
improvements by using it as identified Steven Rostedt's e-mail:
https://lore.kernel.org/lkml/20210610154759.1ef958f0@oasis.local.home/

This change is modelled on the dynamic libtraceevent patch by Michael
Petlan:

https://lore.kernel.org/linux-perf-users/20210428092023.4009-1-mpetlan@redhat.com/

v3. Adds file missed in v1 and v2 spotted by Jiri Olsa.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/lkml/20210923001024.550263-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/build/Makefile.feature
tools/build/feature/Makefile
tools/build/feature/test-libtracefs.c [new file with mode: 0644]
tools/perf/Makefile.config
tools/perf/Makefile.perf

index 3dd2f68366f954e0ca52b4d99bfd5eaae1dce533..45a9a59828c3c09d420e8e149930363cec9668c2 100644 (file)
@@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC :=                  \
         libslang                        \
         libslang-include-subdir         \
         libtraceevent                   \
+        libtracefs                      \
         libcrypto                       \
         libunwind                       \
         pthread-attr-setaffinity-np     \
index eff55d287db1f4ea9d5af6c761303c3463d28eaf..d024b5204ba0f4dfdcd209e21d845121233677df 100644 (file)
@@ -36,6 +36,7 @@ FILES=                                          \
          test-libslang.bin                      \
          test-libslang-include-subdir.bin       \
          test-libtraceevent.bin                 \
+         test-libtracefs.bin                    \
          test-libcrypto.bin                     \
          test-libunwind.bin                     \
          test-libunwind-debug-frame.bin         \
@@ -199,6 +200,9 @@ $(OUTPUT)test-libslang-include-subdir.bin:
 $(OUTPUT)test-libtraceevent.bin:
        $(BUILD) -ltraceevent
 
+$(OUTPUT)test-libtracefs.bin:
+       $(BUILD) -ltracefs
+
 $(OUTPUT)test-libcrypto.bin:
        $(BUILD) -lcrypto
 
diff --git a/tools/build/feature/test-libtracefs.c b/tools/build/feature/test-libtracefs.c
new file mode 100644 (file)
index 0000000..8eff16c
--- /dev/null
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <tracefs/tracefs.h>
+
+int main(void)
+{
+       struct tracefs_instance *inst = tracefs_instance_create("dummy");
+
+       tracefs_instance_destroy(inst);
+       return 0;
+}
index 446180401e267f27cc35852572b77131e3353fe5..00ec900ddbca55088b20b2f9fd494e5c334d8b33 100644 (file)
@@ -1098,6 +1098,15 @@ ifdef LIBTRACEEVENT_DYNAMIC
   endif
 endif
 
+ifdef LIBTRACEFS_DYNAMIC
+  $(call feature_check,libtracefs)
+  ifeq ($(feature-libtracefs), 1)
+    EXTLIBS += -ltracefs
+  else
+    dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev);
+  endif
+endif
+
 # Among the variables below, these:
 #   perfexecdir
 #   perf_include_dir
index e04313c4d8409a9429fcd7d8080610d73441b783..7df13e74450c1d97482a76b13b4598879831be1a 100644 (file)
@@ -130,6 +130,8 @@ include ../scripts/utilities.mak
 #
 # Define LIBTRACEEVENT_DYNAMIC to enable libtraceevent dynamic linking
 #
+# Define LIBTRACEFS_DYNAMIC to enable libtracefs dynamic linking
+#
 
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL