Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp227751lqp; Thu, 4 Apr 2024 11:18:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHrL7AmSdzjbjryjg0R1Ri5r53b7sALVD6nQYsCG7F0MZI3eIDKsga4HtiYPJ7kaMmAi9OuEwK2TS1QiSaqr3UnYoMtG9MUpW0VmqdEA== X-Google-Smtp-Source: AGHT+IEpLtwjRH7iA54R2uOh5NeolYA+Hahc8hWt059n5ne5ZwlWrtAs7o8C5YUzfhFuaye/L6/+ X-Received: by 2002:a05:6a20:5b23:b0:1a7:9b3:9e6d with SMTP id kl35-20020a056a205b2300b001a709b39e6dmr577442pzb.53.1712254733839; Thu, 04 Apr 2024 11:18:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712254733; cv=pass; d=google.com; s=arc-20160816; b=x3URic/nO5EcpKsdYmOIl3xggWgf8WPr2hSz3XUpCzXrgcf7+pRypQaDwQkjKkKiKz L7BQ9nxUdGO1J+3cfCAVbKL86Q/pwSwyYHzITNzzRxVUc0mFpL2hLkuafbiC4b73V2Tb 7VGZy8YF9SCMCta95iXfj+HCOZTOuX4o3T2bb6J5EHMkXd+2HB7pnU1l1bIBwJRP4HFR jwLuH+RHQ/HZSvXGXRvGIdYkcNAauLpbQA3ncwkTXboJMgc3mZXFwHpSnjc5fLh46/iL rOJ39DbTAQtBi8csDtoUDzv16AygLZGD+vJvpWD4S0teafC5wrJoQnR5lWGyelqEpVlr ndVw== 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=TSW3ftRCU76oNCRUdCVufzaSzsX9MbU363RIAPzHBDQ=; fh=fHhbvXgCev/wpffLVpfaAi8pPyv7hrTyhVPgsZ7HNrs=; b=EwIewO1YQgWJIXN59ZU7mBLIZbHn5Fq2+Nwi5SkGwrPTbsTxcL7lKB0siu6/mI41B0 c9SPFqQetEKVquEWNLBDf8qyhyyO/MtQvYgJjtZ10baGcy13WBAexRrpcLTOfg8+z1SX 0GeGNCC08SQyerQTjgs3A/nIOgZ4MLGnCFWJzlwUC9YPiw0+1eQemYs1/FoW/38zmxTw xPcV9TuAkHdxYKOWSiLGpFuVzZTV0kf6e8yThmnvqPT6dIYXI5QuJLm00UrqeXgnvXxU 7tJI272/mLwYFdwqhYsiV+n2JF21LNycOX+gbN4Ig7tnvLANpMMCgPXMVL+GOj1gq7x0 yw0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GFL5JYvJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d22-20020a634f16000000b005d8c50790d7si15250782pgb.447.2024.04.04.11.18.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 11:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GFL5JYvJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131926-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 22781B29913 for ; Thu, 4 Apr 2024 17:59:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F89E1350D7; Thu, 4 Apr 2024 17:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GFL5JYvJ" 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 4CD631339B1; 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=1712253443; cv=none; b=S4aV/Hl31oeCo0DsM+LGk38d7N58Li3nVa9WWhbqPJsSW/vNiHdn1SDlIUfOrUL1mnzM+mfNpWajYOTR43ctq46WlvebmTiRLz0KVAZYR12+Hj5g0tq+BoXYRmVYICf2krz2HpEwc/HJimq3z610MfbFePv6+LOo++7GqPXwA7s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712253443; c=relaxed/simple; bh=zOkpmF2bfwe8D5R+ONfcu1WFleIDXUSyCE14ZC5NB/4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rcj06WOfqEwcv64qh3HWQ8+01AZhGdD4Z5v5yM37e0L/nZPPxBafXaD06GvmgPxUt7mTzNPF3oBgCDtxIOwaQ5FwYfbzYqaH1LSmrhZ/K5UjSKhYZRBQbtc1JBuR79NevCdZJopWqGnwKkoyoG4AJHI4ToG1P4ilwTO/ulf1zcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GFL5JYvJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD8BC43330; Thu, 4 Apr 2024 17:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712253442; bh=zOkpmF2bfwe8D5R+ONfcu1WFleIDXUSyCE14ZC5NB/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GFL5JYvJQKECvIkWeaD9FDcy67MEtBVJdlLjvsd93jDYlHXxE7GyoneUqbQviyS3Y OxSDbzIL0r5rrxUgfbvZHGikfw63P9vFcbByrvWZ5rgqThJgR0LX/nrJbFRpDBzCcU p1sIvkrwEfiYxEWFi71ZPz0N+ET67nVz5UvuGOeI6STjtQjm5jWJZ8s57En60n7FgX x8KPyuW+x93vohjQui3fSPSqKoRRvhVgR/PGFjqibr8Les4k0hxP3WPIGPvJGUy6uB SA/DixozWwQxLIy3AzT0+W7yb8AujY8GlFEYEQDs+XL6qw9zKpcz1OmbJ5Tt6RSixp ZdyOhr0NV2dOQ== 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 8/9] perf annotate: Move nr_events struct to annotated_source Date: Thu, 4 Apr 2024 10:57:15 -0700 Message-ID: <20240404175716.1225482-9-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/util/annotate.c | 6 +++--- tools/perf/util/annotate.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 1fd51856d78f..5f79ae0bccfd 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1584,7 +1584,7 @@ static double annotation_line__max_percent(struct annotation_line *al, double percent_max = 0.0; int i; - for (i = 0; i < notes->nr_events; i++) { + for (i = 0; i < notes->src->nr_events; i++) { double percent; percent = annotation_data__percent(&al->data[i], @@ -1674,7 +1674,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati if (al->offset != -1 && percent_max != 0.0) { int i; - for (i = 0; i < notes->nr_events; i++) { + for (i = 0; i < notes->src->nr_events; i++) { double percent; percent = annotation_data__percent(&al->data[i], percent_type); @@ -1846,7 +1846,7 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel, return err; annotation__init_column_widths(notes, sym); - notes->nr_events = nr_pcnt; + notes->src->nr_events = nr_pcnt; annotation__update_column_widths(notes); sym->annotate2 = 1; diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 382705311d28..d22b9e9a2fad 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -247,6 +247,7 @@ struct cyc_hist { * to see each group separately, that is why symbol__annotate2() * sets src->nr_histograms to evsel->nr_members. * @samples: Hash map of sym_hist_entry. Keyed by event index and offset in symbol. + * @nr_events: Number of events in the current output. * @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. @@ -265,6 +266,7 @@ struct annotated_source { struct sym_hist *histograms; struct hashmap *samples; int nr_histograms; + int nr_events; int nr_entries; int nr_asm_entries; int max_jump_sources; @@ -311,7 +313,6 @@ struct annotated_branch { struct LOCKABLE annotation { u64 start; - int nr_events; struct annotated_source *src; struct annotated_branch *branch; }; @@ -335,7 +336,7 @@ static inline int annotation__cycles_width(struct annotation *notes) static inline int annotation__pcnt_width(struct annotation *notes) { - return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events; + return (symbol_conf.show_total_period ? 12 : 7) * notes->src->nr_events; } static inline bool annotation_line__filter(struct annotation_line *al) -- 2.44.0.478.gd926399ef9-goog