Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp214338lqp; Thu, 4 Apr 2024 10:58:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3HgZIj0STAV46OAnlpE9puxTDgq4wDZ2qva3wEVrdHlxcr1NKseg45hyfxfEYRZFUdvXXnBDL3p4iGyMtebHJU6LOjuHttZZtTpfv7w== X-Google-Smtp-Source: AGHT+IHhGYSmDGNZN3uoUhGcjdp0niZ4E+8pM+NpB5+BhIZVf2yyC6ZpE2iyCNZFNHk75r4FqPWa X-Received: by 2002:a17:903:246:b0:1e0:b1a7:473e with SMTP id j6-20020a170903024600b001e0b1a7473emr3020446plh.67.1712253518897; Thu, 04 Apr 2024 10:58:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712253518; cv=pass; d=google.com; s=arc-20160816; b=lRrqFtJ9O/jR1mUgf0OdcdGLcLMSMUyR16RPdM21JMi5SNOTJh0Zl8bzKEVMB06kcJ ys5Tim4tRQ/xb3p8XjavtBhABTLc8epKsSt85BOTYqaeogiXwjVTLjnTZpr+3lK93+Er bLiI98LAzKx8ugqEiL+xeV5iVHory8sBU3wmydJnpGTNJuUQ9Mqbbve1yI9+bI6XH9TG KqJK3OM1ewmESHN8EwcRWF70qZPTeB3rrOkTAC7aGTJ4IU+3aI7OVIdI4ZB8ORQMRzBt i0+MXG/aIHpLVYEiXcSu0tsTGikegMczu7fu94eNRU+cA22Kvt/a2uXTgAQLqh3Ryu3Q ot5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NGUlQH0LbZXFws/xkpOCRD/sdh5jcnr6E+jUiZvMyrk=; fh=fHhbvXgCev/wpffLVpfaAi8pPyv7hrTyhVPgsZ7HNrs=; b=JJz7nlsy5JRxvo5prcvV15VxDJCggXzmXmxs3YzRG9RyR6kHvzSWmWsgm/V6LlGgNa Jgs5VmffN0hmQyU3uGAP4+4cskicN6yiGRbwglZJ93Zqbm2SRSmYmq8zZSIQ4hIuOSEf HqifOjbc7vSQW2ZLdPx3k6fJ2dmSjrJpJbbnp28Q8bPW9aEo2OPVypY/V9yIGyR2glPe gPdVBgcnhZfUr+4+8vPMOROl6PTZCP0nQmK1WeQ6gnV2shjHygsxcHtz1aPjkcoXKB6D oqwQ/0wrkWwpsv68Gs1jIu+LbqDGCjtRMirn7P0T+VvqOE23V0J/AYL4YijWPUKDAAm1 s1ug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PLRMwyqH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mf15-20020a170902fc8f00b001e087e27e56si15541367plb.9.2024.04.04.10.58.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 10:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PLRMwyqH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8F405289E46 for ; Thu, 4 Apr 2024 17:58:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D62F134405; Thu, 4 Apr 2024 17:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PLRMwyqH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 748D812F37C; Thu, 4 Apr 2024 17:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712253442; cv=none; b=FAWdaB29uc4+Im7J/FS8LSiQXxg7ZWgKvnAYjxcWHdmf6HGX1HB8sCNxoBORk/J4IeLoV0pZKGZKyEflwxFzwWmnr/UMy4kbsE11bDRH0fZQtu2ltzaklTmbjtUb7GRymr98mqnzU+IjSTtSjcSD1drh2URHHdKHxD+H4UPiP1w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712253442; c=relaxed/simple; bh=JWXX9PYo6AsnQWhyMkd6vlh4yGAwW5IMqqn8kgE6iFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EGR04CR+RXcIK3H83iTja5Usv7TDdNXt9/XqWq+dtI5aIiZYp4M0IP02jDvFCB1nx8ypIFn+px6FhiBIJ35EjAEsV8JXeC5QKlF6fTAcMPAb3T2C7xu8G9MZ+KvU4ACMhwl6sG6XVE0LPMrYNktQIbnvEZ4XWA9DD2wxh1VOTIg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PLRMwyqH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE72BC433F1; Thu, 4 Apr 2024 17:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712253442; bh=JWXX9PYo6AsnQWhyMkd6vlh4yGAwW5IMqqn8kgE6iFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLRMwyqH4kak3eAT7K0+hug8hKn0h1WpNFwrJXxzwD0p4cAVn+iNBvlz2ahGWqJlX Ampw/0yoVStwFaloX+t37hENnS1MKsHjt2EBWyrYexkOlB+0egA4KinVuM6dZt7TJv RnliIv1pNDwCxB3qTU/H+OusUAwY0buY9nRoltKsQ0vpbdkrZBy9+5xZf9KBmtrU4S SE1+j6Ofbf0QAUOV9Ta8Wbyry936Fqqn8g/Rg5ICv4UockMSpZZJu1Rq9xnpAh7Rls 1ZqFJqnh7B9O9xpoTpaIoi2i6jQ4cpAjWYbiiC2qrg5sbHSzJVVIeIf5Pd7FD0F8zv 8FoJRUh8TR4qA== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH 7/9] perf annotate: Move max_jump_sources struct to annotated_source Date: Thu, 4 Apr 2024 10:57:14 -0700 Message-ID: <20240404175716.1225482-8-namhyung@kernel.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog In-Reply-To: <20240404175716.1225482-1-namhyung@kernel.org> References: <20240404175716.1225482-1-namhyung@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It's only used in perf annotate output which means functions with actual samples. No need to consume memory for every symbol (annotation). Signed-off-by: Namhyung Kim --- tools/perf/ui/browsers/annotate.c | 2 +- tools/perf/util/annotate.c | 6 +++--- tools/perf/util/annotate.h | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 032642a0b4b6..0e16c268e329 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -49,7 +49,7 @@ static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, b if (current && (!browser->use_navkeypressed || browser->navkeypressed)) return HE_COLORSET_SELECTED; - if (nr == notes->max_jump_sources) + if (nr == notes->src->max_jump_sources) return HE_COLORSET_TOP; if (nr > 1) return HE_COLORSET_MEDIUM; diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0be744bb529c..1fd51856d78f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1373,8 +1373,8 @@ annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym) if (target == NULL) continue; - if (++target->jump_sources > notes->max_jump_sources) - notes->max_jump_sources = target->jump_sources; + if (++target->jump_sources > notes->src->max_jump_sources) + notes->src->max_jump_sources = target->jump_sources; } } @@ -1432,7 +1432,7 @@ annotation__init_column_widths(struct annotation *notes, struct symbol *sym) notes->src->widths.addr = notes->src->widths.target = notes->src->widths.min_addr = hex_width(symbol__size(sym)); notes->src->widths.max_addr = hex_width(sym->end); - notes->src->widths.jumps = width_jumps(notes->max_jump_sources); + notes->src->widths.jumps = width_jumps(notes->src->max_jump_sources); notes->src->widths.max_ins_name = annotation__max_ins_name(notes); } diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 402ae774426b..382705311d28 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -250,6 +250,8 @@ struct cyc_hist { * @nr_entries: Number of annotated_line in the source list. * @nr_asm_entries: Number of annotated_line with actual asm instruction in the * source list. + * @max_jump_sources: Maximum number of jump instructions targeting to the same + * instruction. * @widths: Precalculated width of each column in the TUI output. * * disasm_lines are allocated, percentages calculated and all sorted by percentage @@ -265,6 +267,7 @@ struct annotated_source { int nr_histograms; int nr_entries; int nr_asm_entries; + int max_jump_sources; struct { u8 addr; u8 jumps; @@ -309,7 +312,6 @@ struct annotated_branch { struct LOCKABLE annotation { u64 start; int nr_events; - int max_jump_sources; struct annotated_source *src; struct annotated_branch *branch; }; -- 2.44.0.478.gd926399ef9-goog