diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-06-16 20:06:23 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-06-28 09:08:31 +0200 |
commit | 119a784c81270eb88e573174ed2209225d646656 (patch) | |
tree | 6fa3da6264de67a39be33724c2785c045d6d0bfb /kernel/events/ring_buffer.c | |
parent | perf/x86/amd/uncore: Add PerfMonV2 RDPMC assignments (diff) | |
download | linux-119a784c81270eb88e573174ed2209225d646656.tar.xz linux-119a784c81270eb88e573174ed2209225d646656.zip |
perf/core: Add a new read format to get a number of lost samples
Sometimes we want to know an accurate number of samples even if it's
lost. Currenlty PERF_RECORD_LOST is generated for a ring-buffer which
might be shared with other events. So it's hard to know per-event
lost count.
Add event->lost_samples field and PERF_FORMAT_LOST to retrieve it from
userspace.
Original-patch-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220616180623.1358843-1-namhyung@kernel.org
Diffstat (limited to 'kernel/events/ring_buffer.c')
-rw-r--r-- | kernel/events/ring_buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index fb35b926024c..726132039c38 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -172,8 +172,10 @@ __perf_output_begin(struct perf_output_handle *handle, goto out; if (unlikely(rb->paused)) { - if (rb->nr_pages) + if (rb->nr_pages) { local_inc(&rb->lost); + atomic64_inc(&event->lost_samples); + } goto out; } @@ -254,6 +256,7 @@ __perf_output_begin(struct perf_output_handle *handle, fail: local_inc(&rb->lost); + atomic64_inc(&event->lost_samples); perf_output_put_handle(handle); out: rcu_read_unlock(); |