From patchwork Thu Jul 18 01:00:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735914 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 CC80DC3DA5D for ; Thu, 18 Jul 2024 01:08:22 +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=Clkf8d2hIy3r9JhAIXh+9vb9zWkbL7cEj4ImfbK/zRA=; b=gsx1BhXtLvPylh8DCGCopoT9W5 qBn8mrQkNT8FNq1SLfyk32DD8CF1InuPwmBfsQxWVbZxDcwN59vJTJD1MVxIjrIf1pSqz+g7HA3Nr 4IZsmCQjBJ1BafbnwrZLr6o9lXUbJwadmSjHkVZ0JH+GXULEtaZ4+ELnzb32d4k0n56MC/teaURb2 qfTm6mJdosjFwbEg/YdiJ3oKE3ee9Wgu7nKBbiaBuLbI1qg4bB47nH+3DN6JZ8F7O2ZmLlTAlF/AS d0zXDDaGxouo9iu46uUODUNBPuXLzLGKyBtZgSdOQRO/VU7GcEhry8oNqG8ecCWWjH3uWai/hTPpF jGlm0SyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFcx-0000000FMQ4-04Rx; Thu, 18 Jul 2024 01:08:11 +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 1sUFWV-0000000FJqB-1V1a for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:01:32 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-666010fb35cso5204747b3.0 for ; Wed, 17 Jul 2024 18:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264490; x=1721869290; 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=Clkf8d2hIy3r9JhAIXh+9vb9zWkbL7cEj4ImfbK/zRA=; b=YYEFIkfYQQjPVQWNN5pDnfgc7BbaPeFcXT1VAn4PwQBz7PGvjTUEaRw7Bl//bS6Skk DS2/TPKzz7MSLAXZOedZlWhg7s+gK2mPYFcxCIR0baGeekXZ2jKQPFkX+Y46JpTTghTW unEJDpQeCx/9Yeyfcff7A0EoT/K8IDztITQ2iyWy2rek/46r5CucnuE+mDVXMAqqzHpW YJVvoi11/tJan+vuA8pPzJRgVkf3X6FI7mpzU9H3KGzU+K/qQBCmK+8Tk1Yz2xJbNZa0 ZpgiOW+JByahmljTgkboQHGfGfbZBorZcbVknZ6Y8BuYElbwlZ9MpQTPCyzrs19Y3q+R YnfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264490; x=1721869290; 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=Clkf8d2hIy3r9JhAIXh+9vb9zWkbL7cEj4ImfbK/zRA=; b=PxNK8bw+GAiveWd0cV8gG2Ub8Y58DzTQM7m0CfyG11aGcwhuNzf8T2OGSTEu63mN1E uqMMBi0HwbfCjv4s/eCYM5MEXEoMv8VERwoSMK4F8ntiKWufqTbskV2P+xQdGEASPqXp MwGib9rmxEOnnkq9lnl6m4E7gkEF1wtFwJRq/gmG7x5l1rBoTtxJXRrcAEKC29dpLqPx 6dvBwvuj/vwasiMt6cQEMNIPLuzhXwOqeJ7bZNymRi7CVAAEWdxvU3qAJs42wi1ZGTK3 cLLccrKgSkrEDZMpTxSkqH/W36H6jkETkV3WHl4FLPDwSkiTx051xVbvexKZVMok8Y+T 5jcA== X-Forwarded-Encrypted: i=1; AJvYcCVKGgkz3NCo9Frw69g+SwOXGqfOHeJZ95UivVxYKQ4WPQDi+KLW5IbM3HDCrufLjCYorqiyyC3TRNtHo12ThC/6BjcL+seIbio6RCceNIZhpg8MZZo= X-Gm-Message-State: AOJu0YyAkQHYBe4aRRltmeb3RtvlbTgsqv9LgbYDtbJlcTXKNbXCa0tn cSOzmn85lPg+Tchw+/ojwRP5NkIl7qVOnKKSxqtPZf57DCoWK1GObOW5VHS0mEBO/jUN1OwuYeV mdzPeoA== X-Google-Smtp-Source: AGHT+IG3uW51DaI0jwt64D2aVkFsd0oCKXhiJ/qB6/tX+ACDLixR+siknXwDm1ELbOkMHzZQc1ESlEtW9OiS X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:690c:2b04:b0:665:7b0d:ed27 with SMTP id 00721157ae682-66608017be9mr125757b3.2.1721264489810; Wed, 17 Jul 2024 18:01:29 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:19 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-24-irogers@google.com> Mime-Version: 1.0 References: <20240718010023.1495687-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Subject: [PATCH v6 23/27] perf data convert ctf: 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-20240717_180131_448917_56CEA54C X-CRM114-Status: GOOD ( 11.74 ) 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 Reviewed-by: Adrian Hunter --- tools/perf/util/data-convert-bt.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index 9e2170604b66..021e9b1d5cc5 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -1607,25 +1607,23 @@ int bt_convert__perf2ctf(const char *input, const char *path, .mode = PERF_DATA_MODE_READ, .force = opts->force, }; - struct convert c = { - .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, - .lost = perf_event__process_lost, - .tracing_data = perf_event__process_tracing_data, - .build_id = perf_event__process_build_id, - .namespaces = perf_event__process_namespaces, - .ordered_events = true, - .ordering_requires_timestamps = true, - }, - }; + struct convert c = {}; struct ctf_writer *cw = &c.writer; int err; + perf_tool__init(&c.tool, /*ordered_events=*/true); + c.tool.sample = process_sample_event; + c.tool.mmap = perf_event__process_mmap; + c.tool.mmap2 = perf_event__process_mmap2; + c.tool.comm = perf_event__process_comm; + c.tool.exit = perf_event__process_exit; + c.tool.fork = perf_event__process_fork; + c.tool.lost = perf_event__process_lost; + c.tool.tracing_data = perf_event__process_tracing_data; + c.tool.build_id = perf_event__process_build_id; + c.tool.namespaces = perf_event__process_namespaces; + c.tool.ordering_requires_timestamps = true; + if (opts->all) { c.tool.comm = process_comm_event; c.tool.exit = process_exit_event;