Skip to content

perf annotate: Create a new '--tui-dump' option

Jin Yao lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4perf browser: Add a new 'dump' flagtools/perf/ui/browser.c tools/perf/ui/browser.h+34 -50 replies
2/4perf browser: bypass ui_init if in tui dump modetools/perf/builtin-annotate.c tools/perf/builtin-c2c.c tools/perf/builtin-report.c +3 more+12 -70 replies
3/4perf annotate: Process the new switch flag tui_dumptools/perf/builtin-annotate.c tools/perf/ui/browsers/annotate.c tools/perf/ui/browsers/hists.c +2 more+42 -200 replies
4/4perf annotate: Enable the '--tui-dump' modetools/perf/Documentation/perf-annotate.txt tools/perf/builtin-annotate.c+13 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/4] perf annotate: Create a new '--tui-dump' option

There is a requirement to let perf annotate support displaying the IPC/Cycle. In previous patch, this is supported in TUI mode. While it's not convenient for users since they have to take screen shots and copy/paste data.

This patch series introduces a new option '--tui-dump' in perf annotate to dump the TUI output to stdio.

User can easily use the command line like:
'perf annotate --tui-dump > /tmp/log.txt'

For example:

    $ perf annotate compute_flag --tui-dump
    Percent  IPC Cycle

                            Disassembly of section .text:

                            0000000000400640 <compute_flag>:
                            compute_flag():
                            volatile int count;
                            static unsigned int s_randseed;

                            __attribute__((noinline))
                            int compute_flag()
                            {
     23.00  1.16              sub    $0x8,%rsp
                                    int i;

                                    i = rand() % 2;
     23.06  1.16     1        callq  rand@plt

                                    return i;
     27.01  3.38              mov    %eax,%edx
                            }
            3.38              add    $0x8,%rsp
                            {
                                    int i;

                                    i = rand() % 2;

                                    return i;
            3.38              shr    $0x1f,%edx
            3.38              add    %edx,%eax
            3.38              and    $0x1,%eax
            3.38              sub    %edx,%eax
                            }
     26.93  3.38     2        retq

The '--stdio' option is still kept now. Maybe in future, we can only maintain the TUI routines and drop the lagacy stdio code. But right now we'd better keep it until the '--tui-dump' option is good enough.

Jin Yao (4):
perf browser: Add a new 'dump' flag
perf browser: bypass ui_init if in tui dump mode perf annotate: Process the new switch flag tui_dump perf annotate: Enable the '--tui-dump' mode

 tools/perf/Documentation/perf-annotate.txt |  3 +++
 tools/perf/builtin-annotate.c              | 12 +++++++--
 tools/perf/builtin-c2c.c                   |  2 +-
 tools/perf/builtin-report.c                |  2 +-
 tools/perf/builtin-top.c                   |  2 +-
 tools/perf/ui/browser.c                    | 38 +++++++++++++++++++++++----
 tools/perf/ui/browser.h                    |  1 +
 tools/perf/ui/browsers/annotate.c          | 41 +++++++++++++++++++++---------
 tools/perf/ui/browsers/hists.c             |  2 +-
 tools/perf/ui/setup.c                      |  9 +++++--
 tools/perf/ui/ui.h                         |  2 +-
 tools/perf/util/annotate.h                 |  6 +++--
 tools/perf/util/hist.h                     | 11 +++++---
 13 files changed, 99 insertions(+), 32 deletions(-)
Signature · 1 line
2.7.4