]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit7a3267cde829e53e964ca28c45306ceb21b22b17
treeb5ec33cc6476e31c8e30c6623e635c6b75be80ae
parent5e0797c251bc9c4eb14e96240b1ab9f510a18b62
parent6fc3684d5d046ad1bba5eec478ce0a7f67918825
Merge branch 'bpf-perf-time-helpers'

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>