Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp475468lqs; Thu, 13 Jun 2024 16:33:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIcHJk+wKbe+W3Fr7XPPZktz60rN36vnSB/F06YCDOyrItjn7GKmeDtqJrunBQNUDVs9WovUhKpA3ZTwYeL/mRyQxEosHOHnqJlYogiQ== X-Google-Smtp-Source: AGHT+IEEJIl44sVxkzZ6kDndD+5tYYwOktUkkMaQxaaqfi26pPAIf8DMQnHs7L7O1BGkb5hgwXfg X-Received: by 2002:a05:6a20:3943:b0:1b5:ad0b:50bf with SMTP id adf61e73a8af0-1bae82b5d22mr1381139637.51.1718321632012; Thu, 13 Jun 2024 16:33:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718321631; cv=pass; d=google.com; s=arc-20160816; b=l3yj7EWza1eHeLNO+aelngfsl04WdIq3O/i7jGohE336QTyEqEDc5sqWhfVdTlpN6s Vdc2TsDJTrNQGpKR6cxXWmKIxzec7ZJJZFn+VTQWG6jBg0CKQJodqRP/acC+1kw4nIi8 +8PjxZxiFpm66CGPj1Meo+hNaqPGs6254YLocFlXFGItQruB6YXyErpYIQhbFLIhlNDF m2ar/ZiPwxQbd8x1sWo/MYqUBRTMlDYkvhUIWKWJsRpTzCCn+tw3DOsCpcS7JxvhkF8Q pVyWerkXi9U9UmRDH8R4i2yuC9ESmhWQrjGqrAglBxpxLrk94fHcjzMx4V7FHuNDd0dI TFcg== 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=VsC80hpqUOVrh72YOJDioHn4WeJ5/uS/HucL7CDuoyM=; fh=Bw3PsECmZ4/ICOIsL6hFfUS73Sf7E74EcAVHnjP4tac=; b=pWaDLxI/St7gGw2LpMBDHWcBwgjw41vRny1elAlNeIa21cDBn2nXuOCZvZKzlUMEyT 8cgkh/QMUD8HgigqgjwsE4ZhrSwJLfg6x0KfMvblpbk1gxd10YwxJswQSLFvpyV8jRZ8 XZW0eQNsks9CGVHq6krMItt4FvRXIXCkWOfhIIY364grOouau0BX0rXx89qY4gvD5FcI p6N/VMtWa87lKZoXlevFP9FCWNQeXYXJI8/Bb38+G41+f+FXTx+3UXPS+TgFiXMLlBq+ 0aWThBAuSUvDLK0R4NvjiWpoE3q33J/bT0/mBNJuyYdVE4GynYvA6Ug1OO49Aks71hfZ OGSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XAIjzW1n; 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-214103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-705cc9665edsi2477994b3a.126.2024.06.13.16.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 16:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XAIjzW1n; 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-214103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214103-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9EFEC285B75 for ; Thu, 13 Jun 2024 23:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9174D157E7D; Thu, 13 Jun 2024 23:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XAIjzW1n" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 0EFEB157E69 for ; Thu, 13 Jun 2024 23:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718321513; cv=none; b=defTcu4y2Hw/Dh909e4DHBF7gmqVI6ZEK1qB4Nl2cEUi8+Jk9J/eYuiMtOJTLXZEzlGrG7GDhhQ+4I1hW7i2XcJydjamtNZffZTVXKjHxwN07AKO2ltxnaiYVfabh4qssyLtpgAdiHe8ltmjjjQ/V2pRdCtJz1KyVlxNj4tdAGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718321513; c=relaxed/simple; bh=YCtNNA8v+ohwBpi9Rus0CYVSC7ZO/eTuaCLvVJt5XpM=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=NGmolq7L4nRa3uauaKV91en9SeVkAxKCFlmVO41API22RyeGqqxgo1yUw04wj76sGkD9kg9I5AXGVIuTkQzy25lCUf99B+LV5K26Q2NgGH5CFAg3vAWkvATwZ050nhqfn2lswUlSA6IVbH/tc+ntFNZaZVL8bI0WLtoOx9sIy9g= 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=XAIjzW1n; arc=none smtp.client-ip=209.85.128.201 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-yw1-f201.google.com with SMTP id 00721157ae682-62a3dec382eso17491947b3.1 for ; Thu, 13 Jun 2024 16:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718321511; x=1718926311; 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=VsC80hpqUOVrh72YOJDioHn4WeJ5/uS/HucL7CDuoyM=; b=XAIjzW1ncKog4oWEFMl6ZwB2pkG2xTX6RIFqdXE8szl9fWK2oDQ/gW7V7gCXlstkCP 14kJ5fFiVljOqDwGaAvQrtp8A9jh020dt6GgMfh/g/oYbPInYm7gq/kbBuxiJFZCnPRp 4ONYWkfdLaPehuuOllngc77Bc0/dclB0GuorHCUCVHr1Ph+Cb8fX+ThYPV7YvRyiJu73 ZgXH88m933FXbTJiYBVWyjnQfbwPNzkIT22wVSswq5eLvpqbF/njpxsMdyHgpbqiS0MV 5WzwIHsF9eL+0RpdJxxdu/S8SNgzZqjGUhoZV8gQzGQbBgp7W2vGq64X9Ff+DQOXZTX0 rdwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718321511; x=1718926311; 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=VsC80hpqUOVrh72YOJDioHn4WeJ5/uS/HucL7CDuoyM=; b=iDAyMGateclo/EW/mDQqRwfmh7wh6ks4yjJmXLVJqmcLMDlWX7k2mQEPCeb3hVXI6M UdOXWJqFEA6dQs62bmlLuF4tGHKYdGAUTeoOt55gKxrk006pmR3vO9eiMtuuBZtL+bmT kezUKMfsm1H1K7+275pb4HW/kz+otSktdTlEgQbssj+NhzgesAKE7V9yuUjBRwWIKyoh 9Qi72g31Y0LknYFs3uA50wUSeJ37oWr7pMBF2paZ+mfrEo4ae46J+OWSIeG5mVkEinsk R3HYp7T/+/fCrBM1KeSzDt/9Rs/gyIQH4Mzncr3SQ+Usf27O/t4J5OPHvaN5ZTolg9Fv 4g1A== X-Forwarded-Encrypted: i=1; AJvYcCVaWxa9Tc8RdFSBd7p5G4p4GwAJAkslxgSOO58K7aIPh+nIZYmpXzX+CRHJB6jB4VFT7ap7IcJsvxe11Sr5kPvkJ3zAb/sx2HNKCPjt X-Gm-Message-State: AOJu0Yz5lg1XbxdmzzRmC0SppqwhhecJMRL/o4LMUP342/OUhmePZsAT /PzgYl+ARzrvqcSPUE/9nJL7jcjzlKbrxAearhIPIfR4q+ACB1iBGeggygK7hw5jAHUeuk05NBF JkpNOHw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:4b12:b0:620:32ea:e1d4 with SMTP id 00721157ae682-632015b69f0mr4076157b3.0.1718321510936; Thu, 13 Jun 2024 16:31:50 -0700 (PDT) Date: Thu, 13 Jun 2024 16:31:19 -0700 In-Reply-To: <20240613233122.3564730-1-irogers@google.com> Message-Id: <20240613233122.3564730-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240613233122.3564730-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v3 5/8] 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 Reviewed-by: James Clark --- 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 9fa69dd0b472..4a3c000b9845 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.627.g7a2c4fd464-goog