From patchwork Sat Jun 29 04:53:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13716798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9430C27C4F for ; Sat, 29 Jun 2024 04:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FW0UxSAdQlawsPFFt7Tz92UReMCnYyyYMlomigdWz2g=; b=uDpSZmNnLJ9jZncuMo956YxoqI Dd4gRTkQgyJWEkdrLZGKLfRue5dT46Lo5tTpAoHORoT1L/NXoGPHy37ZYJUM0kIRT97L31xMV0Eg2 tt8BXH1UrfQoAfs8WNEKu39dgJn6d1KjsVHe3QFYlwpsD7Q4ulLX7ma7UWpdsgx84jnYF/rKIMSVC ckeDoEKKn3l+ISR9TcZ5nixEGjmnnDq7a1Ss4pDU/cGZH6NnWCB0eHuHG9Jqbrr/RIFJoiio0Rfwc nQVvV5mQ0rryUGwDmxcW3pVDoxmjtSvxntL8hTY9eF1n+Agp7mg0YNsdiacCWfw0y+SESA06VDwXf izgcYC9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNQ96-0000000FsUy-46b8; Sat, 29 Jun 2024 04:57:08 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNQ6s-0000000FrKs-31ZZ for linux-arm-kernel@lists.infradead.org; Sat, 29 Jun 2024 04:54:53 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e033e353528so2017362276.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=lists.infradead.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=MhAe8vq6NY83WCsZMg7cB4xavlI+C+KFUTkt27EP0Q17pqjXJkqLlA4TUYZ8Jo3Swj WxnFwd0JqVcZ44bz5xt3EUlC132IvOz/L7xyN5mnKS81EYFUG3YGlbZ7hZkPV7dpj5Bq Zr5SLbdkZlMYWIoSdPRIwkhleegZQP1gV31NvUw+cfvnGxL6gk4LQ26rQauEGSeVfxz7 9nFQSnDUpbUChT2+vcJTfzFR0xce+7c4M/TX+nklLy/cdlpbZcaBjzXgQ1kBDQWADL/P e5gecpDF6Mvu/rBrT9QbxRgXj7ZprWbAwbnxG0+zGL9z/c63LWGWMWehpgk48ryfcl52 fMgQ== 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=OY9Kqdin6ioCIXP3PeBG3zGQkeGCYIDQxVMSUDPeDheQfQxmnB0snUddbtfsJbAz2k hjI7QlReNLjD4a3jt8VECYOILFP2BMFg/JKeOzAGKCHmaE2fbRQhEIJCVlRngqF9V9nN 92z2cfJsBIRLrfy/Cdrvm8xPWMzKL0umjz/VzK9uljohT430dW7rv2M/Ql1+PNnQO27r E6pN+kpNHm4XzSTg/eCAKT0G/WeBsI4Lr5cki8VJdeOwQl9/fF9Ss+lJMlP0kRX+0J0S Hzag3XPNEc14yY7GkUIkbiW3GBlrm7eiRV9ghOirIEAAl4NjPmScsUK4L+V9cdpk9sX1 QKbg== X-Forwarded-Encrypted: i=1; AJvYcCXf4TFLhZHzNfAr3iBs7p7r6ZdxQxagORgAyL18QfL0zL9eMjasKywRcyws0qLPyoJ+lvLU7oTbbL5Dh4u+GJZyNTF1pS08mwlRUb8r21a9uWQ0TFg= X-Gm-Message-State: AOJu0YyJPD4QDi+R7q9mpRPx9sLy7ILes/V0DazXermT9Bm8KngeiVvO CJmCflMyKA7S66uHsnUzwjQLo10E1rGCOrVTdCVHcRYM4JvLsgI/fpR3KWDVoUop/HbkH8cZnHu /G/plCw== 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> 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_215450_877442_26811B82 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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[] = { int cmd_annotate(int argc, const char **argv) { - struct perf_annotate annotate = { - .tool = { - .sample = process_sample_event, - .mmap = perf_event__process_mmap, - .mmap2 = perf_event__process_mmap2, - .comm = perf_event__process_comm, - .exit = perf_event__process_exit, - .fork = perf_event__process_fork, - .namespaces = perf_event__process_namespaces, - .attr = perf_event__process_attr, - .build_id = perf_event__process_build_id, -#ifdef HAVE_LIBTRACEEVENT - .tracing_data = perf_event__process_tracing_data, -#endif - .id_index = perf_event__process_id_index, - .auxtrace_info = perf_event__process_auxtrace_info, - .auxtrace = perf_event__process_auxtrace, - .feature = process_feature_event, - .ordered_events = true, - .ordering_requires_timestamps = true, - }, - }; + struct perf_annotate annotate = {}; struct perf_data data = { .mode = PERF_DATA_MODE_READ, }; @@ -864,6 +843,25 @@ int cmd_annotate(int argc, const char **argv) data.path = input_name; + perf_tool__init(&annotate.tool, /*ordered_events=*/true); + annotate.tool.sample = process_sample_event; + annotate.tool.mmap = perf_event__process_mmap; + annotate.tool.mmap2 = perf_event__process_mmap2; + annotate.tool.comm = perf_event__process_comm; + annotate.tool.exit = perf_event__process_exit; + annotate.tool.fork = perf_event__process_fork; + annotate.tool.namespaces = perf_event__process_namespaces; + annotate.tool.attr = perf_event__process_attr; + annotate.tool.build_id = perf_event__process_build_id; +#ifdef HAVE_LIBTRACEEVENT + annotate.tool.tracing_data = perf_event__process_tracing_data; +#endif + annotate.tool.id_index = perf_event__process_id_index; + annotate.tool.auxtrace_info = perf_event__process_auxtrace_info; + annotate.tool.auxtrace = perf_event__process_auxtrace; + annotate.tool.feature = process_feature_event; + annotate.tool.ordering_requires_timestamps = true; + annotate.session = perf_session__new(&data, &annotate.tool); if (IS_ERR(annotate.session)) return PTR_ERR(annotate.session);