rusEFI
The most advanced open source ECU
|
This file implements text logging.
Uses a queue of buffers so that the expensive printf operation doesn't require exclusive access (ie, global system lock) to log. In the past there have been serious performance problems caused by heavy logging on a low priority thread that blocks the rest of the system running (trigger errors, etc).
Uses ChibiOS message queues to maintain one queue of free buffers, and one queue of used buffers. When a thread wants to write, it acquires a free buffer, prints to it, and pushes it in to the used queue. A dedicated thread then dequeues and writes lines from the used buffer in to the large output buffer.
Later, the binary TS thread will request access to the output log buffer for reading, so a lock is taken, buffers, swapped, and the back buffer returned. This blocks neither output nor logging in any case, as each operation operates on a different buffer.
Definition in file loggingcentral.cpp.
Namespaces | |
namespace | priv |
Typedefs | |
using | LB = LogBuffer< DL_OUTPUT_BUFFER > |
Functions | |
const char * | swapOutputBuffers (size_t *actualOutputBufferSize) |
void | startLoggingProcessor () |
void | priv::efiPrintfInternal (const char *format,...) |
void | scheduleLogging (Logging *logging) |
Variables | |
chibios_rt::Mutex | logBufferMutex |
LB | buffers [2] |
LB * | writeBuffer = &buffers[0] |
LB * | readBuffer = &buffers[1] |
constexpr size_t | lineBufferCount = 24 |
static LogLineBuffer | lineBuffers [lineBufferCount] |
static chibios_rt::Mailbox< LogLineBuffer *, lineBufferCount > | freeBuffers |
static chibios_rt::Mailbox< LogLineBuffer *, lineBufferCount > | filledBuffers |
static LoggingBufferFlusher | lbf |
bool | verboseMode |
Definition at line 83 of file loggingcentral.cpp.
void scheduleLogging | ( | Logging * | logging | ) |
This method appends the content of specified thread-local logger into the global buffer of logging content.
This is a legacy function, most normal logging should use efiPrintf
Definition at line 237 of file loggingcentral.cpp.
Referenced by printHistogram(), WaveChart::publish(), and updateDevConsoleState().
void startLoggingProcessor | ( | ) |
Definition at line 159 of file loggingcentral.cpp.
Referenced by runRusEfi().
Actual communication layer invokes this method when it's ready to send some data out
Definition at line 93 of file loggingcentral.cpp.
Referenced by handleGetText().
LB buffers[2] |
Definition at line 84 of file loggingcentral.cpp.
|
static |
Definition at line 127 of file loggingcentral.cpp.
Referenced by priv::efiPrintfInternal().
|
static |
Definition at line 125 of file loggingcentral.cpp.
Referenced by priv::efiPrintfInternal(), and startLoggingProcessor().
|
static |
Definition at line 157 of file loggingcentral.cpp.
Referenced by startLoggingProcessor().
|
constexpr |
Definition at line 121 of file loggingcentral.cpp.
Referenced by startLoggingProcessor().
|
static |
Definition at line 122 of file loggingcentral.cpp.
Referenced by startLoggingProcessor().
chibios_rt::Mutex logBufferMutex |
Definition at line 78 of file loggingcentral.cpp.
Referenced by scheduleLogging(), and swapOutputBuffers().
Definition at line 86 of file loggingcentral.cpp.
Referenced by swapOutputBuffers().
|
extern |
Referenced by priv::efiPrintfInternal().
Definition at line 85 of file loggingcentral.cpp.
Referenced by scheduleLogging(), and swapOutputBuffers().