From: Mathieu Desnoyers Date: Sat, 19 Mar 2016 15:34:22 +0000 (-0400) Subject: libringbuffer: implement event too big API X-Git-Tag: v2.9.0-rc1~78 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d7e740172ed8d5bc91bce8404b2cc96b04f23ed3;p=lttng-modules.git libringbuffer: implement event too big API Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/frontend_types.h b/lib/ringbuffer/frontend_types.h index 46bf8d27..ef63cb50 100644 --- a/lib/ringbuffer/frontend_types.h +++ b/lib/ringbuffer/frontend_types.h @@ -161,6 +161,8 @@ void *channel_get_private(struct channel *chan) return chan->backend.priv; } +void lib_ring_buffer_lost_event_too_big(struct channel *chan); + /* * Issue warnings and disable channels upon internal error. * Can receive struct lib_ring_buffer or struct lib_ring_buffer_backend diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c index 9ebdd5fb..c92e9271 100644 --- a/lib/ringbuffer/ring_buffer_frontend.c +++ b/lib/ringbuffer/ring_buffer_frontend.c @@ -1743,6 +1743,25 @@ retry: return 0; } +static struct lib_ring_buffer *get_current_buf(struct channel *chan, int cpu) +{ + const struct lib_ring_buffer_config *config = &chan->backend.config; + + if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) + return per_cpu_ptr(chan->backend.buf, cpu); + else + return chan->backend.buf; +} + +void lib_ring_buffer_lost_event_too_big(struct channel *chan) +{ + const struct lib_ring_buffer_config *config = &chan->backend.config; + struct lib_ring_buffer *buf = get_current_buf(chan, smp_processor_id()); + + v_inc(config, &buf->records_lost_big); +} +EXPORT_SYMBOL_GPL(lib_ring_buffer_lost_event_too_big); + /** * lib_ring_buffer_reserve_slow - Atomic slot reservation in a buffer. * @ctx: ring buffer context. @@ -1759,12 +1778,7 @@ int lib_ring_buffer_reserve_slow(struct lib_ring_buffer_ctx *ctx) struct switch_offsets offsets; int ret; - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) - buf = per_cpu_ptr(chan->backend.buf, ctx->cpu); - else - buf = chan->backend.buf; - ctx->buf = buf; - + ctx->buf = buf = get_current_buf(chan, ctx->cpu); offsets.size = 0; do {