From 4cd38c6c6781ad999d220d7e0c381c65faf5cf64 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 5 Apr 2007 22:09:57 +0000 Subject: [PATCH] fix off by one git-svn-id: http://ltt.polymtl.ca/svn@2477 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt-usertrace/ltt/ltt-usertrace-fast.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ltt-usertrace/ltt/ltt-usertrace-fast.h b/ltt-usertrace/ltt/ltt-usertrace-fast.h index 29588755..fd965935 100644 --- a/ltt-usertrace/ltt/ltt-usertrace-fast.h +++ b/ltt-usertrace/ltt/ltt-usertrace-fast.h @@ -629,7 +629,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( * Parameters: * * @buf : the buffer to commit to. - * @reserved : address of the beginnig of the reserved slot. + * @reserved : address of the end of the event header. * @slot_size : size of the reserved slot. * */ @@ -638,17 +638,17 @@ static inline void __attribute__((no_instrument_function)) ltt_commit_slot( void *reserved, unsigned int slot_size) { - unsigned int offset_begin = reserved - ltt_buf->start; + unsigned int offset_end = reserved - ltt_buf->start; int commit_count; commit_count = atomic_add_return(slot_size, - <t_buf->commit_count[SUBBUF_INDEX(offset_begin, + <t_buf->commit_count[SUBBUF_INDEX(offset_end-1, ltt_buf)]); /* Check if all commits have been done */ if(commit_count == - atomic_read(<t_buf->reserve_count[SUBBUF_INDEX(offset_begin, ltt_buf)])) { - ltt_deliver_callback(ltt_buf, SUBBUF_INDEX(offset_begin, ltt_buf), NULL); + atomic_read(<t_buf->reserve_count[SUBBUF_INDEX(offset_end-1, ltt_buf)])) { + ltt_deliver_callback(ltt_buf, SUBBUF_INDEX(offset_end-1, ltt_buf), NULL); } } -- 2.34.1