From patchwork Wed Jun 26 20:36:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13713400 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 4C3B2C30659 for ; Wed, 26 Jun 2024 20:38:29 +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=AFiPugBk+wYhM4/j4Jlr9h9+wpX8LHXAYZExjKx1mqU=; b=J3qoV7ywBJ6sq7dZXSlaz7/vGH h9rVVJi5AA2V6X76/vCMB6/Wg+bx/b7yJLF0XRvKm6AGVo5WRE0KVev+tbw2MR6UiwmUZ927mPxNG j1rpyrmN9vtGMxRzPXfrsyzDSJqusxYf6nLOGm8AWFTYZ09sfTNffdF4TI5xsPCSNDy6UNz+MkJJP w8++TOj58t7qXzcP/CaEPMiR0561d5LH4bt/XzrLAq3149ZZGQcHBs0JPBlbqbEGEi1VdoLQEiO/P dN3uH+Q7AJ/5SuglZaSbTpectMtQN3/iuAJ7rib+ipR2BTxcbMCMN3UpC7DPfnMaDocP2Bw7vSjjl 84dBQ+PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMZPH-00000008Fwx-2V2Z; Wed, 26 Jun 2024 20:38:19 +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 1sMZNu-00000008F8k-1OFb for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 20:36:55 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e032e254319so3380753276.3 for ; Wed, 26 Jun 2024 13:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719434210; x=1720039010; 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=AFiPugBk+wYhM4/j4Jlr9h9+wpX8LHXAYZExjKx1mqU=; b=M+GWNYK4Q0ZZ8Igq1J8zA7GsZPJyNihrxg/TyTjNxFhY18kUPkeXqqiUw11aUpghHD RNq5cqppxU1diqV37Rpsyv4862oDxm0EErhL5EkLCPDSGFcjdTByg9/AbztKopPCAk2B 9iHhkwlsCUtfekK+iyzI25dZQ+Ppw7UpdLN0IShGHHtLI+smiRSBFOaBb+6bLPcKY9pv +75rdkXJ97HP22uWqNbR1MlgnO/CJVg/tyWUdpCtWSiNy4REwDLpvNPrSqWpkc+4+QvJ njaTkUZpiqP2bDjt5qO2Uk+c12pWTeSCZFInmi+5cdTwUJ/wQVxp25oehg7/3mUC5xt1 XSQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719434210; x=1720039010; 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=AFiPugBk+wYhM4/j4Jlr9h9+wpX8LHXAYZExjKx1mqU=; b=m2vlMOdxE6VqkiGKM52U7gAPWSblQgT2H91jM4TzwTz8XVY6PWL+GKukdwaXfDinHz 2hTZkuIf7Pqyf+OECkDkpf+dYeF+7Ut3jCtBB6pH62jroKO0IuJBA64uQnkCQUK4GjFV EvPQUcJxLbuMLpVS5Tjo2pjHmz5dOoEeGx8uHzWwjsDEcJ7vlSawRXV2vBQilnQcUe4v +eX6/sKYiGHVAuNWdFpetPA/91VHcskF2ALUTO2vGWTVJQ62G9JMm7B/IN9xjQMOgRlf 1N1ZW4AxRc1QzvUsx1GSepWwLTE4HbR4ufYim3emCGqmrN31RJsiHOlqIJwxgWRtaSG0 1Y8w== X-Forwarded-Encrypted: i=1; AJvYcCVQVy8nIMPt9QM9PxtqT3sVeswXd+MdDy4sRSDNMjq+71WgIhdskGLORpl7e8ZBcUnk80wxyALnJTnINUmJF15zhtXpABd9Se+ggwK881c/DujCoW8= X-Gm-Message-State: AOJu0Yz2nih+wQFpq1r5QKBMxe7ZbRJCASM6vCEsYbvG37QtVR4h5ck7 L6dCP7iFB01eva7iIqp7ZNT59/wuTZTTbWbOTPpkyTrTqN4eMCaNs2HcSTCOyd5/GI8I2uU26An aqiO5UA== X-Google-Smtp-Source: AGHT+IHT6UsLLgb3WeR5Tle1hXNSZKCOcstdTB0LxqaxWb7lVdJw/IMWJFFV90Y6uJl5XDW/2Jn5RtufdKfJ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:23a1:25b9:2412:56de]) (user=irogers job=sendgmr) by 2002:a05:6902:154b:b0:dff:12d0:2072 with SMTP id 3f1490d57ef6-e0303fd4396mr704257276.2.1719434210053; Wed, 26 Jun 2024 13:36:50 -0700 (PDT) Date: Wed, 26 Jun 2024 13:36:07 -0700 In-Reply-To: <20240626203630.1194748-1-irogers@google.com> Message-Id: <20240626203630.1194748-6-irogers@google.com> Mime-Version: 1.0 References: <20240626203630.1194748-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Subject: [PATCH v2 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 , 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-20240626_133654_395191_7BA1899A X-CRM114-Status: GOOD ( 12.24 ) 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 7913b698033a..897c6c44b6b2 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -88,6 +88,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);