From patchwork Thu Jul 11 18:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13730988 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 1040EC3DA45 for ; Thu, 11 Jul 2024 18:07: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=I9Nrbi73tEJWZxPfyj1GxchBACZKBze8WVP6UfEoRnc=; b=R676DsofN93dLUGhUKxLYBeE4N h4QEhfW5mB8Atq7d0Txj3i298O4OFSYiE8HrKBq3y9gvzTqFPYUvoia4rS+ddajEUJBwKVR1d+qSW 9iqLZpyuV5AHkBsPilIGbJhoUZY/bCJQgOqtjo9zmmyW9/iO1Z7TJsmpJ7733bXddOmbvFUodEGlz d+t5nKKlFgBvJjk2cvQDirYZDaxoFsqgvKhg911YNHdwmVizczhHdSpUCJjHwa2+vk2dP43vk7Vxd Ibjw6/6KfhOTVQQJx4VT98eQTvAb4/7IYy74cDhtDwuI2/EYpK5lA0R2f0MxczwKp3Oby1zv9QlX5 Zngn895w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRyCH-0000000EzHl-36Tw; Thu, 11 Jul 2024 18:07:13 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRy6O-0000000EwX9-0QBK for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2024 18:01:09 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-65194ea3d4dso19262177b3.0 for ; Thu, 11 Jul 2024 11:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720720866; x=1721325666; 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=I9Nrbi73tEJWZxPfyj1GxchBACZKBze8WVP6UfEoRnc=; b=OGQDtydVYp0FbOKejzqKwfzijcTdZR/HumYbjSoxC5OZTCSA5my/sTXseKzl5sMRXJ 7b46W9QfKtprcLC7ekypuq4FJyn2828GCfrZbmVqMT0aOzag+NN7QxCvClVrDq85t8Oi oXa0yfOrdUSUPK0B/xd9d7RYZySDKN7fsrQ9hjkxmP/Mh/us84lBqC4pVwwBBxQn1K0e +RZirN9SwuSAYQN7forH4bImyTCNMihySN4kKkjrhlnbMZdSmA4JQOU4we0C2IqrtSzI 5f+WOHz/jOsZd96VukDo2Ell3Zgz/2O6HaHyYFviKbTbmsx7UItGwUCu1yxy5fYKcE2Q /PSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720720866; x=1721325666; 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=I9Nrbi73tEJWZxPfyj1GxchBACZKBze8WVP6UfEoRnc=; b=rZmAg8uG3zv8RDsdj/BE23iq2EYL+pgi+v0NP9S8pdocTfbvSxAxAdbdUdrVJn6J5u sZ9Y6C3g6mvu9Chg3ahk4GwjRriBwC9kLxS2eknhysBykqd/Cmqeku8+N/2j5xSZ2sQD Mtk2AcczIUXYHNlF8tZLDFWR1E7QleNIKeGIl3UvDFhIQwjKI7OE8ftfQvBZBpQVaNFQ OHQaEs1SGFrOZMHs+4v9852pMGAi46E9MblCrRuuRknsYfASG4PnL+/9LzAs+dFMLiA+ 5jiRCRCKj6EXoL78Ku1I5dnM/0QoNn0394Vlpi6EJ9BDn1whQnoTOchILHLwL8DdBgJi 3t/Q== X-Forwarded-Encrypted: i=1; AJvYcCWYbq6DZghc7e44B/qOgobIDLj4nhCOppTOrhCMBxgwDlsckXb2yBZ/kHu75I/hdART+S1I+toKz6B4ONvf2yrVaMpyoKKm6XIQW1eitU7jIJx6+RA= X-Gm-Message-State: AOJu0Yw5INAmbY4XEdd2FKsg44VVa4VrN7X/YRclEFkBkhMlz7nCNYAo XRyucN8X86aKcxZK+WMEkN2cdOzcNpK6U0HxmGG/oTNGFsgAwg5+6uh7rTlCjf0/QN+FWqmiRlI I+qHsLw== X-Google-Smtp-Source: AGHT+IGhziChfBYedmxyjnMHcf3Bobknr15gAzBmJdGEG+V/V+Zw+9Pj/8QUbWISbMzVlIJAKmFQYf39s2q6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:bd08:a1e0:c497:32db]) (user=irogers job=sendgmr) by 2002:a05:690c:d0b:b0:61b:ed85:5d3f with SMTP id 00721157ae682-658f0cc859amr2392417b3.10.1720720866335; Thu, 11 Jul 2024 11:01:06 -0700 (PDT) Date: Thu, 11 Jul 2024 11:00:04 -0700 In-Reply-To: <20240711180008.188906-1-irogers@google.com> Message-Id: <20240711180008.188906-25-irogers@google.com> Mime-Version: 1.0 References: <20240711180008.188906-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Subject: [PATCH v4 24/28] 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-20240711_110108_248515_A8AA02F0 X-CRM114-Status: GOOD ( 12.31 ) 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;