Commit b758a61b authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Enable libtracefs dynamic linking

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: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarJiri 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3d5ac9ef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC := \
        libslang                        \
        libslang-include-subdir         \
        libtraceevent                   \
        libtracefs                      \
        libcrypto                       \
        libunwind                       \
        pthread-attr-setaffinity-np     \
+4 −0
Original line number Diff line number Diff line
@@ -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

+10 −0
Original line number Diff line number Diff line
// 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;
}
+9 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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