From nobody Wed Feb 11 06:31:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2A7D54BDD; Fri, 8 Mar 2024 17:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709920261; cv=none; b=hK6LGzm3+RzwXOMdmHIfSaIAIihFhtAz+l31wCnRz73H8I9icct4vDgTTfB7Qqajw4Hf8mb/ZivKSnZjbsOcc7Y7LKLa4PgvdfVeD/fI9lPwA0gasFGTKB0opdM+F/adQ0Ny2G9Kh8KvKNvP01E4DfMCcGupdHUgOt35UZZe9js= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709920261; c=relaxed/simple; bh=8xpc/axsp72plSKaCPH3+hOrfvbTeluipeAKh/UkzdI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jk/dbtRkonduJ7AafBwfhWsD7ghSeQX+x1QL+ZE0j6IDr4V7BMBKpKnUOCr3tjFs9WFksE0Z3TyukGjIpWeGGY5UmSVtFF3RL6S94kL9gcrGxAVKSI0+BSfF6qIGcjYz+Rtb5YGSIC7kzmt6hCEz/3U3wN3GCWQE7sS/a71u0Fk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZhNN5zWY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZhNN5zWY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3776C433A6; Fri, 8 Mar 2024 17:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709920261; bh=8xpc/axsp72plSKaCPH3+hOrfvbTeluipeAKh/UkzdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZhNN5zWYs38TBT7S7W7Dw6E+W7sFfwwY5CXk9o+kZwRfR6vNHEh37mElNvMmEzXri 3E4kEKjokQRPYP2CqHd6eZNHfGIQrk2bm7Rs3+gBx0XR6RD13lZ9m4nDguE111fKZb FLRD92Kc91wu9d6iV4STN+S2g4Qq4GyDT5kl5Bd6so8BNe6keekNsjh7Yd09KOFb/F TjvM0N60Mkb8ixpweKqEI4JGu8RhBYA/lF83LfxdfHfLFHaJ5FwrETg37AbtKRC4kk oEya8C7C5eiDNRr6738guWI9RJQ+s5y/ZeTDvsM0u2S5ip1A7qCWHCkuODOegbm5th 8kRSuS5ySSetg== From: Daniel Bristot de Oliveira To: Linus Torvalds , Steven Rostedt , Arnaldo Carvalho de Melo Cc: Daniel Bristot de Oliveira , Josh Poimboeuf , John Kacur , Namhyung Kim , Jiri Olsa , linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] tools/tracing: Use tools/build makefiles on latency-collector Date: Fri, 8 Mar 2024 18:50:43 +0100 Message-ID: <6f2b86be6286d91ed5fd8e36ec54e07a908cc468.1709914259.git.bristot@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use tools/build/ makefiles to build latency-collector, inheriting the benefits of it. For example, having a proper way to handle dependencies. Inspired on perf and objtool. Suggested-by: Linus Torvalds Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/latency/.gitignore | 1 + tools/tracing/latency/Build | 1 + tools/tracing/latency/Makefile | 48 +++++++++++++++++---------- tools/tracing/latency/Makefile.config | 28 ++++++++++++++++ 4 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 tools/tracing/latency/Build create mode 100644 tools/tracing/latency/Makefile.config diff --git a/tools/tracing/latency/.gitignore b/tools/tracing/latency/.giti= gnore index 0863960761e7..11490d9da0b3 100644 --- a/tools/tracing/latency/.gitignore +++ b/tools/tracing/latency/.gitignore @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 latency-collector +FEATURE-DUMP diff --git a/tools/tracing/latency/Build b/tools/tracing/latency/Build new file mode 100644 index 000000000000..0ce65ea72bf9 --- /dev/null +++ b/tools/tracing/latency/Build @@ -0,0 +1 @@ +latency-collector-y +=3D latency-collector.o diff --git a/tools/tracing/latency/Makefile b/tools/tracing/latency/Makefile index 40c4ddaf8be1..3a2b5e8f5997 100644 --- a/tools/tracing/latency/Makefile +++ b/tools/tracing/latency/Makefile @@ -1,24 +1,38 @@ # SPDX-License-Identifier: GPL-2.0 -# Makefile for vm tools -# -VAR_CFLAGS :=3D $(shell pkg-config --cflags libtracefs 2>/dev/null) -VAR_LDLIBS :=3D $(shell pkg-config --libs libtracefs 2>/dev/null) +export srctree :=3D $(abspath ../../..) +export CC :=3D gcc +export LD :=3D ld +export AR :=3D ar +export PKG_CONFIG :=3D pkg-config =20 -TARGETS =3D latency-collector -CFLAGS =3D -Wall -Wextra -g -O2 $(VAR_CFLAGS) -LDFLAGS =3D -lpthread $(VAR_LDLIBS) +FEATURE_TESTS :=3D libtraceevent +FEATURE_TESTS +=3D libtracefs +FEATURE_DISPLAY :=3D libtraceevent +FEATURE_DISPLAY +=3D libtracefs =20 -all: $(TARGETS) +latency-collector: =20 -%: %.c - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) +include $(srctree)/tools/build/Makefile.include +include $(srctree)/tools/build/Makefile.feature +include $(srctree)/tools/scripts/Makefile.include +include Makefile.config =20 -clean: - $(RM) latency-collector +CFLAGS +=3D $(INCLUDES) $(LIB_INCLUDES) + +export CFLAGS :=3D $(CFLAGS) + +latency-collector: latency-collector-in.o + $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $(EXTLIBS) =20 -prefix ?=3D /usr/local -sbindir ?=3D ${prefix}/sbin +latency-collector.%: fixdep FORCE + make -f $(srctree)/tools/build/Makefile.build dir=3D. $@ + +latency-collector-in.o: fixdep FORCE + make $(build)=3Dlatency-collector + +clean: + $(call QUIET_CLEAN, latency-collector) + @find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -= delete + @rm -f latency-collector FEATURE-DUMP =20 -install: all - install -d $(DESTDIR)$(sbindir) - install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir) +.PHONY: FORCE clean diff --git a/tools/tracing/latency/Makefile.config b/tools/tracing/latency/= Makefile.config new file mode 100644 index 000000000000..5100d89346ab --- /dev/null +++ b/tools/tracing/latency/Makefile.config @@ -0,0 +1,28 @@ +STOP_ERROR :=3D + +define lib_setup + $(eval EXTLIBS +=3D -l$(1)) + $(eval LIB_INCLUDES +=3D $(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 :=3D 1 + $(info libtraceevent is missing. Please install libtraceevent-dev/libtra= ceevent-devel) +endif + +$(call feature_check,libtracefs) +ifeq ($(feature-libtracefs), 1) + $(call detected,CONFIG_LIBTRACEFS) + $(call lib_setup,tracefs) +else + STOP_ERROR :=3D 1 + $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-d= evel) +endif + +ifeq ($(STOP_ERROR),1) + $(error Please, check the errors above.) +endif --=20 2.44.0