From patchwork Tue Jun 25 17:25:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13711728 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 8702FC3064D for ; Tue, 25 Jun 2024 17:28:13 +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=IMpGpliqYqiRoqn4cN7c6adPMyNbVkdw3pW74xYyguE=; b=jOKDELmaCDXH6kdZPhfwv600KZ aRyk8KnQRb1rUDQFznWv/uzkDnsrf/DEPq02uNlNbX1AFbsucunPLbl5RXM1EJ94SgyMygUZMWaJL 4mffbaPPgARQjmGeQFVX0/gYSzFL0ppYzGM8uLv/rMpp7aI9eOfsq/byY4/Oq/ZAiU13ZTWfclhHQ QFdKLY6uCF5RdDWuC4CUnwPEu+RlX/X25tCTq5fKjIvFIIgmElnTdi7ty4yF6tzin8ROLzeYPuip5 tDT3gFCKdtl2yoOPZIS8RZipK1N8f8h8dAlszGyeVZ80USfCySTLGLy970c+r3Zftjfoex+wHAmnx 2sVs2oCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9xY-00000003tcm-1aDz; Tue, 25 Jun 2024 17:28:00 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9wM-00000003sjX-35ty for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 17:26:48 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-64507372362so61446147b3.1 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=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=IMpGpliqYqiRoqn4cN7c6adPMyNbVkdw3pW74xYyguE=; b=kD+2RUanxqb/ouOIOtSYSE14jWXAZpkfC2SZn56YoaMP1B4tB1NpkOX6tm25RFlOFH yDr+UJGR04vjCWUKpd7PH14b7HJVvlNXu0MTyZDgqDvZCnmQFZ9L5oBoedf9N82MQPrT Xcn/iNOpwtuE0yoBcfnCvM07f1RZLjbTp2Q8bBuhQPvQwL2DxUwidKCHegQJrQQetqZu 4cybRKaIYlph47/azdw5MJQOWXEVsVnLJXgLLbT9rfcYrofItU7aGIYvMIRw+Xe5Bf0l XwkFqg06AlNz/URDwixg3Cmj+gNDOjcKZDpdTG3qjBW8RasxF4U15dJmX4FIJa+LPdh0 +R7g== 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=pWrmv0FEY5zYPKzgyMl8xapb4IVJ7OFQuwM2D6XyfCDCiNc37A31+myzzBGrjKuTnq Am3foJFicj+xBzeUnWZEoRRCN88omuutg+Rsla1QeFlIeBxwDn64MEb5Gq4FA5USyNVp wbSwngmj6xsbXASngrI+DLd5vZ/fnp5QoCxe0xmESLnsmTD7cHNsQZABc/3ypLvay/xi 7gJYbkOjQeNvy/qH07eM5WDJ7yBNxouOUgecMA+lsINHwAcxtxHqv6ZsO+8TeA70OFIp /8VyrFi3XANYo+2LQ9lF61kjZnf1z33fTiURynTbek1lL8EtvDQTRJsuv/yyFve8BBiV i32g== X-Forwarded-Encrypted: i=1; AJvYcCUQ0djzLrD6vnFVpiTyO16nZJTiZwUIkpj/2qenJI/me5q7Ue0a3Jol5Nt6+Ui4gToqi5pIsqrC1IHl60Ihyzz3ZNDtDOBcoi99FNgbv32JA0by6Gs= X-Gm-Message-State: AOJu0YxOUE3TKrmRajIiIJ6hr5V3Q40TIw8NbrJEJGz7rcbNZRWv8XTA 7M6buUPAnAGfqzN9/hhzP56RffQ18eLFteBPQitD5rtdMMFbE3bCe0w76/p3e3Zazy5lUsDJ4dm jNU5I/g== 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> 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_102646_911057_6CF88294 X-CRM114-Status: GOOD ( 13.45 ) 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 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[] = { 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);