]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Merge branch 'bpf-perf-time-helpers'
authorDavid S. Miller <davem@davemloft.net>
Sat, 7 Oct 2017 22:05:58 +0000 (23:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Oct 2017 22:05:58 +0000 (23:05 +0100)
Yonghong Song says:

====================
bpf: add two helpers to read perf event enabled/running time

Hardware pmu counters are limited resources. When there are more
pmu based perf events opened than available counters, kernel will
multiplex these events so each event gets certain percentage
(but not 100%) of the pmu time. In case that multiplexing happens,
the number of samples or counter value will not reflect the
case compared to no multiplexing. This makes comparison between
different runs difficult.

Typically, the number of samples or counter value should be
normalized before comparing to other experiments. The typical
normalization is done like:
  normalized_num_samples = num_samples * time_enabled / time_running
  normalized_counter_value = counter_value * time_enabled / time_running
where time_enabled is the time enabled for event and time_running is
the time running for event since last normalization.

This patch set implements two helper functions.
The helper bpf_perf_event_read_value reads counter/time_enabled/time_running
for perf event array map. The helper bpf_perf_prog_read_value read
counter/time_enabled/time_running for bpf prog with type BPF_PROG_TYPE_PERF_EVENT.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

Trivial merge