From patchwork Thu Jul 18 01:00:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735895 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 226D1C3DA5D for ; Thu, 18 Jul 2024 01:02:18 +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=UnSPlghBx3VkMv83qbGk/P7jIBEF9LRODtE5BbjiJPc=; b=GiG4k2wZPoa/sXFxJ4GtEgdS4f imzPgenQIExNKM1MInX5kUXy25zRbLjqhaaSAWlzVpx4GUD54taF2ZDiusdIskoEo1bb3SB4eXxz7 0ollZ+pfkPLSAI+C9Eik76RusAKRA+lVGstqxsiozgoIKW2pcWiHcrJV8VadILXyHtonifWJcgSKF Nh6GSFAhP9JN58kAhMYgMB819sFp4op9HKX4xs5WnTfWUV3H0G6roRhmA5yh24QDgSZpuJaxG0nFr vtRV3B9BHFCzhPC8AiWCNECkSQ6HVCH5hQ9XGPkIxDg0Hr+anUhAS4jtVdmeiHzqd6VL/waWKnR0k 8Cfdxjng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFX5-0000000FK81-2Mqj; Thu, 18 Jul 2024 01:02:07 +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 1sUFVp-0000000FJUR-1SYs for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:00:52 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-64b70c4a269so6429257b3.1 for ; Wed, 17 Jul 2024 18:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264448; x=1721869248; 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=UnSPlghBx3VkMv83qbGk/P7jIBEF9LRODtE5BbjiJPc=; b=qaLiOvd6VqUzPYGLjl5bYEWx/MsxLBuNUVTbgd34fp85uIqIfc+K4tgZfWHEp7xfTM XMq96obHROhktefLnOgqJYwUcV+ukrvFdkP1NgpTcYONTEU0giAI4CY9kTJLC0IdDrQ7 ly5mBVlAUavRNSwdNBLOBB+ZnRO9gWHIT3aSOxPbrps20vzVfo7jn18ForKxpjuNlIMG uzbH2/TYIAoRX28Ow9tlG3RFguFgsjMZ+Nmi2rixP+I8BwfNUlJ1c4BNxhq3O4ZOaZoB D117Ac0CTYCJNwbdvAq3I4vUbfZ4nXwY+73j4yEkuoesKjYwepXAOZbQcFA0gVOM+enU qc7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264448; x=1721869248; 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=UnSPlghBx3VkMv83qbGk/P7jIBEF9LRODtE5BbjiJPc=; b=mx02OVtYwOlQJ4PAcmaA/7dKGKho7PVCKnjxf4dm9KgVOHyIDf7o7wktW2/5LK7MPa HWLboNwYurvMmDYOeDm+crYCvbD6yakTvjZV/YC8oRXiigv1JwU87swPohAgi/uuj+gI eoGl7yhWIDjDZH8RKai9P1gjiv/pgyBuK7edhY9pHo13PBJ6WqjuCl8PfujzVqrcMAgn HoOZQTvASIjnHSLdNnHqI7hlRTL/XX1u41iL441gVC2u5oa7Ax1HX6RnKmSjlgyk9Gy2 tnvSGYvS71s29OFrQCyJBcpODmohKFY44fEG6EVYwMntcNRxwIJHzh2KmGabHyrLfvgC 4bGw== X-Forwarded-Encrypted: i=1; AJvYcCXZ0ZQ0s0KXeqihG/ukVslqv5CReTdXLixA0LVPT2K2gxKrNnay5mQ6myldxJ0H8DmYIGuwvM2dVh6Es5sUFYngCHiq1W4P8qV+pIJcL5k/TSHum3k= X-Gm-Message-State: AOJu0YwkgR3fAnfRcOMOck7Rvp0dVHjN6hK8DLPFayHKDnJCKnIhmnbc 9tdQNkF8zxfwvbx6RK7SAJosZL7TeiFce2HQjGBwdzJlEYk5KTR76CpFQCQvdcYFGHxmrvhWyMM sKXftug== X-Google-Smtp-Source: AGHT+IEtJVGPJ7X377yE2YXSNRqiPai0lkaBu0kyQ7M1ExKy3MUuhJpxePliNSESNkfKYo7HPJkc1WZwBgQJ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:690c:110:b0:65c:1db1:9235 with SMTP id 00721157ae682-666005395bbmr263657b3.0.1721264447940; Wed, 17 Jul 2024 18:00:47 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:01 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-6-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 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-20240717_180049_536927_7CB098A5 X-CRM114-Status: GOOD ( 11.57 ) 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 Reviewed-by: Adrian Hunter --- 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);