From patchwork Mon Aug 12 20:47:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761040 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 D8F2AC3DA7F for ; Mon, 12 Aug 2024 21:01:24 +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=uJSUXUdYfftsnAfnEFDlpk8Nwh4UnwypAJ8imZ20tFs=; b=b4FuyBDusqeOU1hurSP8IpTaKS fO+pyFSqmRN48AGmQ2FHlGNL/BpUpt6p0NPdBd1hIA9jy/cGLUFqJ/XabXhqzl8vyp+1zkAxVZPvN WuwqdKwExxvYrpQoEmlHnyFTC9YhDGyeIM4bMThjb9C/kv6/UKWEtzwVVhmMfpn8dxZVegxLbgV3+ YDox2NrEbiH9k2TyH1NVGymmdIPTz2jG9Hwabo9u/wfFb9bBLoXziCqcRoRMw535u/jc3JpiHXj+j vx1eh3e5CdL7M9ALHBSZBbI15XwBZRMdJN555vXD1Qzw+QLhqFDz/GLCKBHUohl2oIZfPD0Fm/0Zf iCx/V6hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdcAD-00000001YgH-1JeO; Mon, 12 Aug 2024 21:01:13 +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 1sdbxi-00000001Uno-3WKd for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:20 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e0ebbee58a8so5393282276.0 for ; Mon, 12 Aug 2024 13:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495697; x=1724100497; 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=uJSUXUdYfftsnAfnEFDlpk8Nwh4UnwypAJ8imZ20tFs=; b=ZtPO4L+L9xjkV2oKFKvoDBQubaqaGJy9XPWTIazdp14267TVIrg6QCJIy5KoimHnGP H2zXYX3VAaZERlkal8+vJFpqveHyiTPltrUdEevgfwwWEnf+tEuBuMY3+LCAvM8ohpc0 RWlLMkQCkBAqxk6Hhqv23Br4oBv+HudtG7FbTbGTvznRAoUuQkuDHAAhmlk6F5iez53U paOrZvxGCSNKYgU7C7b5PdxwoWpfmSxKfxucEDnbj8gfQeDamoQcagFDKhiNpGJQUb72 d/YDeszksPRHajFQDdpVGbo19phnea1oHY/B6VTh9TSid87LatTwOi2Bh6X/6znwAQqW yq+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495697; x=1724100497; 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=uJSUXUdYfftsnAfnEFDlpk8Nwh4UnwypAJ8imZ20tFs=; b=pnjzLZza+qTrEBX7UsdYcc+nZpTp6EMHgPttZJhzaBXjCxwbRV7fmrvlvkbWpQinNU EzGksgxL+uTlcF46XnlunDyz670sF7VWGSQ6KXqYySiNQ4L37FrJ1DHbsexVZ6O1BNJv mx7U6xge0EpnMmwJYnZg4f//KQ2W+lhUHNdaqY+K8Sr5a3M+aNbZuN09U4YzOw0nuPzk jaXXFUsHB32XjsYQu3X/1EqRNz0/AB+dSR6g09mfS386WcR03SAjbKBXXbEGT70z1Shc GnaWNmydXy6v4zJo/agNlt0VX7pNe4KbIvVT896NqQHXXcUwtRJh6B2cQFjXLvLU5Cen ebZw== X-Forwarded-Encrypted: i=1; AJvYcCUQHjrJT0OxWYfOq2Xt40cLSmaYrcccbXLK6EVLC3K0sOdosCh9LvYgKm34qmymvRsPnPZI2hDoFifIH3OuTl8UQjws6EJchUpvpBwJt2vFS/UI2is= X-Gm-Message-State: AOJu0YyJeSAv20Uuey+StUZXNIYhTnD4P4YSpC4lyEdo3nrATnqEDK7X ltMAruervF37r8JAeMhw1emkbQU6oiczuYxQQmAfWNg70B50rAhF5vd8K1rXpTlsOhQGBV0huX8 YQzDs9g== X-Google-Smtp-Source: AGHT+IE2pK0wYfiv8oc0VZSUE7OVPqkqcX9EbQm/feBFKAubLZ6JT4aH+pOipQ5xDduOtnnesoVffuXHgpL+ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:8d89:0:b0:e0b:c0a5:71e2 with SMTP id 3f1490d57ef6-e113d2c1aa5mr27234276.11.1723495697319; Mon, 12 Aug 2024 13:48:17 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:15 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-24-irogers@google.com> 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 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-20240812_134818_904297_3C59565D X-CRM114-Status: GOOD ( 13.10 ) 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/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;