diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2023-03-30 16:18:32 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-04 09:39:56 -0300 |
commit | 5ef506130c739a0601d234b36f5dfd2129f966c0 (patch) | |
tree | c7fda9d5089e91e4b69f6d9faf52bd603607d2b1 /tools/perf/Documentation | |
parent | 616b14b47a86d880ba21a363440f20f82152d8f2 (diff) | |
download | lwn-5ef506130c739a0601d234b36f5dfd2129f966c0.tar.gz lwn-5ef506130c739a0601d234b36f5dfd2129f966c0.zip |
perf top: Add --branch-history option
Add --branch-history option, to act the same as that option does for
perf report.
Example:
$ cat tcallf.c
volatile a = 10000, b = 100000, c;
__attribute__((noinline)) f2()
{
c = a / b;
}
__attribute__((noinline)) f1()
{
f2();
f2();
}
main()
{
while (1)
f1();
}
$ gcc -w -g -o tcallf tcallf.c
$ ./tcallf &
[1] 29409
$ perf top -e cycles:u -t $(pidof tcallf) --stdio --no-children --branch-history
PerfTop: 3819 irqs/sec kernel: 0.0% exact: 0.0% lost: 0/0 drop: 0/0 [4000Hz cycles:u], (target_tid: 29409)
--------------------------------------------------------------------------------------------------------------------
49.01% tcallf.c:5 [.] f2 tcallf
|
|--24.91%--f2 tcallf.c:4
| |
| |--17.14%--f1 tcallf.c:11 (cycles:1)
| | f1 tcallf.c:11
| | f2 tcallf.c:6 (cycles:3)
| | f2 tcallf.c:4
| | f1 tcallf.c:10 (cycles:2)
| | f1 tcallf.c:9
| | main tcallf.c:16 (cycles:1)
| | main tcallf.c:16
| | main tcallf.c:16 (cycles:1)
| | main tcallf.c:16
| | f1 tcallf.c:12 (cycles:1)
| | f1 tcallf.c:12
| | f2 tcallf.c:6 (cycles:3)
| | f2 tcallf.c:4
| | f1 tcallf.c:11 (cycles:1 iter:1 avg_cycles:12)
| | f1 tcallf.c:11
| | f2 tcallf.c:6 (cycles:3 iter:1 avg_cycles:12)
| | f2 tcallf.c:4
| | f1 tcallf.c:10 (cycles:2 iter:1 avg_cycles:12)
| |
| --7.78%--f1 tcallf.c:10 (cycles:2)
| f1 tcallf.c:9
| main tcallf.c:16 (cycles:1)
| main tcallf.c:16
| main tcallf.c:16 (cycles:1)
| main tcallf.c:16
| f1 tcallf.c:12 (cycles:1)
| f1 tcallf.c:12
| f2 tcallf.c:6 (cycles:3)
| f2 tcallf.c:4
| f1 tcallf.c:11 (cycles:1)
| f1 tcallf.c:11
| f2 tcallf.c:6 (cycles:3)
| f2 tcallf.c:4
| f1 tcallf.c:10 (cycles:2 iter:1 avg_cycles:12)
| f1 tcallf.c:9
| main tcallf.c:16 (cycles:1 iter:1 avg_cycles:12)
| main tcallf.c:16
| main tcallf.c:16 (cycles:1 iter:1 avg_cycles:12)
...
$ pkill tcallf
[1]+ Terminated ./tcallf
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20230330131833.12864-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Documentation')
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 619cc8143ad5..3c202ec080ba 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt @@ -254,6 +254,10 @@ Default is to monitor all CPUS. The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k Note that this feature may not be available on all processors. +--branch-history:: + Add the addresses of sampled taken branches to the callstack. + This allows to examine the path the program took to each sample. + --raw-trace:: When displaying traceevent output, do not use print fmt or plugins. |