* alloc_tracing_buffer() now refuses to allocate more than 65532 bytes;

we use a uint16 size internally (and that has to include the length of
  the trace_entry structure, too.
* We now track how many entries have been written to the log during the
  runtime.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23613 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-01-18 18:18:35 +00:00
parent c944deeb6b
commit f70280a733

View File

@ -35,6 +35,7 @@ static trace_entry* sBuffer;
static trace_entry* sBufferStart; static trace_entry* sBufferStart;
static trace_entry* sBufferEnd; static trace_entry* sBufferEnd;
static uint32 sEntries; static uint32 sEntries;
static uint32 sWritten;
static spinlock sLock; static spinlock sLock;
@ -166,6 +167,7 @@ TraceEntry::Initialized()
{ {
#if ENABLE_TRACING #if ENABLE_TRACING
flags |= ENTRY_INITIALIZED; flags |= ENTRY_INITIALIZED;
sWritten++;
#endif #endif
} }
@ -259,8 +261,8 @@ dump_tracing(int argc, char** argv)
dumped++; dumped++;
} }
kprintf("entries %ld to %ld (%ld of %ld).\n", start, start + count - 1, kprintf("entries %ld to %ld (%ld of %ld). %ld entries written\n", start,
dumped, sEntries); start + count - 1, dumped, sEntries, sWritten);
set_debug_variable("_tracingStart", start); set_debug_variable("_tracingStart", start);
set_debug_variable("_tracingCount", count); set_debug_variable("_tracingCount", count);
@ -275,7 +277,7 @@ dump_tracing(int argc, char** argv)
extern "C" uint8* extern "C" uint8*
alloc_tracing_buffer(size_t size) alloc_tracing_buffer(size_t size)
{ {
if (size == 0) if (size == 0 || size >= 65532)
return NULL; return NULL;
#if ENABLE_TRACING #if ENABLE_TRACING