Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1558170rdb; Wed, 24 Jan 2024 21:51:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNbXvPGa3Ay1ACxY2ScCohAXNjRv7HIIr46surjAyljOlJB8uv7odI2+HtStEN84LbN+KN X-Received: by 2002:a2e:920a:0:b0:2ce:dfc:db78 with SMTP id k10-20020a2e920a000000b002ce0dfcdb78mr216609ljg.29.1706161902553; Wed, 24 Jan 2024 21:51:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706161902; cv=pass; d=google.com; s=arc-20160816; b=Nolz7kG6M0JJvrMQcrKu0P0xcExrqVAygMtUNPYtREZK8msfOhML+yAqTHxjHHUjLo gMRFKp/jDYPBmWgQWiM3cKmim1badL8wdGrX42pDLaVZRmaBxiLQmfGSnT+SFiZd4zCb FZugAW9nRcd9kzvYyXdpu6kqchnnLbhjg7sy3fmttEpLsaoE64A7mCFunBqijP9eL7Qy Z3EeQcIe+qGJNYxgtHTh32rzIhjgSzQhm+uDpK+Yvb/lf79N7hOhh4bI7VoIeGB56Y2L memWEdECCOTXh6EQJ+CWWZV8AiEQq7wGaWB7XBXEfpnn5opWRfhmVDPJ7dYn92MQrRGN ezcQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=Vs1qdYOU8Jotm/J152Kkc7f90nqgEZjfAt9HmfbGWss=; fh=dyge86sMuCDHNoeA4Hs26J0u6bk1vU5EkV6K1p09iQY=; b=TK6qGQP8SWkeKCYsOfGEw11y70togRsHSXyJ4511sgKqPVJKVS9hY03Z2voK5W/0IE 2rKu2OcKjd7TPe555ZLVSUdGPo4C0FLR6nVhR/9GfW21/8J7/oD8RLpoYoRFaAY74eOh Qy0N80HafSqPNchWZcaL7pYOLOIdQCSWDFEZKvOqIrYjOOi3TgytijSToGhoNXfITUHp 6rT/jOpIqP9ULxA/NXX9VHaiCcurvWUaGHf+iqtYT5qaI2TI/Ev1HowrHj254gV4XiRB 3pvGso+w6Z0YX+KmXfgSQRn9T2g5Z3S8/KNdVa+JpH6/cvjDaL7mupgUq7wgL3z6W3/M 0ZOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fbQc4cW8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37982-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. [147.75.80.249]) by mx.google.com with ESMTPS id d3-20020a50ea83000000b0055af917d3e6si5362576edo.413.2024.01.24.21.51.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 21:51:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fbQc4cW8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37982-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 239F71F23FA1 for ; Thu, 25 Jan 2024 05:51:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 764FC101FA; Thu, 25 Jan 2024 05:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fbQc4cW8" 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 92B4710A05; Thu, 25 Jan 2024 05:51:26 +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=1706161886; cv=none; b=P/8j+ay0/G9eFEuEFy/CDyeQcoh0h5WViSKuEHx6oGcPlHecvT6ylQq1fUGWyqNRSI0NVbc2iHYz12SYeOWlm59kBCZq8L6sWPz1ZiUcdFx3MahsEMCWi2pADBgaypOspeHE6FD9RsGdQRhUxc+As+In1XgF1RyHr2YqYg18+eE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706161886; c=relaxed/simple; bh=dJn0iZwDo3YjbbXFWkfRSJfzznH/m2xLg/1aaKwYlwE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cRoJqOuzn3m7nqGu6+qptsFSUK27/m/D7BJuLxWS1F30hvjsQa2hh76fN77cOENA6oI4wQ00KNbyRakTdvNCBXZ7vGr6kswdBDna2NLyB+n59NEfZf6Ib7uLZadkL/a12aW8k/yGS9wfc362FKBL2j215k/zCRV+HOIAkfIq6f4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fbQc4cW8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5AF8C433C7; Thu, 25 Jan 2024 05:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706161886; bh=dJn0iZwDo3YjbbXFWkfRSJfzznH/m2xLg/1aaKwYlwE=; h=From:To:Cc:Subject:Date:From; b=fbQc4cW8pjU2Miv/8zP1E8CxGxB9HjJzs9YEylsWJIGgviEIx9hN+pVJdqZ7aBDcl WHiUlarxsElM+Q+goHTGlifR+VvCumRtqAVznohp4PCrvXcj1FW7lAbEzPLuIr/zUE ANbZ8pqcGRmUfxupKKPBdflTPq2jgxE6yIGs1kuhET/QCKi/2J43pir1ob2qvP1wg+ Wt/8XJm1r07q+U7Czi8Iy2ugyGdMEWYrWRqYk1r+K7gFAXAabWXUd/nCU4gIAfadph ChpH5b/R7ap+KXHuYXaiV09E5n4g+TFlvRFxEja808DF3iwIKQqyGW/AXp5a62F54G 46ndNA4Hyg1jQ== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH RESEND] perf tools: Add -H short option for --hierarchy Date: Wed, 24 Jan 2024 21:51:24 -0800 Message-ID: <20240125055124.1579617-1-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit I found the hierarchy mode useful, but it's easy to make a typo when using it. Let's add a short option for that. Also update the documentation. :) Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-report.txt | 29 ++++++++++++++++++++- tools/perf/Documentation/perf-top.txt | 32 +++++++++++++++++++++++- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-top.c | 2 +- 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 38f59ac064f7..d8b863e01fe0 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt @@ -531,8 +531,35 @@ include::itrace.txt[] --raw-trace:: When displaying traceevent output, do not use print fmt or plugins. +-H:: --hierarchy:: - Enable hierarchical output. + Enable hierarchical output. In the hierarchy mode, each sort key groups + samples based on the criteria and then sub-divide it using the lower + level sort key. + + For example: + In normal output: + + perf report -s dso,sym + # Overhead Shared Object Symbol + 50.00% [kernel.kallsyms] [k] kfunc1 + 20.00% perf [.] foo + 15.00% [kernel.kallsyms] [k] kfunc2 + 10.00% perf [.] bar + 5.00% libc.so [.] libcall + + In hierarchy output: + + perf report -s dso,sym --hierarchy + # Overhead Shared Object / Symbol + 65.00% [kernel.kallsyms] + 50.00% [k] kfunc1 + 15.00% [k] kfunc2 + 30.00% perf + 20.00% [.] foo + 10.00% [.] bar + 5.00% libc.so + 5.00% [.] libcall --inline:: If a callgraph address belongs to an inlined function, the inline stack diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 3c202ec080ba..a754875fa5bb 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt @@ -261,8 +261,38 @@ Default is to monitor all CPUS. --raw-trace:: When displaying traceevent output, do not use print fmt or plugins. +-H:: --hierarchy:: - Enable hierarchy output. + Enable hierarchical output. In the hierarchy mode, each sort key groups + samples based on the criteria and then sub-divide it using the lower + level sort key. + + For example, in normal output: + + perf report -s dso,sym + # + # Overhead Shared Object Symbol + # ........ ................. ........... + 50.00% [kernel.kallsyms] [k] kfunc1 + 20.00% perf [.] foo + 15.00% [kernel.kallsyms] [k] kfunc2 + 10.00% perf [.] bar + 5.00% libc.so [.] libcall + + In hierarchy output: + + perf report -s dso,sym --hierarchy + # + # Overhead Shared Object / Symbol + # .......... ...................... + 65.00% [kernel.kallsyms] + 50.00% [k] kfunc1 + 15.00% [k] kfunc2 + 30.00% perf + 20.00% [.] foo + 10.00% [.] bar + 5.00% libc.so + 5.00% [.] libcall --overwrite:: Enable this to use just the most recent records, which helps in high core count diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index f2ed2b7e80a3..ccb91fe6b876 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -1410,7 +1410,7 @@ int cmd_report(int argc, const char **argv) "only show processor socket that match with this filter"), OPT_BOOLEAN(0, "raw-trace", &symbol_conf.raw_trace, "Show raw trace event output (do not use print fmt or plugins)"), - OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy, + OPT_BOOLEAN('H', "hierarchy", &symbol_conf.report_hierarchy, "Show entries in a hierarchy"), OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", "'always' (default), 'never' or 'auto' only applicable to --stdio mode", diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index baf1ab083436..03cf45088fd8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1573,7 +1573,7 @@ int cmd_top(int argc, const char **argv) "add last branch records to call history"), OPT_BOOLEAN(0, "raw-trace", &symbol_conf.raw_trace, "Show raw trace event output (do not use print fmt or plugins)"), - OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy, + OPT_BOOLEAN('H', "hierarchy", &symbol_conf.report_hierarchy, "Show entries in a hierarchy"), OPT_BOOLEAN(0, "overwrite", &top.record_opts.overwrite, "Use a backward ring buffer, default: no"), -- 2.43.0.429.g432eaa2c6b-goog