linux/tools/perf
Jin Yao 2605af0f32 perf top: Support hotkey to change sort order
It would be nice if we can use a hotkey in perf top browser to select a
event for sorting.

For example:

  perf top --group -e cycles,instructions,cache-misses

  Samples
                  Overhead  Shared Object             Symbol
    40.03%  45.71%   0.03%  div                       [.] main
    20.46%  14.67%   0.21%  libc-2.27.so              [.] __random_r
    20.01%  19.54%   0.02%  libc-2.27.so              [.] __random
     9.68%  10.68%   0.00%  div                       [.] compute_flag
     4.32%   4.70%   0.00%  libc-2.27.so              [.] rand
     3.84%   3.43%   0.00%  div                       [.] rand@plt
     0.05%   0.05%   2.33%  libc-2.27.so              [.] __strcmp_sse2_unaligned
     0.04%   0.08%   2.43%  perf                      [.] perf_hpp__is_dynamic_en
     0.04%   0.02%   6.64%  perf                      [.] rb_next
     0.04%   0.01%   3.87%  perf                      [.] dso__find_symbol
     0.04%   0.04%   1.77%  perf                      [.] sort__dso_cmp

When user press hotkey '2' (event index, starting from 0), it indicates
to sort output by the third event in group (cache-misses).

  Samples
                  Overhead  Shared Object               Symbol
     4.07%   1.28%   6.68%  perf                        [.] rb_next
     3.57%   3.98%   4.11%  perf                        [.] __hists__insert_output
     3.67%  11.24%   3.60%  perf                        [.] perf_hpp__is_dynamic_e
     3.67%   3.20%   3.20%  perf                        [.] hpp__sort_overhead
     0.81%   0.06%   3.01%  perf                        [.] dso__find_symbol
     1.62%   5.47%   2.51%  perf                        [.] hists__match
     2.70%   1.86%   2.47%  libc-2.27.so                [.] _int_malloc
     0.19%   0.00%   2.29%  [kernel]                    [k] copy_page
     0.41%   0.32%   1.98%  perf                        [.] hists__decay_entries
     1.84%   3.67%   1.68%  perf                        [.] sort__dso_cmp
     0.16%   0.00%   1.63%  [kernel]                    [k] clear_page_erms

Now the output is sorted by cache-misses.

 v2:
 ---
 Zero the history if hotkey is pressed.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200324220711.6025-2-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-04-03 09:37:55 -03:00
..
arch perf symbols: Fix arm64 gap between kernel start and module end 2020-04-03 09:37:55 -03:00
bench perf bench: Clear struct sigaction before sigaction() syscall 2020-03-06 08:30:47 -03:00
Documentation perf top: Support --group-sort-idx to change the sort order 2020-04-03 09:37:55 -03:00
examples/bpf Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-01-28 16:02:33 -08:00
include/bpf perf bpf: Remove bpf/ subdir from bpf.h headers used to build bpf events 2020-02-18 10:13:28 -03:00
jvmti perf jvmti: Link against tools/lib/ctype.h to have weak strlcpy() 2019-10-15 11:47:38 -03:00
pmu-events perf jevents: Support test events folder 2020-03-24 10:35:59 -03:00
python
scripts perf scripting perl: Add common_callchain to fix argument order 2020-03-11 11:20:24 -03:00
tests perf build-test: Honour JOBS to override detection of number of cores 2020-04-03 09:37:55 -03:00
trace perf beauty prctl: Export the 'options' strarray 2020-02-11 16:41:50 -03:00
ui perf report/top TUI: Support hotkeys to let user select any event for sorting 2020-03-24 09:37:27 -03:00
util perf record: Add --all-cgroups option 2020-04-03 09:37:55 -03:00
.gitignore
Build
builtin-annotate.c perf annotate: Prefer cmdline option over default config 2020-02-27 10:45:08 -03:00
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c perf c2c: Fix return type for histogram sorting comparision functions 2020-01-14 13:29:21 -03:00
builtin-config.c
builtin-data.c
builtin-diff.c perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
builtin-evlist.c perf evsel: Introduce evsel_fprintf.h 2019-09-25 16:26:34 -03:00
builtin-ftrace.c
builtin-help.c
builtin-inject.c perf inject: Fix processing of ID index for injected instruction tracing 2019-12-04 12:39:53 -03:00
builtin-kallsyms.c
builtin-kmem.c perf callchain: Use 'struct map_symbol' in 'struct callchain_cursor_node' 2019-11-12 08:20:53 -03:00
builtin-kvm.c perf kvm: Use evlist layer api when possible 2019-11-06 15:43:05 -03:00
builtin-list.c perf list: Hide deprecated events by default 2019-10-19 15:35:01 -03:00
builtin-lock.c
builtin-mem.c
builtin-probe.c perf probe: Check return value of strlist__add() for -ENOMEM 2020-02-27 11:03:13 -03:00
builtin-record.c perf record: Add --all-cgroups option 2020-04-03 09:37:55 -03:00
builtin-report.c perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
builtin-sched.c perf sched timehist: Add support for filtering on CPU 2020-01-06 11:46:09 -03:00
builtin-script.c perf script: Add --show-cgroup-events option 2020-04-03 09:37:55 -03:00
builtin-stat.c perf stat: Show percore counts in per CPU output 2020-03-04 10:34:09 -03:00
builtin-timechart.c
builtin-top.c perf top: Support hotkey to change sort order 2020-04-03 09:37:55 -03:00
builtin-trace.c perf trace: Resolve prctl's 'option' arg strings to numbers 2020-02-11 16:41:50 -03:00
builtin-version.c
builtin.h
check-headers.sh tools include UAPI: Sync x86's syscalls_64.tbl, generic unistd.h and fcntl.h to pick up openat2 and pidfd_getfd 2020-02-11 16:41:06 -03:00
command-list.txt
CREDITS
design.txt
Makefile tools: Let O= makes handle a relative path with -C option 2020-03-06 17:08:28 -03:00
Makefile.config perf tools: Add file-handle feature test 2020-04-03 09:37:55 -03:00
Makefile.perf perf: Normalize gcc parameter when generating arch errno table 2020-03-26 11:04:01 -03:00
MANIFEST libperf: Move to tools/lib/perf 2020-01-06 11:46:09 -03:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h perf tools: Make usage of test_attr__* optional for perf-sys.h 2019-10-31 21:38:41 +01:00
perf-with-kcore.sh
perf.c libperf: Merge libperf_set_print() into libperf_init() 2019-09-25 09:51:49 -03:00
perf.h