Commit 42c2a756 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents dba89d1b a23c05fd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -33,3 +33,9 @@
        to wait on the timerlat_fd. Once the workload is awakes, it goes to sleep again
        adding so the measurement for the kernel-to-user and user-to-kernel to the tracer
        output.

**-U**, **--user-load**

        Set timerlat to run without workload, waiting for the user to dispatch a per-cpu
        task that waits for a new period on the tracing/osnoise/per_cpu/cpu$ID/timerlat_fd.
        See linux/tools/rtla/sample/timerlat_load.py for an example of user-load code.
+4 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
# SPDX-License-Identifier: GPL-2.0-only
latency-collector
fixdep
feature
FEATURE-DUMP
+1 −0
Original line number Diff line number Diff line
latency-collector-y += latency-collector.o
+87 −18
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
# Makefile for vm tools
#
VAR_CFLAGS := $(shell pkg-config --cflags libtracefs 2>/dev/null)
VAR_LDLIBS := $(shell pkg-config --libs libtracefs 2>/dev/null)
# SPDX-License-Identifier: GPL-2.0-only

TARGETS = latency-collector
CFLAGS = -Wall -Wextra -g -O2 $(VAR_CFLAGS)
LDFLAGS = -lpthread $(VAR_LDLIBS)
ifeq ($(srctree),)
  srctree	:= $(patsubst %/,%,$(dir $(CURDIR)))
  srctree	:= $(patsubst %/,%,$(dir $(srctree)))
  srctree	:= $(patsubst %/,%,$(dir $(srctree)))
endif

all: $(TARGETS)
include $(srctree)/tools/scripts/Makefile.include

%: %.c
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
# O is an alias for OUTPUT
OUTPUT		:= $(O)

clean:
	$(RM) latency-collector
ifeq ($(OUTPUT),)
  OUTPUT	:= $(CURDIR)
else
  # subdir is used by the ../Makefile in $(call descend,)
  ifneq ($(subdir),)
    OUTPUT	:= $(OUTPUT)/$(subdir)
  endif
endif

ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
  OUTPUT	:= $(OUTPUT)/
endif

LATENCY-COLLECTOR	:= $(OUTPUT)latency-collector
LATENCY-COLLECTOR_IN	:= $(LATENCY-COLLECTOR)-in.o

export CC	:= gcc
export LD	:= ld
export AR	:= ar
export PKG_CONFIG := pkg-config

FEATURE_TESTS	:= libtraceevent
FEATURE_TESTS	+= libtracefs
FEATURE_DISPLAY	:= libtraceevent
FEATURE_DISPLAY	+= libtracefs

ifeq ($(V),1)
  Q 		=
else
  Q 		= @
endif

all: $(LATENCY-COLLECTOR)

include $(srctree)/tools/build/Makefile.include

# check for dependencies only on required targets
NON_CONFIG_TARGETS := clean install

prefix ?= /usr/local
sbindir ?= ${prefix}/sbin
config		:= 1
ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
 config		:= 0
endif
endif

install: all
	install -d $(DESTDIR)$(sbindir)
	install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir)
ifeq ($(config),1)
  include $(srctree)/tools/build/Makefile.feature
  include Makefile.config
endif

CFLAGS		+= $(INCLUDES) $(LIB_INCLUDES)

export CFLAGS OUTPUT srctree

$(LATENCY-COLLECTOR): $(LATENCY-COLLECTOR_IN)
	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(LATENCY-COLLECTOR) $(LATENCY-COLLECTOR_IN) $(EXTLIBS)

latency-collector.%: fixdep FORCE
	make -f $(srctree)/tools/build/Makefile.build dir=. $@

$(LATENCY-COLLECTOR_IN): fixdep FORCE
	make $(build)=latency-collector

INSTALL		:= install
MKDIR		:= mkdir
STRIP		:= strip
BINDIR		:= /usr/bin

install:
	@$(MKDIR) -p $(DESTDIR)$(BINDIR)
	$(call QUIET_INSTALL,latency-collector)$(INSTALL) $(LATENCY-COLLECTOR) -m 755 $(DESTDIR)$(BINDIR)
	@$(STRIP) $(DESTDIR)$(BINDIR)/latency-collector

clean:
	$(call QUIET_CLEAN, latency-collector)
	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
	$(Q)@rm -f latency-collector fixdep FEATURE-DUMP
	$(Q)rm -rf feature
.PHONY: FORCE clean install
+30 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

STOP_ERROR :=

define lib_setup
  $(eval EXTLIBS += -l$(1))
  $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
endef

$(call feature_check,libtraceevent)
ifeq ($(feature-libtraceevent), 1)
  $(call detected,CONFIG_LIBTRACEEVENT)
  $(call lib_setup,traceevent)
else
  STOP_ERROR := 1
  $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel)
endif

$(call feature_check,libtracefs)
ifeq ($(feature-libtracefs), 1)
  $(call detected,CONFIG_LIBTRACEFS)
  $(call lib_setup,tracefs)
else
  STOP_ERROR := 1
  $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
endif

ifeq ($(STOP_ERROR),1)
  $(error Please, check the errors above.)
endif
Loading