From patchwork Fri Jul 12 18:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732139 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 034B6C3DA45 for ; Fri, 12 Jul 2024 18:13:56 +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=PUbNGHbJusTOA2CgJOpkojrr3Ag9eG/HXr7a91E5F44=; b=4eciT8GRlmiCFundIdlcJkNsAq Vxyz+xls+QlVsBVuBRJ1YEmZqbAQD2Y2u+yvNnW+zWajcIUP+aUwJWYXFq9tMEZHpI3KBC7gEtKLn NGaVwznIAt8hRZqNEVkIyv5Cygb9u1GIcIg/fF98wzI9m8NFOOlHVg8BolEn0HLWNhmxQs0Exzu+o /3fZoB+bhO1Z/THurAPoDRu/GeqyufYseJWaWyfChUAM0c9NzTqmXTUoE3hfwzB6F0eszu1zi7+0W YTtYspr3ngSeVLmoGHvDaWaCJEC6QhtvF96NN8JQ4ejG2CRfpLOwca87VW3fpkt4xCg+A9XQGvCrm ZqNKnazA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKm9-00000000vwD-3t26; Fri, 12 Jul 2024 18:13:46 +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 1sSKkp-00000000vEy-3ZbM for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:26 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-65ef46e8451so9258877b3.0 for ; Fri, 12 Jul 2024 11:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807942; x=1721412742; 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=PUbNGHbJusTOA2CgJOpkojrr3Ag9eG/HXr7a91E5F44=; b=G3ercJ37C1/HKciq7D107r3aD4RQP+Nh4g0bZDmWx2A4vDr6QDZ/ZKp3vS9I+sjSvt U0kHoobP5s/yQnEqcmlswPaZsYPHoK0urKJj/AnRF3wQfd2xGFRa3Dw145/9225BO++X YN4tMR0rJLoHgF+aE6Xm2CTVdSNCPxi0TXuavZkzzdzs8M7np5tjVfIur89Ilgj9cpMH rCFHtBNi9oJHp8FFdqE5yk4Q7pugx3J22fFSuNFm1eXWU9vrP3MzOaUD4Xc+glLMzEXX HMddRxKqDJ+lKp59MqbJNA/DUs07ComtFhwStMlUjoP1akvoFfKcpIyyp/qmHXEH8Dfo rRKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807942; x=1721412742; 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=PUbNGHbJusTOA2CgJOpkojrr3Ag9eG/HXr7a91E5F44=; b=Vvg/xJRqH0k9KkUzAcJzfX0khDrUeNZCvr/WBDW5jV4uRYay0oP0JWk0dAodQ9no05 SNbFvn5KpQGheynF2V7olVwb31RlgQ7Fe7Fws8frtNIIq7kVrLt3npW7m7PjMoh5ZGD5 r4V4EvMgpj//VPMSinHRFz4f0Bj6JnzLPpwMrunV10p06zi72avTd1UsCumeLTlAeYQV KeZgJO0JG3JItFRLhjhmRTeAIhjD2gE9pXHShfh0AcWhhIhaegLRrLjlI9ovYrm1BfAX MCIBzaGOMEO78SbtVemvSUTAI9LfDUIKM37J4nOLJKyc4gwrIGCsR4mWwnqcbU6vXgC3 tZbA== X-Forwarded-Encrypted: i=1; AJvYcCUlLdIOo1gtXXARJjYe7c8tf/7R7gsFGx5vQNZwJ/k2r5ymVkrjaJVfxk2pxcsG/lqpMsmyoggkRrQU3HXTBE+PpQOOmDbgKVAqvaXgYm1riVOer34= X-Gm-Message-State: AOJu0Ywwd7RN72VL6rFw1Vml8MjmMlCVBsf0Qy54XAtpsxjx8v1qbh5Q PSTBPzwB+p97xrnBKo7BTcDu70xkwZVrzY8cTkPwwuYN3a54d08Rr0aLuiJ2Mad638zQfCHAWNN RRxAukA== X-Google-Smtp-Source: AGHT+IEn4aL7gAe/A8RlgnAdU+tNwlNq+Sm/494mGsbEklzNlhOPqAJr26SyTCQFnLjLoMPuNqG7qpfWvCca X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:6902:2b0d:b0:dda:d7cf:5c2c with SMTP id 3f1490d57ef6-e041b17798cmr23897276.13.1720807942024; Fri, 12 Jul 2024 11:12:22 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:46 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-6-irogers@google.com> Mime-Version: 1.0 References: <20240712181108.475336-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Subject: [PATCH v5 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-20240712_111224_022319_79071B46 X-CRM114-Status: GOOD ( 12.42 ) 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);