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: 13697283 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F101514D294 for ; Thu, 13 Jun 2024 18:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718303559; cv=none; b=CQgA+lnB9AZuQIgpeyg2TtAwWP34ZZVB0S2gcl+PY4liQ0YllHL6v6o4FqUNVngHRHQ6lhTXS6qS3Qc+7a14g/LTr5KpBGCJNHI+16KVglTZh9cCUMiNi0fCRn9pn6x02Gbxh0krPfxRtcNumKNhGyR6hQ9N561YuAGxkYdnvQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718303559; c=relaxed/simple; bh=rFcy+S2+2TKAedCtBmi8koJqecDAqvQ96WMKLQwJCVE=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=U18bmvOEf9UK/NdVSAPes4aqMHhFjd+pc9TPabHOn2IS0+tj7ivfT6mlAibYwEPM9YpK/DgvuRzJSEUNRXzyFtDiJSRusSss43NO8kbT4DKNFIp+VxC6h+iqoKn/EV9Dnrb5a+rn9Ym7LITV9qhMA8liQG5y493sMBAghab7ApM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bvZnD5Pt; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bvZnD5Pt" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a1e9807c0so14498967b3.0 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=vger.kernel.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=bvZnD5Pt/gSg44y+hvvnuX8kWE5vzzpTWKnjtFcicJdborEWoD2Scvp7fNjN0CSO97 RiNGlYh3bRKR6O5dSRHFCeRrKHI/0cl2yAIw2YHEui2utLBAbtRWDH1ZFPU/XXUnJL0D H8Us0uKMxAQJ7vY5vpBdCNCKNzHGbZlKOGT0M7t2/uymcoZK48Ox04cnQQU6OAPE9Gzk xigha8RlZGGOtwB5426/GrK81ozIAHfWyV69io4vaeEUIIfnLAB4kq4GBqKGBpGA6BpN HV87DRVCWr64KuRq3qZ4hU4sXMrS7z+IRTmLD6l3WrB2Hqk5JbDff81Ykr7YgOE+uTKr R0yQ== 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=Sx6c3/pbjTxOtGdnNSOlWWWnGlwcc+bEn28ol0I2Byp8czrztZnfyvg+5qY5Jd4WOR BM3Bg8TCxpNliWVGli//ZBTUy/0riH79iIuuQ0rLpuwA4zalQTXesl3iQSr1K3gjIbJA viUOg16OHvKpmNzTIzTWdiPWv+I1/ilp0Z8IIjLuasZbADHRcZEmdBmixSCnKVPnJYn4 rhazlYmeU9M91I+K+wUYnnGVH5zwjj1MCu/AOv/Tm/aOEuC7UQlMV2iqmkZrdhvUJL6P tMt6rd4V2vgpBD4uV98UsBYLKZ6554ckoFrRBgVSqqObYE4vholxqA28O2jXG3p4lUuH JeaQ== X-Forwarded-Encrypted: i=1; AJvYcCUQIPJXVkk/bBVA/9OlrnURZG9nvd7wdM/pukugtDaOcTBb81derWHRuLdyyxOMyH35d1z1FUJwPAeEYO4etaoeGcL8 X-Gm-Message-State: AOJu0YwvAe6hxKgukoc1RRXyht7p6q29OBW+QTuX8PG3MXvfEc2y0jj3 5rAs7u6EjeW9B7tWVBw6QVTs3KmeXgQ1h9WWto9VgQh8jurJK2hiOU4u59E0cZBM5/1r1NaGvB8 0m9hwBg== 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> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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