perf evlist: restore methods removed in earlier cleanup

e60fc847 removed the perf_evlist__add_tracepoints and helpers, but
they are useful for kvm's upcoming live mode.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf evlist: move tracepoint processing code to evlist.c

Per function names they are more aligned with the evlist code than
the header code.

Code move only; no functional changes.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf evlist: add initialzation function for tracepoints

Handles initializations typically done as part of processing the file
header and HEADER_TRACING_DATA event.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf session: export a few functions for event processing

Allows kvm live mode to reuse the event processing and ordered samples
processing used by the perf-report path.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf top: move CONSOLE_CLEAR to header file

For use with kvm-live mode.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: handle realloc failures

Save previous pointer and free on failure.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: split out tracepoints from record args

Needed by kvm live command. Make record_args a local while we are
messing with the args.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf stats: fix divide by 0 in variance

Number of samples needs to be greater 1 to have a variance.
Fixes nan% in perf-kvm-live output.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf stats: add max and min stats

Need an initialization function to set min to -1 to
differentiate from an actual min of 0.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: add live mode

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 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

or all VMs:

  perf kvm stat live

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

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: add min and max stats to results display

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: option to print events that exceed a threshold

This is useful to spot high latency blips.

Signed-off-by: David Ahern <dsahern@gmail.com>
perf kvm: debug for missing vmexit/vmentry event

Expected to have missing events for each vcpu when perf is
started. After that should not have missing events.

Signed-off-by: David Ahern <dsahern@gmail.com>