From nobody Fri Dec 19 07:42:17 2025 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 757B47E572 for ; Sat, 29 Jun 2024 04:54:49 +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=1719636890; cv=none; b=m/kjeaaPZQoDFw1vlDxX1F/NvvrTYCeBaq2aT3SgsyYSvzJBIO1WrKBRoNRTZKfv9h5O4tHgnaJrCNz6QJXTptY0DtqvUAkEhzMJgSt9oAVHbdfLTvL1ivCheUOlux7Hco2AeJU0kKJVaSr8JIA011GdeQEvG1aAbm53zur6lQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719636890; c=relaxed/simple; bh=dOQwYv3BZA6mYJCibVSPV46DzsPrealaMqGBbxPyb4I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Yq/bYHcB93MsaA1hQWhlMiYLn1wLwi6argAaoM7IoJlqumKe3i2AYFYPn3oMxr+2CsG9F5ENeLGlHDfIuN+BhL9KJ1r8fWd8KqLjCHmpy1jEveZOH8ltEmaNAN7bqRcPE7z7qGA9Skl8OGwQ2D141Q+n3HQrDyGoeokLmW/qeb8= 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=O11FIlvK; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O11FIlvK" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e033e353528so2017363276.0 for ; Fri, 28 Jun 2024 21:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719636888; x=1720241688; 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=FW0UxSAdQlawsPFFt7Tz92UReMCnYyyYMlomigdWz2g=; b=O11FIlvKyuHDJeOgM8hpYwwGgKftxCQ2RKxUtec1EKQUBuOxPLVsif4+zHHChebclk ipk87LKRn8HPA091AOOYKO1L3OPbdQyFX1EhgEwggzeinhTY0b3t5Gl6cmywGySDtsCG QzL2AT9PnrkvbyyqBiycrl1PmRD02XlDdD/6sLfmhrEFNaafdIAnj24wOqC5msHQlwS3 f3Oj7/Zr7F0Al7hhm7YSWP0COqu0TQVU9WeX4JyMYFGl9NN2J9RvBialFukreDcbcviZ Zskh26VU8JLMTbrSzKt/Di8vcyZ7NhgMy2tz+eIc4H7G3zEpAnTJiqVbTjD7bPnhPbci ckMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719636888; x=1720241688; 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=FW0UxSAdQlawsPFFt7Tz92UReMCnYyyYMlomigdWz2g=; b=Fpck9vYaB0TFEJ1BSDr3ymTMrW5pw/RZGHy72LpuWhRKXT9IMk7p/6R7HURzKNMU1B UtTkhJ5KX0XIw1OKG0WYu/aPM3tzu5L34S2UOxeAPdxXeE8F09NTqMoN3wQ6KJawcqHj grs05HX4kXiwJ53KNpcIp1Y+KuponWOmBTNj7aXTMDTp7EVcsCj1iqH0WSXIPmmz0SHI QgaSwY7XOGgdjTpX5Yv1eDYgXQNg4JRmhqjxup5bGcOj8znzxQV5UfAZn0Q7UMQvyL82 jdsVjISswmYVfzbS7Xz25h5iG0cQpyY6UeQ6xRcZr6mG3l+AuoWpu8UUJD23PTlYGPbE /n4A== X-Forwarded-Encrypted: i=1; AJvYcCX/Nd7gw7Q/v60crPfjZQuHLg86ETuPtxVOEoLK/q8Hhl2xrrx4SJNPLz5m+OQAbl9Y31MTkqOU/E0OpM2dWV58sRBjr1we0sLuJqUp X-Gm-Message-State: AOJu0YxHFbAjjFnXmYn8MDXmH4a1UxKDW3QUs2ZkfBFheERhExKCw9lY xSp0XNeNMB4Nw6kcGbCE+Tk4E5SkvtwMo+F/yU3ywEErB8ETERervpOKK4mNwTfb4Jjca2I73eM pxkQKJA== X-Google-Smtp-Source: AGHT+IEWALptJNVip01y1rVwK0rhc28W4Rx/uGav2zwXL5e2P7GlQvYhrejiAYPPfwiLQM6W3tkvBTbmc7YC X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:f9fe:7acd:496e:4edb]) (user=irogers job=sendgmr) by 2002:a05:6902:1241:b0:e02:b48a:cb78 with SMTP id 3f1490d57ef6-e036ec5a9fcmr390276.12.1719636888387; Fri, 28 Jun 2024 21:54:48 -0700 (PDT) Date: Fri, 28 Jun 2024 21:53:40 -0700 In-Reply-To: <20240629045350.285243-1-irogers@google.com> Message-Id: <20240629045350.285243-19-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240629045350.285243-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Subject: [PATCH v3 18/28] perf annotate: Use perf_tool__init 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 , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Nick Terrell , Nick Desaulniers , Oliver Upton , Anshuman Khandual , Song Liu , Ilkka Koskinen , Athira Rajeev , Huacai Chen , Yanteng Si , Sun Haiyong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use perf_tool__init so that more uses of struct perf_tool can be const and not relying on perf_tool__fill_defaults. Signed-off-by: Ian Rogers --- tools/perf/builtin-annotate.c | 42 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index c0685d2c8de1..598ab854b9f3 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -686,28 +686,7 @@ static const char * const annotate_usage[] =3D { =20 int cmd_annotate(int argc, const char **argv) { - struct perf_annotate annotate =3D { - .tool =3D { - .sample =3D process_sample_event, - .mmap =3D perf_event__process_mmap, - .mmap2 =3D perf_event__process_mmap2, - .comm =3D perf_event__process_comm, - .exit =3D perf_event__process_exit, - .fork =3D perf_event__process_fork, - .namespaces =3D perf_event__process_namespaces, - .attr =3D perf_event__process_attr, - .build_id =3D perf_event__process_build_id, -#ifdef HAVE_LIBTRACEEVENT - .tracing_data =3D perf_event__process_tracing_data, -#endif - .id_index =3D perf_event__process_id_index, - .auxtrace_info =3D perf_event__process_auxtrace_info, - .auxtrace =3D perf_event__process_auxtrace, - .feature =3D process_feature_event, - .ordered_events =3D true, - .ordering_requires_timestamps =3D true, - }, - }; + struct perf_annotate annotate =3D {}; struct perf_data data =3D { .mode =3D PERF_DATA_MODE_READ, }; @@ -864,6 +843,25 @@ int cmd_annotate(int argc, const char **argv) =20 data.path =3D input_name; =20 + perf_tool__init(&annotate.tool, /*ordered_events=3D*/true); + annotate.tool.sample =3D process_sample_event; + annotate.tool.mmap =3D perf_event__process_mmap; + annotate.tool.mmap2 =3D perf_event__process_mmap2; + annotate.tool.comm =3D perf_event__process_comm; + annotate.tool.exit =3D perf_event__process_exit; + annotate.tool.fork =3D perf_event__process_fork; + annotate.tool.namespaces =3D perf_event__process_namespaces; + annotate.tool.attr =3D perf_event__process_attr; + annotate.tool.build_id =3D perf_event__process_build_id; +#ifdef HAVE_LIBTRACEEVENT + annotate.tool.tracing_data =3D perf_event__process_tracing_data; +#endif + annotate.tool.id_index =3D perf_event__process_id_index; + annotate.tool.auxtrace_info =3D perf_event__process_auxtrace_info; + annotate.tool.auxtrace =3D perf_event__process_auxtrace; + annotate.tool.feature =3D process_feature_event; + annotate.tool.ordering_requires_timestamps =3D true; + annotate.session =3D perf_session__new(&data, &annotate.tool); if (IS_ERR(annotate.session)) return PTR_ERR(annotate.session); --=20 2.45.2.803.g4e1b14247a-goog