From nobody Thu Dec 18 05:34:36 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 1DF011957F8 for ; Mon, 12 Aug 2024 20:48:04 +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=1723495686; cv=none; b=E1mu9UVF9kQdpwlpice6ElLF0KFVbbkvNVhaCYXbg6uW2zVmxf7TFyHF0TCeupLmyi2KK+4oYCv3Yj6Gr51Yo6xDG3dFkl4JcS6qWPKMxTzcdGlqi44PThwfTQHaSo6C2SA6ooo5HSqMsAW+YHlmDDlFlt9ip+f9QI9dioJw8V8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495686; c=relaxed/simple; bh=b54MC+ntQ/UsxIu0AteN/AwjjxsXrg4DU7gP4POno/c=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=eIOEtKYYPuAjNnrUoW7SoYkY3mFIBWCFO0cS3mi+tPOZr6SAbuQZ8Akh0BC1eIW/FLOrJuowqZDXGZMqhUOfC/ipjeSJudPBk/f4rNIF0nrCcORuOiCYfcUNkq14mWzSzezEfoI7aMxvu1n4dczsOIiIKaGB2zlz5HLqFfAssBU= 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=aaTbbxWD; 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="aaTbbxWD" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e0b3d35ccfbso6907920276.3 for ; Mon, 12 Aug 2024 13:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495684; x=1724100484; 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=h4IuJMX0YASP6mDRB5sblKvDCNi7GxHX4wO+9+ISAHw=; b=aaTbbxWDNUPwfmRc3+K3S0GPFXBjf/FO2F9OnRlalN5CVfpugAsQbTDEg+0A09jDBv 8ZBkPH9ZeWEPZPSv+Fy0AVz66tCrQeUXglLJwvDos27Y7e31zSulMFvL0azz35PCCbxL VdUKiToujYqLelDFJzzxAeGwT4wNY5AR7+0yoIrRtcanM0w9dhMxi2T/b97ZUuTAmA5q 8NRZ8QQuCq/zea21Xnt+hE/lu5GLs3VEKY7Pw2+VEmwlCvRPOaLYEwVZNB1OUt/J7o7w 7sFoNnQcMZO/EWn8B6qM2LJE+/aowrZOGbQ6tja12WfgmKYIv+Gchw8zAgJtVmeHTmbT O/PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495684; x=1724100484; 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=h4IuJMX0YASP6mDRB5sblKvDCNi7GxHX4wO+9+ISAHw=; b=e5bo+mL6ly3e9tolzAX0mJeXUDzoNoyfHskmkCY9tMbnrKdeY9r4sa6NEGtc8KeL3Y 433eY0kJh1GnvnMfVi72AnyiZm/ORTeePyoWyJbkYf0NwcefELX+kf1uWsFpNATApbzh po24DJMDv9Ps6Dgd18uXE7j6/xy7aUCb8kz9tMEM2XA48jjLRy0tDjY+MIn3uM8Rfm1F 7ofHQfuCSfqiT5PiXVW7hiAvfsuwVxFRciTgSdvs1V7JtTQcOlHO5x1WoXGSzCcurEKk DEdSR4TpxWS6c+3a5sgWDWxf/WEj0YT1G4VHf4MN9oxnYWTE4qF4nxL5mEdJ+vV11zMV KR6A== X-Forwarded-Encrypted: i=1; AJvYcCWNN/Q1J6hysIk+0rLuhwWwhOVFSnwl0KmuOUSrX6gKT8Eqrm0dytbr6+yKZ9Nu4TtNSrxvShIROWzYapbgkhGYVGEp8a4nf5HNfMp6 X-Gm-Message-State: AOJu0YxUuU3B1qeVQN+mOje9qS2P8bIZHt8yGfWe7n4Kjh77vBGJH+o+ x6hhBO9ruo42suvgLv1+q4k5nTOaSMBPzKNhRCuYxSTy0i4xbCODEeFQrS0lvXqB+KlP9WBeCQ1 0vAP9Cw== X-Google-Smtp-Source: AGHT+IENcikM/2xpbAI0+iXGHI86bo1OAG2rCZ1wxfc4b5c0Ca8mqN3x5IE3uLmAUHqZLRaOz95pxfCbyXVD X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:cec7:0:b0:e11:44fb:af26 with SMTP id 3f1490d57ef6-e1144fbbcb1mr64276.2.1723495683936; Mon, 12 Aug 2024 13:48:03 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:09 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-18-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240812204720.631678-1-irogers@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Subject: [PATCH v7 17/27] 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 cc65e6f8f4da..d6f6ba5a569d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -696,28 +696,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, }; @@ -876,6 +855,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.46.0.76.ge559c4bf1a-goog