mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-14 13:18:19 +00:00
trace_buffer: revise trace buffer implementation
This commit simplifies the current implementation by overloading the length field with a padding indicator in addition to the zero-length head entry. This simplifies the iteration semantics as it eliminates the need for determining whether a zero-length entries is the actual head of the buffer or a padding at the buffer end. genodelabs/genode#4434
This commit is contained in:
committed by
Norman Feske
parent
d24552f5e2
commit
edc46d15f8
@ -105,17 +105,17 @@ class Trace_buffer_monitor
|
||||
log("overflows: ", _buffer->wrapped());
|
||||
log("read all remaining events");
|
||||
|
||||
for (; !_curr_entry.last(); _curr_entry = _buffer->next(_curr_entry)) {
|
||||
for (; !_curr_entry.head(); _curr_entry = _buffer->next(_curr_entry)) {
|
||||
if (_curr_entry.last())
|
||||
_curr_entry = _buffer->first();
|
||||
|
||||
/* omit empty entries */
|
||||
if (_curr_entry.length() == 0)
|
||||
if (_curr_entry.empty())
|
||||
continue;
|
||||
|
||||
char const * const data = _terminate_entry(_curr_entry);
|
||||
if (data) { log(data); }
|
||||
}
|
||||
|
||||
/* reset after we read all available entries */
|
||||
_curr_entry = _buffer->first();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user