linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 00/14] perf kvm: Support histograms and TUI mode
@ 2023-02-26  4:20 Leo Yan
  2023-02-26  4:20 ` [PATCH v1 01/14] perf kvm: Refactor overall statistics Leo Yan
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Leo Yan @ 2023-02-26  4:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel
  Cc: Leo Yan

This patch set is to enable histograms and (partially) TUI mode in perf
kvm tool.

Current tool uses its own RB tree to maintain KVM events, it's not easy
to extend to support more metrics and have no chance to support TUI
mode.  For this reason, we need firstly to refactor the code by using
histograms and its associated RB tree; based on histograms we can add
dimensions for KVM event statistics.  Finally, we need to enable TUI
mode in the tool.  This is the methodology applied in this series.

This series enables TUI mode for 'perf kvm stat report', but it doesn't
support TUI mode for 'perf kvm stat live'; this is because live mode is
different from report for TUI mode, which will be implemented in later
(TBH, I need to look into more details in histograms for this part).

Patches 01 ~ 04 are minor refactoring and they are preparation for later
enabling histograms and dimensions.

Patches 05 ~ 10 are for enabling histograms and dimensions; with these
changes the cached list is replaced by histograms list, and we extend to
support more sorting keys (max time, min time, mean time).

Patches 11 ~ 13 are to enable TUI mode in stat report, after this patch
TUI mode will be default mode, and user needs to input option '--stdio'
for stdio mode rather than TUI mode.

Patch 14 updates documentation for new sorting and 'stdio' mode.

After changes:

Please see the screenshot for the TUI with 'perf kvm stat report':
https://people.linaro.org/~leo.yan/debug/perf/perf_kvm_stat_report_tui.png

And I verified the '--stdio' mode and confirmed it has the same result
with before applying this series.

  # perf kvm stat report --stdio


  Analyze events for all VMs, all VCPUs:

               VM-EXIT    Samples  Samples%     Time%    Min Time    Max Time         Avg time 

             MSR_WRITE        520    60.05%     0.07%      0.74us     16.92us      2.62us ( +-   2.66% )
                   HLT        179    20.67%    99.82%     64.53us  17159.69us  10123.40us ( +-   4.68% )
    EXTERNAL_INTERRUPT         71     8.20%     0.07%      1.16us     79.63us     17.56us ( +-  10.92% )
         EPT_MISCONFIG         68     7.85%     0.03%      5.53us     64.64us      8.09us ( +-  12.50% )
      PREEMPTION_TIMER         18     2.08%     0.01%      1.91us     12.06us      5.53us ( +-  10.25% )
      INTERRUPT_WINDOW          7     0.81%     0.00%      0.91us      1.66us      1.30us ( +-   9.09% )
              MSR_READ          3     0.35%     0.00%      4.06us      4.84us      4.42us ( +-   5.11% )

  Total Samples:866, Total events handled time:1815367.45us.

  # perf kvm stat live
  12:10:10.786799

  Analyze events for all VMs, all VCPUs:

               VM-EXIT    Samples  Samples%     Time%    Min Time    Max Time         Avg time 

             MSR_WRITE        121    66.85%    12.90%      0.67us  62918.87us    667.19us ( +-  80.72% )
                   HLT         34    18.78%    76.61%   2069.99us  52171.44us  14103.37us ( +-  14.25% )
    EXTERNAL_INTERRUPT         20    11.05%    10.49%      1.61us  47469.17us   3282.16us ( +-  75.75% )
      PREEMPTION_TIMER          5     2.76%     0.00%      3.98us      7.39us      5.84us ( +-  10.51% )
      INTERRUPT_WINDOW          1     0.55%     0.00%      2.01us      2.01us      2.01us ( +-   0.00% )

  Total Samples:181, Total events handled time:625919.05us.


Leo Yan (14):
  perf kvm: Refactor overall statistics
  perf kvm: Add pointer to 'perf_kvm_stat' in kvm event
  perf kvm: Move up metrics helpers
  perf kvm: Use subtraction for comparison metrics
  perf kvm: Introduce histograms data structures
  perf kvm: Pass argument 'sample' to kvm_alloc_init_event()
  perf kvm: Parse address location for samples
  perf kvm: Add dimensions for KVM event statistics
  perf kvm: Use histograms list to replace cached list
  perf kvm: Polish sorting key
  perf kvm: Support printing attributions for dimensions
  perf kvm: Add dimensions for percentages
  perf kvm: Add TUI mode for stat report
  perf kvm: Update documentation to reflect new changes

 tools/perf/Documentation/perf-kvm.txt |   9 +-
 tools/perf/builtin-kvm.c              | 847 +++++++++++++++++++++-----
 tools/perf/util/kvm-stat.h            |  26 +-
 3 files changed, 707 insertions(+), 175 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-02-28  8:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-26  4:20 [PATCH v1 00/14] perf kvm: Support histograms and TUI mode Leo Yan
2023-02-26  4:20 ` [PATCH v1 01/14] perf kvm: Refactor overall statistics Leo Yan
2023-02-26  4:20 ` [PATCH v1 02/14] perf kvm: Add pointer to 'perf_kvm_stat' in kvm event Leo Yan
2023-02-26  4:20 ` [PATCH v1 03/14] perf kvm: Move up metrics helpers Leo Yan
2023-02-26  4:20 ` [PATCH v1 04/14] perf kvm: Use subtraction for comparison metrics Leo Yan
2023-02-26  4:20 ` [PATCH v1 05/14] perf kvm: Introduce histograms data structures Leo Yan
2023-02-26  4:20 ` [PATCH v1 06/14] perf kvm: Pass argument 'sample' to kvm_alloc_init_event() Leo Yan
2023-02-26  4:20 ` [PATCH v1 07/14] perf kvm: Parse address location for samples Leo Yan
2023-02-26  4:20 ` [PATCH v1 08/14] perf kvm: Add dimensions for KVM event statistics Leo Yan
2023-02-26  4:20 ` [PATCH v1 09/14] perf kvm: Use histograms list to replace cached list Leo Yan
2023-02-26  4:20 ` [PATCH v1 10/14] perf kvm: Polish sorting key Leo Yan
2023-02-26  4:20 ` [PATCH v1 11/14] perf kvm: Support printing attributions for dimensions Leo Yan
2023-02-26  4:20 ` [PATCH v1 12/14] perf kvm: Add dimensions for percentages Leo Yan
2023-02-26  4:20 ` [PATCH v1 13/14] perf kvm: Add TUI mode for stat report Leo Yan
2023-02-26  4:20 ` [PATCH v1 14/14] perf kvm: Update documentation to reflect new changes Leo Yan
2023-02-27 21:40 ` [PATCH v1 00/14] perf kvm: Support histograms and TUI mode Arnaldo Carvalho de Melo
2023-02-28  8:51   ` Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).