Skip to content

Commit

Permalink
perf tools: Enable libtracefs dynamic linking
Browse files Browse the repository at this point in the history
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/[email protected]/

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

https://lore.kernel.org/linux-perf-users/[email protected]/

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

Signed-off-by: Ian Rogers <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: [email protected]
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
captain5050 authored and acmel committed Sep 28, 2021
1 parent 3d5ac9e commit b758a61
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/build/Makefile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC := \
libslang \
libslang-include-subdir \
libtraceevent \
libtracefs \
libcrypto \
libunwind \
pthread-attr-setaffinity-np \
Expand Down
4 changes: 4 additions & 0 deletions tools/build/feature/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions tools/build/feature/test-libtracefs.c
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 9 additions & 0 deletions tools/perf/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b758a61

Please sign in to comment.