From patchwork Mon Aug 12 20:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761022 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 D2E26C52D7C for ; Mon, 12 Aug 2024 20:50:46 +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=E5QskrwEwgJh1SEHBPySv+b4dUG/k47lipRxRjevwjg=; b=3KiFII+8tYHtQ7rG30HzIRZ5DN ZJ/+fwdhRltrzoQpRiT3qniYyGyl2OYlHuueGf/SpK/5KTCGpd0Znnh9nKN43LgjdRBFUaJSpQdas VxCCxRXTC/boQGZlUD7gstcJAD4qTcs1nRUOkFX87oXzjfkUD64H4dYvUs9Lh1kxIAnLEgyNCso3U XMWnP0crBujPCbpvnbAZ4rmKdPDNLf3ZZ9Xqs40AcEFGWtCpdtNR9LxmOxVXV6hm2QfBvX7XhhSn4 zzVjg79i5tLdHdCe5NJTWoSaGtgAfR95V8/ZtbmgI22YvdB+GVVuzvenVu2quEa8T5IihWy49B7ga Jk3rOmsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbzt-00000001VWK-42NR; Mon, 12 Aug 2024 20:50:34 +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 1sdbx3-00000001UTK-2f18 for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:47:40 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-64c3f08ca52so101326587b3.3 for ; Mon, 12 Aug 2024 13:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495656; x=1724100456; 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=E5QskrwEwgJh1SEHBPySv+b4dUG/k47lipRxRjevwjg=; b=sKUg/5ZCFKJA7v3sKryX2Wi8EDEv4mRcu7K9iRoiURsWqbg/B5sFI/S2zUt7p3P2yf J6atgfVYw0wPy8FJieMHhKsZCdPs3y/ZsnxknvYZrg4A2HTjqWmz0f01X/NZIyUkgOfg e5+MOVjVQR+ktt9xPkNIieDaOrtqfKUVfhAvWufb9xjiARBE0Hlqpo4scLtgU1jSpltL 5YCXsCMysJBPk6UHjpjmcMTU0sxM/erm5S0AbSoZU11rJpSEd3EE6M1/AWGfYRsXJmxp LnRtAevVc42EaBcWbp/W6pj4ZktY7E6urexr0dKZeGE5qMkgmywxIdXtLA6zABFKYSLe UM9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495656; x=1724100456; 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=E5QskrwEwgJh1SEHBPySv+b4dUG/k47lipRxRjevwjg=; b=rWrvhKZTzvB8xYcXJV13D/0sRhAkqTmK0vfuZLpz3jsu3Swt7A6ma4iHec3TqG5lpQ 9wQVLrlKbAKTQvjhGgjrQ5+h3Znot8TCyHTVHTAt6zqThzNxUMT5jIhX5/Ayf4sogT4G IMFm5Q4RYfMSjb96PMOTk1QqTx/F+gXMaURjTVVpIR1WLuov8TjqxAQWSckWcSI/WvAG O87JY7W4wxz5FB0fx6xTJ3YcVNIaLJc1nGGWtL5P7tcOL4GRm7HI9sxVOq/xLKcd41fq ZwWMabiIRsVUbnzRW8kBzs7MFzLsM9DxRsObYJWMm+eoKxSTVIQyD9lOlSl94WE2ifg+ RP6w== X-Forwarded-Encrypted: i=1; AJvYcCVSohXmuEro39iQC/vYyLe0dxtzrkPZgXnASf0Y+yJcCGCqIjvrEc9Y+KgLYQgHCTgabOOM+b5WnLuAbTU7gyWSkNu59hq7OM1JOTz5+5gFwq1be04= X-Gm-Message-State: AOJu0YxgR3zu6ouVYYn3vZakfUiTif+EAzAtouKORkwor/rxrLOKZNjF xnLBWY2SdvHBmt7bnUcfNLUUQJ3JWJ+he7aPdB19veX50SkYCh8zfOcDBaJEf+LfQJ0XyPjZ9uJ /eLjASw== X-Google-Smtp-Source: AGHT+IGYzX4ib/mbR9sRiEgZk4S2Ro0LhXD3PEY8JFZJzNim6QhGI9Yre46z0AplBbBDzJBKz1DXJDGI2in6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a0d:e4c1:0:b0:615:32e1:d82c with SMTP id 00721157ae682-6a97732c587mr106997b3.6.1723495656210; Mon, 12 Aug 2024 13:47:36 -0700 (PDT) Date: Mon, 12 Aug 2024 13:46:57 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-6-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 05/27] perf tool: Add 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_134737_748845_43307233 X-CRM114-Status: GOOD ( 13.03 ) 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 Add init function that behaves like perf_tool__fill_defaults but assumes all values haven't been initialized. Signed-off-by: Ian Rogers --- tools/perf/util/tool.c | 58 ++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/tool.h | 1 + 2 files changed, 59 insertions(+) diff --git a/tools/perf/util/tool.c b/tools/perf/util/tool.c index 17219ecb8fa6..cbd9b888bd73 100644 --- a/tools/perf/util/tool.c +++ b/tools/perf/util/tool.c @@ -230,6 +230,64 @@ static int perf_session__process_compressed_event_stub(struct perf_session *sess return 0; } +void perf_tool__init(struct perf_tool *tool, bool ordered_events) +{ + tool->ordered_events = ordered_events; + tool->ordering_requires_timestamps = false; + tool->namespace_events = false; + tool->cgroup_events = false; + tool->no_warn = false; + tool->show_feat_hdr = SHOW_FEAT_NO_HEADER; + + tool->sample = process_event_sample_stub; + tool->mmap = process_event_stub; + tool->mmap2 = process_event_stub; + tool->comm = process_event_stub; + tool->namespaces = process_event_stub; + tool->cgroup = process_event_stub; + tool->fork = process_event_stub; + tool->exit = process_event_stub; + tool->lost = perf_event__process_lost; + tool->lost_samples = perf_event__process_lost_samples; + tool->aux = perf_event__process_aux; + tool->itrace_start = perf_event__process_itrace_start; + tool->context_switch = perf_event__process_switch; + tool->ksymbol = perf_event__process_ksymbol; + tool->bpf = perf_event__process_bpf; + tool->text_poke = perf_event__process_text_poke; + tool->aux_output_hw_id = perf_event__process_aux_output_hw_id; + tool->read = process_event_sample_stub; + tool->throttle = process_event_stub; + tool->unthrottle = process_event_stub; + tool->attr = process_event_synth_attr_stub; + tool->event_update = process_event_synth_event_update_stub; + tool->tracing_data = process_event_synth_tracing_data_stub; + tool->build_id = process_event_op2_stub; + + if (ordered_events) + tool->finished_round = perf_event__process_finished_round; + else + tool->finished_round = process_finished_round_stub; + + tool->id_index = process_event_op2_stub; + tool->auxtrace_info = process_event_op2_stub; + tool->auxtrace = process_event_auxtrace_stub; + tool->auxtrace_error = process_event_op2_stub; + tool->thread_map = process_event_thread_map_stub; + tool->cpu_map = process_event_cpu_map_stub; + tool->stat_config = process_event_stat_config_stub; + tool->stat = process_stat_stub; + tool->stat_round = process_stat_round_stub; + tool->time_conv = process_event_time_conv_stub; + tool->feature = process_event_op2_stub; +#ifdef HAVE_ZSTD_SUPPORT + tool->compressed = perf_session__process_compressed_event; +#else + tool->compressed = perf_session__process_compressed_event_stub; +#endif + tool->finished_init = process_event_op2_stub; +} + void perf_tool__fill_defaults(struct perf_tool *tool) { if (tool->sample == NULL) diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index b917b1fa6204..7c7ce395e573 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -89,6 +89,7 @@ struct perf_tool { enum show_feature_header show_feat_hdr; }; +void perf_tool__init(struct perf_tool *tool, bool ordered_events); void perf_tool__fill_defaults(struct perf_tool *tool); bool perf_tool__compressed_is_stub(const struct perf_tool *tool);