Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp122308rdf; Thu, 2 Nov 2023 16:01:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCJy+x1il0yRUrZ361I0j2IcAqYRkgvimOxVcuTE17bHQmVmuiigZz1plEDmdIfd0hGJ0Q X-Received: by 2002:a05:6a20:7487:b0:15e:b8a1:57b0 with SMTP id p7-20020a056a20748700b0015eb8a157b0mr17868244pzd.39.1698966078120; Thu, 02 Nov 2023 16:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698966078; cv=none; d=google.com; s=arc-20160816; b=nrZB+CPOluAnG01g73B2t0Bcy4yXZHHr77GOaTHItDsOjvSjDFkxCXMYyl0nNReklb JGQIU504qRMeN4v5SqA91b5sTKUHUVIkdUcufrZ/l35/2UoUc694uOQcRyLBszLHxeny bFar5QyU6EZNsXjI0TOuBfsjcULehX2CBb0hFb2/HUGG1uInJqSrd/YHSmk8siWU5Akp c/O8BBjEXU7ABkIKaItRXBvFyBiHjac6SEeYFKEYMDQ6KKQgbfBJlGzdrNAE9rRZPdOe Bj7Ix5FHUlDI6KX6FhVHoDHsEJ7pMy7P4+WEmjNl2Q5mGi/UdomVZ6pda95Y7lCzZgRK 12yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ey+0UZmqeDT35g7wTG4FnvGKbLWcaZI1zn+iqlGpZ+g=; fh=Pbu1BQwhCOAA2d/C0IOLVYR5czI2/+Avx4u+s0uioL8=; b=Mbx+6SPwPCDUMafEBoI8k9Kqf5iTI7zT7SKhGN2JpGP54EueB/4dTOyiYjlK1PsFqr sNJoxap0+q5yXcMp3n2Hh1hKz7GmCsCOIo2mgcjzHdOQd42FGyg5cY4A256tW94gCDfI CasKP+uAJRZ/jd5uZtSObAf9ilYpLCaA/5lHqLJs2/nHbPUTAuixn/2ayHWR/fdpoOSH JEXAMyNLmOjavDrnxwKa/0fyuPGfcM+bvxmzSIIR9KrTUZo+Hmcwa6DjrswsaVDnCTul Ih/9Q0HQua5N+Bi5VJ4gUencxlpPCUm0ROWn0PQtrbezBMxysLZUhrwUzOLWjSadd2XN Ld5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gRawZkew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v135-20020a63618d000000b00569cd6ead3asi388565pgb.643.2023.11.02.16.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 16:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gRawZkew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id E99BE808D69C; Thu, 2 Nov 2023 16:00:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377548AbjKBXAW (ORCPT + 99 others); Thu, 2 Nov 2023 19:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjKBXAV (ORCPT ); Thu, 2 Nov 2023 19:00:21 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B218E199 for ; Thu, 2 Nov 2023 16:00:17 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-507a5edc2ebso585e87.1 for ; Thu, 02 Nov 2023 16:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698966016; x=1699570816; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ey+0UZmqeDT35g7wTG4FnvGKbLWcaZI1zn+iqlGpZ+g=; b=gRawZkewNySGdGrRrcPdMuNVhxNRAjcgOlzkPhyhkmCN/vXyz9wLI9vj9+aEhaQYlX 8ltAamGsxQSK3ySawEay16iNTcdQBfZu50c3a9MpOuTNYtvuLp4hENimqT4aamp5ByHK 2sjjhZAd7EqAIQJC662Lnp1hLFFeBsmmoyhUUmmApZqTcI9IbDFYLs7AQLk/ROQpNEEW rTR3X6Nj+ntd/LWMIaSOR0icUEx4gEO8cbhzzJ+NtjnOeXupgIv8/sAE24MOxX+eMJZx emCenJ7O0BANrnmiYX90aMqZRa6M5tXkORnhW7dR0kNoXU+1R3fxKMFOFjgbAd6wauHX SaWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698966016; x=1699570816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ey+0UZmqeDT35g7wTG4FnvGKbLWcaZI1zn+iqlGpZ+g=; b=ozTIbBBYXmCD+eezRXZGrvUWXxE/qofA7241xD7isshKbAH6pxXTAvsSoIHIBlAHj/ E0l2Xario+b5zbECPbZ+HqxGyI/ev2qJNdYRFNmF1jmRnFRdvI/ug2WCxg8omqAmlerF AjvvYDfz6KG5UCxYbUqPIA3kWtASEQs2/C53QIUrUDXXesoVAIvq4q5pm1nJuRYOakRO MMxIiZYC1t665/oHGwENeoDksJiAueD9ef5d6OTu0hRb8AUKzD+bJcdDi9pGHhxzl5P8 SVOsBNZEZUG/XIMmSsW0uAENbLuZ5DTufRVTD1JQXY//9Zo1/IAWXETMvhQ5u4PWOmK3 nEYA== X-Gm-Message-State: AOJu0YwmPubrYdSCRYArUg5TwAbB4cfa2f5OOIiGuF1fdUEIw45ITgVF gJ/O8b88OaULQzcfMptreTzUxQXL5TdMZygkImIgUg== X-Received: by 2002:a19:9153:0:b0:501:b029:1a47 with SMTP id y19-20020a199153000000b00501b0291a47mr73630lfj.1.1698966015632; Thu, 02 Nov 2023 16:00:15 -0700 (PDT) MIME-Version: 1.0 References: <20231102222653.4165959-1-namhyung@kernel.org> <20231102222653.4165959-5-namhyung@kernel.org> In-Reply-To: <20231102222653.4165959-5-namhyung@kernel.org> From: Ian Rogers Date: Thu, 2 Nov 2023 16:00:03 -0700 Message-ID: Subject: Re: [PATCH 4/5] perf annotate: Move some fields to annotated_source To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 02 Nov 2023 16:00:32 -0700 (PDT) On Thu, Nov 2, 2023 at 3:27=E2=80=AFPM Namhyung Kim w= rote: > > Some fields in the struct annotation are only used with annotated_source > so better to be moved there in order to reduce memory consumption for > other symbols. > > Signed-off-by: Namhyung Kim Reviewed-by: Ian Rogers Thanks, Ian > --- > tools/perf/ui/browsers/annotate.c | 12 ++++++------ > tools/perf/util/annotate.c | 17 +++++++++-------- > tools/perf/util/annotate.h | 14 +++++++------- > 3 files changed, 22 insertions(+), 21 deletions(-) > > diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/a= nnotate.c > index d2470f87344d..1b42db70c998 100644 > --- a/tools/perf/ui/browsers/annotate.c > +++ b/tools/perf/ui/browsers/annotate.c > @@ -384,7 +384,7 @@ static bool annotate_browser__toggle_source(struct an= notate_browser *browser) > if (al->idx_asm < offset) > offset =3D al->idx; > > - browser->b.nr_entries =3D notes->nr_entries; > + browser->b.nr_entries =3D notes->src->nr_entries; > notes->options->hide_src_code =3D false; > browser->b.seek(&browser->b, -offset, SEEK_CUR); > browser->b.top_idx =3D al->idx - offset; > @@ -402,7 +402,7 @@ static bool annotate_browser__toggle_source(struct an= notate_browser *browser) > if (al->idx_asm < offset) > offset =3D al->idx_asm; > > - browser->b.nr_entries =3D notes->nr_asm_entries; > + browser->b.nr_entries =3D notes->src->nr_asm_entries; > notes->options->hide_src_code =3D true; > browser->b.seek(&browser->b, -offset, SEEK_CUR); > browser->b.top_idx =3D al->idx_asm - offset; > @@ -435,7 +435,7 @@ static void ui_browser__init_asm_mode(struct ui_brows= er *browser) > { > struct annotation *notes =3D browser__annotation(browser); > ui_browser__reset_index(browser); > - browser->nr_entries =3D notes->nr_asm_entries; > + browser->nr_entries =3D notes->src->nr_asm_entries; > } > > static int sym_title(struct symbol *sym, struct map *map, char *title, > @@ -860,7 +860,7 @@ static int annotate_browser__run(struct annotate_brow= ser *browser, > browser->b.height, > browser->b.index, > browser->b.top_idx, > - notes->nr_asm_entries); > + notes->src->nr_asm_entries); > } > continue; > case K_ENTER: > @@ -991,8 +991,8 @@ int symbol__tui_annotate(struct map_symbol *ms, struc= t evsel *evsel, > > ui_helpline__push("Press ESC to exit"); > > - browser.b.width =3D notes->max_line_len; > - browser.b.nr_entries =3D notes->nr_entries; > + browser.b.width =3D notes->src->max_line_len; > + browser.b.nr_entries =3D notes->src->nr_entries; > browser.b.entries =3D ¬es->src->source, > browser.b.width +=3D 18; /* Percentage */ > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 92a9adf9d5eb..ee7b8e1848a8 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -2808,19 +2808,20 @@ void annotation__mark_jump_targets(struct annotat= ion *notes, struct symbol *sym) > void annotation__set_offsets(struct annotation *notes, s64 size) > { > struct annotation_line *al; > + struct annotated_source *src =3D notes->src; > > - notes->max_line_len =3D 0; > - notes->nr_entries =3D 0; > - notes->nr_asm_entries =3D 0; > + src->max_line_len =3D 0; > + src->nr_entries =3D 0; > + src->nr_asm_entries =3D 0; > > - list_for_each_entry(al, ¬es->src->source, node) { > + list_for_each_entry(al, &src->source, node) { > size_t line_len =3D strlen(al->line); > > - if (notes->max_line_len < line_len) > - notes->max_line_len =3D line_len; > - al->idx =3D notes->nr_entries++; > + if (src->max_line_len < line_len) > + src->max_line_len =3D line_len; > + al->idx =3D src->nr_entries++; > if (al->offset !=3D -1) { > - al->idx_asm =3D notes->nr_asm_entries++; > + al->idx_asm =3D src->nr_asm_entries++; > /* > * FIXME: short term bandaid to cope with assembl= y > * routines that comes with labels in the same co= lumn > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h > index d8a221591926..c51ceb857bd6 100644 > --- a/tools/perf/util/annotate.h > +++ b/tools/perf/util/annotate.h > @@ -268,10 +268,13 @@ struct cyc_hist { > * returns. > */ > struct annotated_source { > - struct list_head source; > - int nr_histograms; > - size_t sizeof_sym_hist; > - struct sym_hist *histograms; > + struct list_head source; > + int nr_histograms; > + size_t sizeof_sym_hist; > + struct sym_hist *histograms; > + int nr_entries; > + int nr_asm_entries; > + u16 max_line_len; > }; > > struct annotated_branch { > @@ -289,9 +292,6 @@ struct LOCKABLE annotation { > struct annotation_line **offsets; > int nr_events; > int max_jump_sources; > - int nr_entries; > - int nr_asm_entries; > - u16 max_line_len; > struct { > u8 addr; > u8 jumps; > -- > 2.42.0.869.gea05f2083d-goog >