Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp641733lqp; Wed, 12 Jun 2024 11:36:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxbeM+jK+izTbsQLvKKBRdN1iL3m9MSSwCZfrUF9W4F4DsUoRLZpc/ZkuZA1fFPufej1m4o5DCIQlCxd2yl3hpYgOuj/qhq3nVVBQOGQ== X-Google-Smtp-Source: AGHT+IHQvsBNKZDv3dKDyp3KyfCDUzJKc0t+hxH1HD9uqNvjUFX9Ng8kiLbo1fXRX3VECd736Rrh X-Received: by 2002:ac2:5b1e:0:b0:52c:886e:63e0 with SMTP id 2adb3069b0e04-52c9a405e5emr1321040e87.69.1718217387934; Wed, 12 Jun 2024 11:36:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718217387; cv=pass; d=google.com; s=arc-20160816; b=eSHW5kFPChh/8eyVZUDTO8RqvFSPeqNww1ND9/cUhumy/GzTvB0VfsGrHZet6pG8KS EKmQg/7hxR9dUeUCWSOB8RzNlD6GcviknlSTS4k6M91tSyJWcuQwvAiYtSDQJPrNhnJq q2tSe1Pc57yiTksp2lP4NYFUVi0ojsCUpuPCDIFXUX/CVEc5I1kl1FPHI6hk2BRklxZ/ pH5cp7KxGQYRI+gV1eaXD70NWbh1TxgWslHhDZ9B2PP4eugm5g666ql95UBb56PasGQe JLKnQ1kWRjB2FFbZRphFXIf5An796Izy1pFInDEqISfPXugSpbz+ls83tERoKOhn8FFJ S6Jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=hxFca2akLEi/c6aeiWryG3twAj/x8mJ+5CcLXE4nJMw=; fh=dI24n+5+gmLd3KkjdkhoooL8iUlCDNCKLMafskMCmRw=; b=k88LyHaAMlWsZtrhh3RawV1IXtFZWvmHNsjxJ39sx80k4Tm1oaK1PEdWdm4Nyxy5NW iiWBhgCsL61jTpdMCFTpK3DVEgrXw0Rbt1WgYvY1w6UuxyHnJwT+r2NEEQXDRnpTQfA7 1L/iH7+U2Wa49NrLihV6kmvUCIJ9ypfzS/WFzlU1QmluCWaj9m5/T/FwRv0YzjcgIKdo SUPstifg2yJgrQjfEAz8qHTmtRqorT+HsMSNZoufGoB3nvb0TrHPAhKFsx4iF6uXTAUW Vv36rqNcKNz40Z8E59a9yCre/NK29VMdZqI/At3EPDfj5i9j85fTsdPenKu5qrIF/g5e /0aQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wBAfei2k; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-212089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57caad01cecsi1098139a12.230.2024.06.12.11.36.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 11:36:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wBAfei2k; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-212089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 39A981F24587 for ; Wed, 12 Jun 2024 18:36:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34170823CA; Wed, 12 Jun 2024 18:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wBAfei2k" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 410A3823AC for ; Wed, 12 Jun 2024 18:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217220; cv=none; b=YjnSUWX0RqMzmAESvzeJOcnv05OLVhIbq0kKVtNkslg4dgx8+HIw3S5JRj9VTVZVc/xjml4ZwQB53dud6HT2VrIZj8x8/HuUNFHpZEXhEJo9Igqz41DWWcpBaNnuXpxtY1ilgIEPnsjzGwTtSgOCuc6lH4Hy7425rFZzoSw4f+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217220; c=relaxed/simple; bh=GW3F5bRDidIfzFfzx2XH9TZgHygHBWW2YgjI9x1i9kA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=stpJkg0vAk80CV7KzdeChmWk9TdgioYShhS1fGbYGz4zHhrHYOQB/24GV/QXMWhiAAVyCSC8X4j6rZjjrEup+vl4khD0FxRIlYXMvzoszFIjsi+IgvJ+EsWGqvUPMCsXmT9yUUucLE9yVMWf6mUxLu4a9rf8aB1emzK7S2hURCs= 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=wBAfei2k; arc=none smtp.client-ip=209.85.219.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 Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dfdddb9b425so244674276.2 for ; Wed, 12 Jun 2024 11:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718217216; x=1718822016; 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=hxFca2akLEi/c6aeiWryG3twAj/x8mJ+5CcLXE4nJMw=; b=wBAfei2kL1ZcoeHo2BHZAsPPT1zDP5xxnU6YYpceSEzBFi7SBKeExgVLw0n+LAhgqL ekC+59Nvwt5+iMo05pAagN5j5k+BkZQqUiH1hUcfyLxpi8QTPTSTuzemGfa4/8kdV/2D /21CWctfBEE1zX6ZTbrg/p9pSmGE7LozNvRQg7Kr0WMCep7AWEsnYk6vwwubXp2ft1CF ORBSVxUQIo0qYo9tLnVDk2NMJuksDau5vpMvBmbh08RNRId1YVUbmaW2rLdlTeJEUhpB 8DXegtwm1hB2qCQXlbjiwdIANggpt0Fx0YrTb8X660HCXQvz6W2k/j3yHoqEI8bE8nCt /6vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718217216; x=1718822016; 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=hxFca2akLEi/c6aeiWryG3twAj/x8mJ+5CcLXE4nJMw=; b=FHQTshzgrmPwU5bb/h0+fVifqhYrALYx1lUfHWVU5xALJthiAb4OqCOInpuUeDumHN Cp9HiCMyxRLwTYyYHKWb2ntkHz1J6CHjMxyNsj4KDHBTgxZ4YxiIeHG5uR1piKBzWuCw +eeQV0EXPofW8nkmEDluI6CqkjwP8Zl2Xjx+EHu2Wc88GbuItP6sbwddBhQ5KfFnl8F+ Sn/DDaVinBV0jyUQy+E1WDQ2fLVVvo4oyjjlmlgssIxN4gQdDZjhsTnGnJSlljWgYxtL TrLtO6VOBIBMAgNOC/zMHy3x9jRDkyatdn6oTpgqYPJWAXXahKpMMOy/Jjkj/G6rfWXO kEMA== X-Forwarded-Encrypted: i=1; AJvYcCUiqb498gximWiUHaojTuJ73JLmqKGXB/fK8pzf0or/z2zO14QP5WCJ1lxvfglE6tYBNv+NloplkuB0GGLNfSAFvyFItu2wOaHWFVOc X-Gm-Message-State: AOJu0Yz8BNmpLxx7FkAaevR84HsCum9dUhA/w/bjP+I2APkRg0GhJsBZ vaTv1g31nCWRIe5JYZxIQ86rcMoijRgfpHLlo0axcJRvQLDH6ihUuTonyEm/GZC54cQuCigzYhB IFqCfCg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:959d:4302:db0e:d12a]) (user=irogers job=sendgmr) by 2002:a05:6902:2b03:b0:dda:c57c:b69b with SMTP id 3f1490d57ef6-dfe62f13456mr822488276.0.1718217216102; Wed, 12 Jun 2024 11:33:36 -0700 (PDT) Date: Wed, 12 Jun 2024 11:32:02 -0700 In-Reply-To: <20240612183205.3120248-1-irogers@google.com> Message-Id: <20240612183205.3120248-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240612183205.3120248-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Subject: [PATCH v1 4/7] perf bench: Make bench 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=20Roy=20Baron?=" , 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 Content-Type: text/plain; charset="UTF-8" Make the benchmark code into a library so it may be linked against things like the python module to avoid compiling code twice. Signed-off-by: Ian Rogers --- tools/perf/Build | 4 ++-- tools/perf/Makefile.perf | 11 +++++++++- tools/perf/bench/Build | 46 ++++++++++++++++++++-------------------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index fddd45ab35b4..2787f5630ff7 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -1,4 +1,4 @@ -perf-y += builtin-bench.o +perf-bench-y += builtin-bench.o perf-y += builtin-annotate.o perf-y += builtin-config.o perf-y += builtin-diff.o @@ -35,7 +35,7 @@ endif perf-$(CONFIG_LIBELF) += builtin-probe.o -perf-y += bench/ +perf-bench-y += bench/ perf-test-y += tests/ perf-y += perf.o diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ecf0586e9061..f9709718cb83 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -425,6 +425,9 @@ endif export PERL_PATH +LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o +LIBPERF_BENCH := $(OUTPUT)libperf-bench.a + LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o LIBPERF_TEST := $(OUTPUT)libperf-test.a @@ -438,7 +441,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif -PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) +PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -740,6 +743,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare $(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< +$(LIBPERF_BENCH_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-bench + +$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(LIBPERF_TEST_IN): FORCE prepare $(Q)$(MAKE) $(build)=perf-test diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build index c2ab30907ae7..279ab2ab4abe 100644 --- a/tools/perf/bench/Build +++ b/tools/perf/bench/Build @@ -1,25 +1,25 @@ -perf-y += sched-messaging.o -perf-y += sched-pipe.o -perf-y += sched-seccomp-notify.o -perf-y += syscall.o -perf-y += mem-functions.o -perf-y += futex-hash.o -perf-y += futex-wake.o -perf-y += futex-wake-parallel.o -perf-y += futex-requeue.o -perf-y += futex-lock-pi.o -perf-y += epoll-wait.o -perf-y += epoll-ctl.o -perf-y += synthesize.o -perf-y += kallsyms-parse.o -perf-y += find-bit-bench.o -perf-y += inject-buildid.o -perf-y += evlist-open-close.o -perf-y += breakpoint.o -perf-y += pmu-scan.o -perf-y += uprobe.o +perf-bench-y += sched-messaging.o +perf-bench-y += sched-pipe.o +perf-bench-y += sched-seccomp-notify.o +perf-bench-y += syscall.o +perf-bench-y += mem-functions.o +perf-bench-y += futex-hash.o +perf-bench-y += futex-wake.o +perf-bench-y += futex-wake-parallel.o +perf-bench-y += futex-requeue.o +perf-bench-y += futex-lock-pi.o +perf-bench-y += epoll-wait.o +perf-bench-y += epoll-ctl.o +perf-bench-y += synthesize.o +perf-bench-y += kallsyms-parse.o +perf-bench-y += find-bit-bench.o +perf-bench-y += inject-buildid.o +perf-bench-y += evlist-open-close.o +perf-bench-y += breakpoint.o +perf-bench-y += pmu-scan.o +perf-bench-y += uprobe.o -perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o -perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o +perf-bench-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o +perf-bench-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o -perf-$(CONFIG_NUMA) += numa.o +perf-bench-$(CONFIG_NUMA) += numa.o -- 2.45.2.505.gda0bf45e8d-goog