From patchwork Thu Jun 13 18:32:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E140C27C4F for ; Thu, 13 Jun 2024 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=im/T5bx3d886GB1Dobx8OXEMt/lUNL/NQA1h1GjmXIA=; b=qIIpkpgRtIrHud omNjRYzIp5UM8LrkNIkpcL0nNz+fMRIl1Uw54KKBe13LSKF7NbQveKNEth/yvvpcubwNfQZzmoMP2 bVAwWoWa5OKx+DoH5fTItty3J2FrmwO1m5EFQyMLAyASS9unu2OyJwIyRTiqBs/nlBz2JzZVCZ2Kn wifpJgWp8ZFL/GsZF8w6UY1tlw2ToXnV7nm0aBBn6ciKG5GdjFiMb7clcXmfCKAyF8Uzxs3lHF8Sy gwvC7lZPv1rrCArG8zIoTfP2ObFLafmgjX4NScX2/gN4OrMv4+BCG2Q2ewUzhoPZwHlGwsYaAUCfi udF6qx5BGG7Yd/sz9N5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFg-0000000064O-2Np9; Thu, 13 Jun 2024 18:32:48 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFY-000000005wW-0Iqk for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:42 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-62a3dec382eso14768147b3.1 for ; Thu, 13 Jun 2024 11:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303557; x=1718908357; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=r+7hNL7GU/EnUYuEiQpshzYvHRCk9RdYS1NEyctZDl4=; b=JsfIPdxA0FNLWpYWljJQXb3pXBm8l+a4q0+40Kacw/xgx01AQa/+dWQZH4s45qBieb 8RRzS5doLCfA/sB0s59XF9LWTzdyECv/KkLSOi+j7M7CzICxj1q4mFQKautV2tWsOmuQ C70QOw3oJ2LaVZ9Syn3xSbDbI/RSsWTnmlYpgrbEJE7ErqmbnfnreM2SH3ysCROP5R71 gSVu25NMyg1q/2bxCK2J/bedKCSy1OUPsGvHz8MXzVI8hT99oonti89anY/kTyemRra+ gef8DX76O6TBEl5+w4UwxVePaK8SPrqvDCrUkrnRaT0d4nE+75zTJUbRcBRAiMoIDncW TCJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303557; x=1718908357; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r+7hNL7GU/EnUYuEiQpshzYvHRCk9RdYS1NEyctZDl4=; b=bPQtmCX+JLE87aJWs1c5dDYeKPxz8LgCgcXN/QhXaYggc1gN6mAveRhqK/U3s0apws T/EAz1nhggYzBkPKNgo1zzKCeQJ8HzE4V+aJpkawVm05cVfyrE72dlae9HpKqR6/h3eV /ikBWFEpILzhuQjwQO7ZTdRPLM7DUbqHKkDs+SCBPCYToajJiyMa2YxFbqbPWas/j1pl S84g8wmHXD/6lmmp3PHka/apIgrOmCaKmpF+PEiisIJEa0cjMUb12ehc88SG0o55SKAl Qq8hlpkhwnK1edaOKOLmFQQp2JdUWL5oQrA/MPt9Yn25Aspk81SegNkYn4K1nWU7qKNj jnzw== X-Forwarded-Encrypted: i=1; AJvYcCUEI8+41uz2uRWaeFKxb/l8cem9hmYGDxgpCYajoN2EaT4nRHid1jasydFYEpUckiEBm2s+Fv2BnhTFD+tKBvHbWbFXafsIna4nzDQgLSWa X-Gm-Message-State: AOJu0YzEe62NWkwzBhn6f438KqOj7JiXMubAUITuQRvzSR2PL1yN6M6e WmtMnDh6lXlgvRpZLeWloi/31OrY1DkfU0XfqfOJn8SilEKati7iX86nNaO8wdey3+ejNbR/RKq 2Fdh/CA== X-Google-Smtp-Source: AGHT+IFCwGZJ+MHw847shQCnxjAbFvUrO2l5A8duAsKiZMntbbdsMkpz9t0sclkdJolpJxOeRJ4x/wM7S3qu X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a0d:ea92:0:b0:630:47e8:f406 with SMTP id 00721157ae682-630be505814mr6038677b3.1.1718303556929; Thu, 13 Jun 2024 11:32:36 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:18 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-3-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 2/8] perf ui: Make ui its own library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113240_155597_DEC3060E X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make the ui code its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Build | 2 +- tools/perf/Makefile.perf | 10 ++++++++++ tools/perf/ui/Build | 18 +++++++++--------- tools/perf/ui/browsers/Build | 14 +++++++------- tools/perf/ui/tui/Build | 8 ++++---- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index b0cb7ad8e6ac..16ed1357202b 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -55,7 +55,7 @@ CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)" perf-y += util/ perf-y += arch/ -perf-y += ui/ +perf-ui-y += ui/ perf-y += scripts/ gtk-y += ui/gtk/ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index acc41a6717db..c5a027381c55 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -425,10 +425,14 @@ endif export PERL_PATH +LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o +LIBPERF_UI := $(OUTPUT)libperf-ui.a + PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif +PERFLIBS += $(LIBPERF_UI) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -729,6 +733,12 @@ $(PERF_IN): prepare FORCE $(PMU_EVENTS_IN): FORCE prepare $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events +$(LIBPERF_UI_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-ui + +$(LIBPERF_UI): $(LIBPERF_UI_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(PMU_EVENTS_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@ diff --git a/tools/perf/ui/Build b/tools/perf/ui/Build index 6b6d7143a37b..d2ecd9290600 100644 --- a/tools/perf/ui/Build +++ b/tools/perf/ui/Build @@ -1,12 +1,12 @@ -perf-y += setup.o -perf-y += helpline.o -perf-y += progress.o -perf-y += util.o -perf-y += hist.o -perf-y += stdio/hist.o +perf-ui-y += setup.o +perf-ui-y += helpline.o +perf-ui-y += progress.o +perf-ui-y += util.o +perf-ui-y += hist.o +perf-ui-y += stdio/hist.o CFLAGS_setup.o += -DLIBDIR="BUILD_STR($(LIBDIR))" -perf-$(CONFIG_SLANG) += browser.o -perf-$(CONFIG_SLANG) += browsers/ -perf-$(CONFIG_SLANG) += tui/ +perf-ui-$(CONFIG_SLANG) += browser.o +perf-ui-$(CONFIG_SLANG) += browsers/ +perf-ui-$(CONFIG_SLANG) += tui/ diff --git a/tools/perf/ui/browsers/Build b/tools/perf/ui/browsers/Build index 2608b5da3167..a07489e44765 100644 --- a/tools/perf/ui/browsers/Build +++ b/tools/perf/ui/browsers/Build @@ -1,7 +1,7 @@ -perf-y += annotate.o -perf-y += annotate-data.o -perf-y += hists.o -perf-y += map.o -perf-y += scripts.o -perf-y += header.o -perf-y += res_sample.o +perf-ui-y += annotate.o +perf-ui-y += annotate-data.o +perf-ui-y += hists.o +perf-ui-y += map.o +perf-ui-y += scripts.o +perf-ui-y += header.o +perf-ui-y += res_sample.o diff --git a/tools/perf/ui/tui/Build b/tools/perf/ui/tui/Build index f916df33a1a7..2ac058ad1a61 100644 --- a/tools/perf/ui/tui/Build +++ b/tools/perf/ui/tui/Build @@ -1,4 +1,4 @@ -perf-y += setup.o -perf-y += util.o -perf-y += helpline.o -perf-y += progress.o +perf-ui-y += setup.o +perf-ui-y += util.o +perf-ui-y += helpline.o +perf-ui-y += progress.o