mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:07:44 +00:00
AK: Serialize entire log statements
Prior to this, we wrote to the log every time the << operator was used, which meant that only these parts of the log statement were serialized. If the thread was preempted, or especially with multiple CPUs the debug output was hard to decipher. Instead, we buffer up the log statements. To avoid allocations we'll attempt to use stack space, which covers most log statements.
This commit is contained in:
parent
57b61b2dde
commit
038dd9f30e
3 changed files with 68 additions and 19 deletions
|
@ -153,15 +153,21 @@ DebugLogStream klog()
|
|||
#ifdef KERNEL
|
||||
KernelLogStream::~KernelLogStream()
|
||||
{
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
if (!empty()) {
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
kernelputstr(reinterpret_cast<char*>(data()), size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DebugLogStream::~DebugLogStream()
|
||||
{
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
if (!empty()) {
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
dbgputstr(reinterpret_cast<char*>(data()), size());
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue