Skip to content

Commit 42c2a75

Browse files
committed
Merge tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull trace tool updates from Steven Rostedt: "Tracing: - Update makefiles for latency-collector and RTLA, using tools/build/ makefiles like perf does, inheriting its benefits. For example, having a proper way to handle library dependencies. - The timerlat tracer has an interface for any tool to use. rtla timerlat tool uses this interface dispatching its own threads as workload. But, rtla timerlat could also be used for any other process. So, add 'rtla timerlat -U' option, allowing the timerlat tool to measure the latency of any task using the timerlat tracer interface. Verification: - Update makefiles for verification/rv, using tools/build/ makefiles like perf does, inheriting its benefits. For example, having a proper way to handle dependencies" * tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tools/rtla: Add -U/--user-load option to timerlat tools/verification: Use tools/build makefiles on rv tools/rtla: Use tools/build makefiles to build rtla tools/tracing: Use tools/build makefiles on latency-collector
2 parents dba89d1 + a23c05f commit 42c2a75

21 files changed

Lines changed: 650 additions & 306 deletions

Documentation/tools/rtla/common_timerlat_options.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@
3333
to wait on the timerlat_fd. Once the workload is awakes, it goes to sleep again
3434
adding so the measurement for the kernel-to-user and user-to-kernel to the tracer
3535
output.
36+
37+
**-U**, **--user-load**
38+
39+
Set timerlat to run without workload, waiting for the user to dispatch a per-cpu
40+
task that waits for a new period on the tracing/osnoise/per_cpu/cpu$ID/timerlat_fd.
41+
See linux/tools/rtla/sample/timerlat_load.py for an example of user-load code.

tools/tracing/latency/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
# SPDX-License-Identifier: GPL-2.0
1+
# SPDX-License-Identifier: GPL-2.0-only
22
latency-collector
3+
fixdep
4+
feature
5+
FEATURE-DUMP

tools/tracing/latency/Build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
latency-collector-y += latency-collector.o

tools/tracing/latency/Makefile

Lines changed: 87 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,93 @@
1-
# SPDX-License-Identifier: GPL-2.0
2-
# Makefile for vm tools
3-
#
4-
VAR_CFLAGS := $(shell pkg-config --cflags libtracefs 2>/dev/null)
5-
VAR_LDLIBS := $(shell pkg-config --libs libtracefs 2>/dev/null)
1+
# SPDX-License-Identifier: GPL-2.0-only
62

7-
TARGETS = latency-collector
8-
CFLAGS = -Wall -Wextra -g -O2 $(VAR_CFLAGS)
9-
LDFLAGS = -lpthread $(VAR_LDLIBS)
3+
ifeq ($(srctree),)
4+
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5+
srctree := $(patsubst %/,%,$(dir $(srctree)))
6+
srctree := $(patsubst %/,%,$(dir $(srctree)))
7+
endif
108

11-
all: $(TARGETS)
9+
include $(srctree)/tools/scripts/Makefile.include
1210

13-
%: %.c
14-
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
11+
# O is an alias for OUTPUT
12+
OUTPUT := $(O)
1513

16-
clean:
17-
$(RM) latency-collector
14+
ifeq ($(OUTPUT),)
15+
OUTPUT := $(CURDIR)
16+
else
17+
# subdir is used by the ../Makefile in $(call descend,)
18+
ifneq ($(subdir),)
19+
OUTPUT := $(OUTPUT)/$(subdir)
20+
endif
21+
endif
22+
23+
ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
24+
OUTPUT := $(OUTPUT)/
25+
endif
26+
27+
LATENCY-COLLECTOR := $(OUTPUT)latency-collector
28+
LATENCY-COLLECTOR_IN := $(LATENCY-COLLECTOR)-in.o
29+
30+
export CC := gcc
31+
export LD := ld
32+
export AR := ar
33+
export PKG_CONFIG := pkg-config
34+
35+
FEATURE_TESTS := libtraceevent
36+
FEATURE_TESTS += libtracefs
37+
FEATURE_DISPLAY := libtraceevent
38+
FEATURE_DISPLAY += libtracefs
39+
40+
ifeq ($(V),1)
41+
Q =
42+
else
43+
Q = @
44+
endif
45+
46+
all: $(LATENCY-COLLECTOR)
47+
48+
include $(srctree)/tools/build/Makefile.include
49+
50+
# check for dependencies only on required targets
51+
NON_CONFIG_TARGETS := clean install
1852

19-
prefix ?= /usr/local
20-
sbindir ?= ${prefix}/sbin
53+
config := 1
54+
ifdef MAKECMDGOALS
55+
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
56+
config := 0
57+
endif
58+
endif
2159

22-
install: all
23-
install -d $(DESTDIR)$(sbindir)
24-
install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir)
60+
ifeq ($(config),1)
61+
include $(srctree)/tools/build/Makefile.feature
62+
include Makefile.config
63+
endif
64+
65+
CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
66+
67+
export CFLAGS OUTPUT srctree
68+
69+
$(LATENCY-COLLECTOR): $(LATENCY-COLLECTOR_IN)
70+
$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(LATENCY-COLLECTOR) $(LATENCY-COLLECTOR_IN) $(EXTLIBS)
71+
72+
latency-collector.%: fixdep FORCE
73+
make -f $(srctree)/tools/build/Makefile.build dir=. $@
74+
75+
$(LATENCY-COLLECTOR_IN): fixdep FORCE
76+
make $(build)=latency-collector
77+
78+
INSTALL := install
79+
MKDIR := mkdir
80+
STRIP := strip
81+
BINDIR := /usr/bin
82+
83+
install:
84+
@$(MKDIR) -p $(DESTDIR)$(BINDIR)
85+
$(call QUIET_INSTALL,latency-collector)$(INSTALL) $(LATENCY-COLLECTOR) -m 755 $(DESTDIR)$(BINDIR)
86+
@$(STRIP) $(DESTDIR)$(BINDIR)/latency-collector
87+
88+
clean:
89+
$(call QUIET_CLEAN, latency-collector)
90+
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
91+
$(Q)@rm -f latency-collector fixdep FEATURE-DUMP
92+
$(Q)rm -rf feature
93+
.PHONY: FORCE clean install
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
3+
STOP_ERROR :=
4+
5+
define lib_setup
6+
$(eval EXTLIBS += -l$(1))
7+
$(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
8+
endef
9+
10+
$(call feature_check,libtraceevent)
11+
ifeq ($(feature-libtraceevent), 1)
12+
$(call detected,CONFIG_LIBTRACEEVENT)
13+
$(call lib_setup,traceevent)
14+
else
15+
STOP_ERROR := 1
16+
$(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel)
17+
endif
18+
19+
$(call feature_check,libtracefs)
20+
ifeq ($(feature-libtracefs), 1)
21+
$(call detected,CONFIG_LIBTRACEFS)
22+
$(call lib_setup,tracefs)
23+
else
24+
STOP_ERROR := 1
25+
$(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
26+
endif
27+
28+
ifeq ($(STOP_ERROR),1)
29+
$(error Please, check the errors above.)
30+
endif

tools/tracing/rtla/.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
/rtla
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
rtla
3+
rtla-static
4+
fixdep
5+
feature
6+
FEATURE-DUMP

tools/tracing/rtla/Build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rtla-y += src/

0 commit comments

Comments
 (0)