[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230226042053.1492409-1-leo.yan@linaro.org>
Date:   Sun, 26 Feb 2023 12:20:39 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v1 00/14] perf kvm: Support histograms and TUI mode
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
Powered by blists - more mailing lists