From: Pierre-Marc Fournier Date: Tue, 13 Oct 2009 21:15:06 +0000 (-0400) Subject: modify the commit logic to indicate the reason for which an event was dropped X-Git-Tag: v0.1~93 X-Git-Url: http://git.liburcu.org/?p=ust.git;a=commitdiff_plain;h=c0c87f09b7763485b837b35f1f28291a3fd3caa9 modify the commit logic to indicate the reason for which an event was dropped These changes were designed by Mathieu Desnoyers. --- diff --git a/libust/relay.c b/libust/relay.c index a31cdf7..f975c54 100644 --- a/libust/relay.c +++ b/libust/relay.c @@ -1798,13 +1798,24 @@ static inline int ltt_relay_try_reserve( - (local_read(<t_buf->commit_count[subbuf_index]) & ltt_channel->commit_count_mask); if (offsets->reserve_commit_diff == 0) { + long consumed; + + consumed = atomic_long_read(<t_buf->consumed); + /* Next buffer not corrupted. */ if (!ltt_channel->overwrite && (SUBBUF_TRUNC(offsets->begin, buf->chan) - - SUBBUF_TRUNC(atomic_long_read( - <t_buf->consumed), - buf->chan)) + - SUBBUF_TRUNC(consumed, buf->chan)) >= rchan->alloc_size) { + + long consumed_idx = SUBBUF_INDEX(consumed, buf->chan); + long commit_count = local_read(<t_buf->commit_count[consumed_idx]); + if(((commit_count - buf->chan->subbuf_size) & ltt_channel->commit_count_mask) - (BUFFER_TRUNC(consumed, buf->chan) >> ltt_channel->n_subbufs_order) != 0) { + WARN("Event dropped. Caused by non-committed event."); + } + else { + WARN("Event dropped. Caused by non-consumed buffer."); + } /* * We do not overwrite non consumed buffers * and we are full : event is lost.