Received: by 2002:ab2:804:0:b0:1f4:6637:5750 with SMTP id q4csp1211728lqe; Thu, 11 Apr 2024 11:39:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZXAFBbcGFLB4H5A+BGTCIgQeXZZbA8oKjIdbwxBZeUWI3CkIDzn2dhEKJf2jS6R2DzKwnoS3/XZmZSDlUQtCQtI2Cr4ZUVzxQ9o0Y/A== X-Google-Smtp-Source: AGHT+IEIPBmrkc1AQ2gNrbBbG/Z/z5ux3/5dlLlWWgkuTU8nVZzD7j/LT0AMLUDU90epjLrA0ufK X-Received: by 2002:a17:906:1392:b0:a51:7a49:4a3a with SMTP id f18-20020a170906139200b00a517a494a3amr355106ejc.54.1712860763351; Thu, 11 Apr 2024 11:39:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712860763; cv=pass; d=google.com; s=arc-20160816; b=Z9an8bhJhUVnK2WMCWVDPxMSQUbavn/zSEqsW18nEtVxVqxAm5cyYh6NCJC2ZIM7xb TpBLb3URmPiJMDeLebqdvxqfDNL0BVL835w9b4IkDWMZTCvUE3NBASH6GTG4vV+ZDF7H 8JlNiOk5XfbU6IDtk0ID57SSL5aA0a8Qu2ezJrYhUF+d/FrfSUg/0qjwvkbxMBWsFMAF OKtyYUGiwOT9Nsf9UjQ7buQAtnlbFVBgfNJDAK3fT71k8DTAMVREfXKa9r8VqskrTTta vabQV/yB3o7T1UvNHRLrsRpP7pDxUln8y/msZen0O/EvCsCDlyF3EDpdQQF08W4XjdUw pSzQ== 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=eKac+GBJpLZQXr+XiSgMHh5wQKQxrU89WWQk6sGMqNo=; fh=BZzRcd5Y2vYJmsOPOcIEb0V/BdS2GmLADdQhxuBcOoU=; b=QAhnmJcAaLETd8I2TUBeuoCOVc8gaaUb+1EStB2PjCye+uLVXz+vc8cNfTkbRGXT34 jiPdtT51zbpSrbQqaMjTtjnligXn5zwldGwebrCMXsChE/wwG2Xx1SuHVMfKlJXURwxQ iG7okgO3azhXgYvd3LsWHEvIvk9EGqL9ggUA5PlR3WipBrS6on/v5xUBjr1hr+3NxF3i 1O1l92obZaRJYXxnhwpx2dbLyDlywbCOI7NmC+jz5C8h5u2JP+igQioU5fl5iG5xnceA IQ8Yusv0ouoZWCuWGzB9Zk1ruAyA6v8/ZGCYJjwg5BZHAmywNslaUGVZ6EQmh54tL7MV fwkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZwjgXOhN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g15-20020a1709067c4f00b00a4e8aaa9f04si981302ejp.518.2024.04.11.11.39.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 11:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZwjgXOhN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141464-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B870C1F29FCA for ; Thu, 11 Apr 2024 18:39:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25E7D205E29; Thu, 11 Apr 2024 18:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZwjgXOhN" 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 48E55205E15; Thu, 11 Apr 2024 18:17:20 +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=1712859440; cv=none; b=RD960ni0dJYzgm7QKbBsNx9nMBoLERZNyjxzwGahx0ix9y7gYsSD/+nQtxmhHY2ZzRkflKlrxEqu0Sef4T4jlVzNTx/QCBLh5mDpbpenimPIYGRU8YEjoO0xVMhUsi2VmHUkL6gWSUhkhuXFfUDcG20AHP140gC/wlvhH04fRwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712859440; c=relaxed/simple; bh=b6PPJY9P9PsJamKQ3wTtANrrHHGiwci1Vnn5BEBKsy4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=irey9946sGdf2AqjtLmq73b21HYFk/FA9vwVOp0JwbqiJ+EwK42FUC34RRGl3zUU2+/5T0HscnS+lJrQqADVlnZZFy0t2fGozHYzWI3/D1Wvi1nR6U91B3WkdZfr6xPd0uFbHbo5TuIxNX/31WQyICrUP8ZAq72qYh2DObYYQqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZwjgXOhN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCF25C113CD; Thu, 11 Apr 2024 18:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712859440; bh=b6PPJY9P9PsJamKQ3wTtANrrHHGiwci1Vnn5BEBKsy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwjgXOhNBXHQfDdQq3S2xKYRXuAAeXn+Py2fBF3NCGyyBROyrdH9kkfbQM8GHPB9/ KAlMNHAZTNG06mztOVeXZ60KcAlBWKtM7TB9PzDEeAes1PC1RaUktTA3ebQuPIc266 8v5vdRf1mMZWS6sJGHpXkxV409GI6HHUUZ/RMdXv8vG/dz7mcVjHZDsNg+4R6vwAhX EWAQsx528Q62x9zCOxAHwL2b7xOJxxG7ICNPCPhn/NxnxAYEBI36dlH/sjGvwPdlHN F4W6WzIfL/ie/sW/DrfsQLQGDhCh8nXlgw3q3+GT9mSvqIDh7upIGIpKbSk4aKW2hY iScsF0XtoSn0Q== 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, Stephane Eranian , Andi Kleen , Athira Rajeev Subject: [PATCH v2 2/3] perf hist: Add weight fields to hist entry stats Date: Thu, 11 Apr 2024 11:17:17 -0700 Message-ID: <20240411181718.2367948-2-namhyung@kernel.org> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog In-Reply-To: <20240411181718.2367948-1-namhyung@kernel.org> References: <20240411181718.2367948-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 Like period and sample numbers, it'd be better to track weight values and display them in the output rather than having them as sort keys. This patch just adds a few more fields to save the weights in a hist entry. It'll be displayed as new output fields in the later patch. Signed-off-by: Namhyung Kim --- tools/perf/util/hist.c | 12 ++++++++++-- tools/perf/util/hist.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index fa359180ebf8..9d43f8ae412d 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -308,6 +308,9 @@ static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src) dest->period_us += src->period_us; dest->period_guest_sys += src->period_guest_sys; dest->period_guest_us += src->period_guest_us; + dest->weight1 += src->weight1; + dest->weight2 += src->weight2; + dest->weight3 += src->weight3; dest->nr_events += src->nr_events; } @@ -315,7 +318,9 @@ static void he_stat__decay(struct he_stat *he_stat) { he_stat->period = (he_stat->period * 7) / 8; he_stat->nr_events = (he_stat->nr_events * 7) / 8; - /* XXX need decay for weight too? */ + he_stat->weight1 = (he_stat->weight1 * 7) / 8; + he_stat->weight2 = (he_stat->weight2 * 7) / 8; + he_stat->weight3 = (he_stat->weight3 * 7) / 8; } static void hists__delete_entry(struct hists *hists, struct hist_entry *he); @@ -614,7 +619,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists, cmp = hist_entry__cmp(he, entry); if (!cmp) { if (sample_self) { - he_stat__add_period(&he->stat, period); + he_stat__add_stat(&he->stat, &entry->stat); hist_entry__add_callchain_period(he, period); } if (symbol_conf.cumulate_callchain) @@ -731,6 +736,9 @@ __hists__add_entry(struct hists *hists, .stat = { .nr_events = 1, .period = sample->period, + .weight1 = sample->weight, + .weight2 = sample->ins_lat, + .weight3 = sample->p_stage_cyc, }, .parent = sym_parent, .filtered = symbol__parent_filter(sym_parent) | al->filtered, diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 8f072f3749eb..f34f101c36c2 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -163,6 +163,9 @@ struct he_stat { u64 period_us; u64 period_guest_sys; u64 period_guest_us; + u64 weight1; + u64 weight2; + u64 weight3; u32 nr_events; }; -- 2.44.0.683.g7961c838ac-goog