Skip to content

perf kvm: Add live mode for analyzing events

David Ahern lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12perf evlist: restore some methods removed in an earlier cleanuptools/perf/util/evlist.c tools/perf/util/evlist.h+57 -00 replies
2/12perf evlist: move tracepoint processing code to evlist.ctools/perf/util/evlist.c tools/perf/util/evlist.h tools/perf/util/header.c +1 more+43 -400 replies
3/12perf evlist: add initialzation function for tracepointstools/perf/util/evlist.c tools/perf/util/evlist.h+30 -00 replies
4/12perf session: export a few functions for event processingtools/perf/util/session.c tools/perf/util/session.h+16 -70 replies
5/12perf top: move CONSOLE_CLEAR to header filetools/perf/builtin-top.c tools/perf/util/top.h+2 -20 replies
6/12perf kvm: remove typecast in init_kvm_event_recordtools/perf/builtin-kvm.c+2 -21 reply
7/12perf kvm: handle realloc failurestools/perf/builtin-kvm.c+3 -03 replies
8/12perf kvm: add braces around multi-line statementstools/perf/builtin-kvm.c+6 -31 reply
9/12perf kvm: split out tracepoints from record argstools/perf/builtin-kvm.c+19 -112 replies
10/12perf kvm: total count is a u64, print as sotools/perf/builtin-kvm.c+2 -21 reply
11/12perf kvm: only process events for vcpus of interesttools/perf/builtin-kvm.c+16 -21 reply
12/12perf kvm: add live modetools/perf/builtin-kvm.c+623 -264 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/12] perf kvm: Add live mode for analyzing events

perf kvm stat currently requires back to back record and report commands to see stats. e.g.,

perf kvm stat record -p $pid -- sleep 1
perf kvm stat report

This is rather inconvenvient for on box monitoring of a VM. This patch introduces a 'live' mode that in effect combines the record plus report into one command. e.g., to monitor a single VM:

perf kvm stat live -p $pid

Same stats options for the record+report path work with the live mode. Display rate defaults to 1 and can be changed using the -d option.

The command works fine for low event rates, but as the number of events increases (e.g., building a kernel in a 4-vcpu VM or nested virtualization) the ordered samples code is failing. e.g,

...
Total Samples:76309, Total events handled time:1121314.04us.

Warning: Timestamp below last timeslice flush
Failed to process event

This is on a 16-cpu server. For the kernel build in a 4 vcpu VM I am seeing on the order of 50,000+ events per second and in the case of nested virtualization (at least this one use case) I am seeing on the order of 100,000+ events per second. Not surprising it's having problems keeping up.

I'll continue poking around the ordered samples code, but wanted to kick this out in case someone has ideas or objections to the approach.

David Ahern (12):
perf evlist: restore some methods removed in an earlier cleanup perf evlist: move tracepoint processing code to evlist.c perf evlist: add initialzation function for tracepoints perf session: export a few functions for event processing perf top: move CONSOLE_CLEAR to header file
perf kvm: remove typecast in init_kvm_event_record perf kvm: handle realloc failures
perf kvm: add braces around multi-line statements perf kvm: split out tracepoints from record args
perf kvm: total count is a u64, print as so
perf kvm: only process events for vcpus of interest perf kvm: add live mode

 tools/perf/builtin-kvm.c  |  717 ++++++++++++++++++++++++++++++++++++++++++---
 tools/perf/builtin-top.c  |    2 -
 tools/perf/util/evlist.c  |  120 ++++++++
 tools/perf/util/evlist.h  |   10 +
 tools/perf/util/header.c  |   39 ---
 tools/perf/util/session.c |   15 +-
 tools/perf/util/session.h |    9 +
 tools/perf/util/top.h     |    2 +
 8 files changed, 819 insertions(+), 95 deletions(-)
Signature · 1 line
1.7.10.1