Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2185103rda; Tue, 24 Oct 2023 15:25:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEu679klKp8QLcoD71Dzo1BWOhgPkvvgkClxigRw+u64qffkvIUGDaUwYaUyFyAUNdLhNr X-Received: by 2002:a05:6a00:35cd:b0:6b1:5d1a:bd0c with SMTP id dc13-20020a056a0035cd00b006b15d1abd0cmr22677468pfb.16.1698186308448; Tue, 24 Oct 2023 15:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698186308; cv=none; d=google.com; s=arc-20160816; b=pPrfkR1voVFe7aZ3MVDD27YavhW9s15AgRee0XuclJricGyl/x/Kh5EURp9IRMAGfa 1UFA6xKBwFoj4naVxtq3+95nW9Kjysome2Zamnf3xojNVB7tealV44OJTKgjO4v7uNdt cAGBH93GwOSlW8HrdEKrgyyNXF4x8jx1ajhOH4NU2E+CpT4dzaEmz8s/1gTrPf8AIT7e 5Jyyzhltbz9cgsgxmTzlNygbj8YR3dPMq0Q4+pJeroAdq3DFBv03ecSDA8irPlIx4Amp P59yqGKWmsV/nanPVXE/UqdIj7X0IGzmNy5RU490Q/HjtoUtnJNTXvUZfUdl2qbiq+1U 6hbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=E9Urizhv5WS8Bux3imXxMiLlOJqV8I9Pz4v3kegUcno=; fh=NAro5oTsDEB2Or99ABwb774QJkwQSkr6EoLVqn/Yde0=; b=qjlp1G8/skjMj9tI4fz+hsPEK+fBbovFKWAtAmjn7HVWNmt71iz0X6zrz8GjC7NuvQ 96LJiBdmdXUUjO482pUJbeBOP24TAENSfu0DbV1OeR4QPpwVAcnzMT4JHPopsyn5BxTS KqCIGJmiUegpTetAUEL6Rb2INZrFcL/inyIt4b7SMT8/GN9bOIvSnuSe2LLwIGFM3dJP x/sQ/FTJde9KKbxcidHbLQ399dZKdtDOmCOyfTS34Jg32WJjN1lD+i+/pZHexSlUQz2T rmTPazw8mwzyPFEB/yS0GzyLxfqHSYfMbIi619n5mZW1CcAcXKOId+R5tc2RIgT7GpK3 N8dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cj997Knq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s21-20020a632c15000000b005acd5108042si9137365pgs.521.2023.10.24.15.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 15:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cj997Knq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 41A5780CF516; Tue, 24 Oct 2023 15:25:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344499AbjJXWY4 (ORCPT + 99 others); Tue, 24 Oct 2023 18:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344433AbjJXWYn (ORCPT ); Tue, 24 Oct 2023 18:24:43 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F0AF1713 for ; Tue, 24 Oct 2023 15:24:31 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-da05b786f1dso667629276.2 for ; Tue, 24 Oct 2023 15:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698186271; x=1698791071; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=E9Urizhv5WS8Bux3imXxMiLlOJqV8I9Pz4v3kegUcno=; b=cj997KnqBuk1bJmOrE1IaIjCfFJfdq7f3X0TDebG3W1tvzl1CfqDsoRbsWSkZbq3EV VILP3F1wqjbRACu+v39fc+dbw/umoBJed3H+6Z3KbqpiOSeTXGXKJaOdgrvzEg3CMPwO FCknZrWklnt84Q14XXGuetp0yDNwIWUVTdVjyYNqz4FTPhU+8kI0nFochpdvBzosdypS y63K/24yBnFMwIP4AmRbjjFMHDZjfPAU1k+jVBjJ25N6bh8kZaocYa2I5BH03L9AiuGR fhbWg0PujwL3cGy4Ad9NGkHZeRYuD4mkPZvDjXGs1Ad8Lrh4IBf++4iHjGZKu36Qk9aX skMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698186271; x=1698791071; 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=E9Urizhv5WS8Bux3imXxMiLlOJqV8I9Pz4v3kegUcno=; b=oekuStW2mC2dZsC8QIIMwKkLGKworgUE0P8VNG+LSqI5taJEn71NKusXTnEfWQuZXj A1kgl4htejTQ10NRWqa6eYmbY5d079f54a9CNK3r1o20EXbcbfz9LmQM+Uo71Ibd2HlE DLmLA+6zquZ+VNizv7Mw8EOVCcoI/eKRfqRxVsnRY6QODU8l4K7Pd6vvbpdOrzGBU5PM QxSa7s19qpJnfZEkz0Z7uGM+F3f1pG+WBSWzzeswziPF40ZPpwcOBUgm8GB9pQ/uYASz acThix9vwXX3jrhnFBAhPupLP2+H7DJYEFpq7QeqGK0rOPwgAz3T2RCuRRb0JnHelC24 ikBg== X-Gm-Message-State: AOJu0YwTK/heHg9f1AjVZxHKaRsr4QApEAVnWulAoy2+Cgf6C5Djgtec vCCXBjQcCE5/+rTRNZyUvc3OSQxKPqcl X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:93d2:18cc:4d63:45ba]) (user=irogers job=sendgmr) by 2002:a05:6902:1083:b0:d9a:4f4c:961b with SMTP id v3-20020a056902108300b00d9a4f4c961bmr353592ybu.1.1698186270729; Tue, 24 Oct 2023 15:24:30 -0700 (PDT) Date: Tue, 24 Oct 2023 15:23:11 -0700 In-Reply-To: <20231024222353.3024098-1-irogers@google.com> Message-Id: <20231024222353.3024098-9-irogers@google.com> Mime-Version: 1.0 References: <20231024222353.3024098-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Subject: [PATCH v3 08/50] perf callchain: Make display use of branch_type_stat const From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Leo Yan , Song Liu , Sandipan Das , James Clark , Anshuman Khandual , Miguel Ojeda , Liam Howlett , Yang Jihong , Athira Rajeev , Kajol Jain , K Prateek Nayak , Sean Christopherson , Yanteng Si , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Masami Hiramatsu , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 15:25:07 -0700 (PDT) Display code doesn't modify the branch_type_stat so switch uses to const. This is done to aid refactoring struct callchain_list where current the branch_type_stat is embedded even if not used. Signed-off-by: Ian Rogers --- tools/perf/util/branch.c | 4 ++-- tools/perf/util/branch.h | 4 ++-- tools/perf/util/callchain.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/branch.c b/tools/perf/util/branch.c index 378f16a24751..ab760e267d41 100644 --- a/tools/perf/util/branch.c +++ b/tools/perf/util/branch.c @@ -109,7 +109,7 @@ const char *get_branch_type(struct branch_entry *e) return branch_type_name(e->flags.type); } -void branch_type_stat_display(FILE *fp, struct branch_type_stat *st) +void branch_type_stat_display(FILE *fp, const struct branch_type_stat *st) { u64 total = 0; int i; @@ -171,7 +171,7 @@ static int count_str_scnprintf(int idx, const char *str, char *bf, int size) return scnprintf(bf, size, "%s%s", (idx) ? " " : " (", str); } -int branch_type_str(struct branch_type_stat *st, char *bf, int size) +int branch_type_str(const struct branch_type_stat *st, char *bf, int size) { int i, j = 0, printed = 0; u64 total = 0; diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h index e41bfffe2217..87704d713ff6 100644 --- a/tools/perf/util/branch.h +++ b/tools/perf/util/branch.h @@ -86,8 +86,8 @@ void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags, const char *branch_type_name(int type); const char *branch_new_type_name(int new_type); const char *get_branch_type(struct branch_entry *e); -void branch_type_stat_display(FILE *fp, struct branch_type_stat *st); -int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize); +void branch_type_stat_display(FILE *fp, const struct branch_type_stat *st); +int branch_type_str(const struct branch_type_stat *st, char *bf, int bfsize); const char *branch_spec_desc(int spec); diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 18d545c0629e..cde4860e6f28 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -1339,7 +1339,7 @@ static int count_float_printf(int idx, const char *str, float value, static int branch_to_str(char *bf, int bfsize, u64 branch_count, u64 predicted_count, u64 abort_count, - struct branch_type_stat *brtype_stat) + const struct branch_type_stat *brtype_stat) { int printed, i = 0; @@ -1403,7 +1403,7 @@ static int counts_str_build(char *bf, int bfsize, u64 abort_count, u64 cycles_count, u64 iter_count, u64 iter_cycles, u64 from_count, - struct branch_type_stat *brtype_stat) + const struct branch_type_stat *brtype_stat) { int printed; @@ -1430,7 +1430,7 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize, u64 abort_count, u64 cycles_count, u64 iter_count, u64 iter_cycles, u64 from_count, - struct branch_type_stat *brtype_stat) + const struct branch_type_stat *brtype_stat) { char str[256]; -- 2.42.0.758.gaed0368e0e-goog