From nobody Fri Dec 19 07:01:57 2025 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 136DE17E45E for ; Tue, 25 Jun 2024 17:26:44 +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=1719336406; cv=none; b=CRxg7D77aPFEARplKpbB24XvqmKVwYN8lbWW3Q9eGHxi0Kw5LsIK7dfnokTAygZpKeAyS7TiHe4/8G0Rw5APQvVSXs2TFMpUwbaQmfnc8/G4hzt7pn7gUVTeBY8f4iL1dHSq7oBQSFeQIVwzCB0hp4sdfWtJE5GEDwv9oBVUvvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719336406; c=relaxed/simple; bh=RFO7PSbSKcfjn2e7ecGFImKzioMgq51018O+b5jRqoA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=R/P+QzQv4LMkM7trfLdooHAkImWkVlz6XqdJqOviU/WkUwU3cfOVIAg/B2eu7q6jl7zjBoJ7n/3t2qdHM67UJyn6K/DinJ5pRDk2I9dHJtXr4I7axtha5oH0Uttb7N6tBiaoSNxBX4gZDiFDDptUVgxVoojkwUHppv0FBLhge+o= 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=iotnGEH3; 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="iotnGEH3" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62f43c95de4so132229197b3.3 for ; Tue, 25 Jun 2024 10:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719336404; x=1719941204; 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=IMpGpliqYqiRoqn4cN7c6adPMyNbVkdw3pW74xYyguE=; b=iotnGEH3ppKuTJ8SGpiPDjiQ7TY1jTmCZM0wMIEazJgB5qulXOauIWyFdRgBaOyORl CIBPO6pcxeWF4suqdAqzdZ/czmZehW+YD+JoEgko8Ld0wZgogNP3lipPgLxdp0nAH9KP VxBM77qnSZldmEPLQb70v2F00g+NKjzTIHUgXyZk1q3Hj904H3cvk6/kHPn2x7Rd+idz Cp6d4GqNcIW7rFDbLj8MEAs1CzAmlyTOFeMdVBWjweD8KpavFlgxiwq9bgug8P3xG2qA mPK20zWOmrLgmazh3iLsc+NKYq+KNTZz4bamrHEH3TZvdeidqpuIiydXT8V32ViqZAAI PBiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719336404; x=1719941204; 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=IMpGpliqYqiRoqn4cN7c6adPMyNbVkdw3pW74xYyguE=; b=o6saJc30k1whGspsilI6KWjQMJR1WnF4O9oHm9Nu8hsH57B+f/GhkzS3fjxS9eTiSI iczlkXKh5+8TPUKwCrNPgW4JVutPf5PeV89iPv8djCtOMbCgeFDO2U/BqrHGnkkovbWL +5NiCUHEA4LzBv7fYWPWLqMEMuQGR9BkZdfqBBNNamyz1B2YPkLVVHmFoU6V/695lXVA Z8zuiakNBT55nRyr0AKIHaA7/a54Nnybz2/2ctqOMJuvvVKqn+/F15BlQm5/hN3/Q/nO zXxzCXZS7G9bd5YOE0XBjuwtXq5nA4oicIc3j9TJvuHUZatvtTuuLDCj25WuXpf64EIM 4vuw== X-Forwarded-Encrypted: i=1; AJvYcCWEzzrA+zRxHahc+wLOg/L4t3WklkpOKOi5FH3umvzEjFvGtUhjDFecSrYR2DiQUyBzQhjt43b0+ukbB2VClLz8tGnOpMq26XOicXgL X-Gm-Message-State: AOJu0Yxw45S9TQ2hEu+LrXiqwiPgheeBpq8UOoucGrcRTI93TpxuucDV mri8xta29ZUY/PXv9NWmo2yYIPKsUCAPf+pNjcMdrNL/KHbjklLIecmY3ACKv/URGFQLzyhCyoo XL4fpjw== X-Google-Smtp-Source: AGHT+IH7+5ZWTBKKbbXiYf9Ov/UKvq0gkd8VKcekY3d+qTX2IBw8lJ9SfVOmE3ieuJ+wxA4bu4ed7gUqIOcD X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b4cb:a52b:f9ea:8678]) (user=irogers job=sendgmr) by 2002:a05:690c:ec4:b0:61b:e689:7347 with SMTP id 00721157ae682-64298a5efd3mr300097b3.2.1719336404050; Tue, 25 Jun 2024 10:26:44 -0700 (PDT) Date: Tue, 25 Jun 2024 10:25:52 -0700 In-Reply-To: <20240625172603.900667-1-irogers@google.com> Message-Id: <20240625172603.900667-16-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240625172603.900667-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Subject: [PATCH v1 15/26] 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 , 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 e2d784c5fdd6..0a96656fee46 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.741.gdbec12cfda-goog