rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Namespaces | Functions
loggingcentral.h File Reference

Detailed Description

Date
Mar 8, 2015
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file loggingcentral.h.

Data Structures

struct  LogLineBuffer
 
class  LogBuffer< TBufferSize >
 

Namespaces

namespace  priv
 

Functions

void startLoggingProcessor ()
 
const charswapOutputBuffers (size_t *actualOutputBufferSize)
 
void priv::efiPrintfInternal (const char *format,...)
 
void scheduleLogging (Logging *logging)
 

Function Documentation

◆ scheduleLogging()

void scheduleLogging ( Logging logging)

This is the legacy function to copy the contents of a local Logging object in to the output buffer

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.

237 {
238#if (EFI_PROD_CODE || EFI_SIMULATOR) && EFI_TEXT_LOGGING
239 // Lock the buffer mutex - inhibit buffer swaps while writing
240 {
241 chibios_rt::MutexLocker lock(logBufferMutex);
242
243 writeBuffer->writeLogger(logging);
244 }
245
246 // Reset the logging now that it's been written out
247 logging->reset();
248#endif
249}
void writeLogger(Logging *logging)
void reset()
chibios_rt::Mutex logBufferMutex
LB * writeBuffer

Referenced by printHistogram(), WaveChart::publish(), and updateDevConsoleState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startLoggingProcessor()

void startLoggingProcessor ( )

Definition at line 159 of file loggingcentral.cpp.

159 {
160 // Push all buffers in to the free queue
161 for (size_t i = 0; i < lineBufferCount; i++) {
162 freeBuffers.post(&lineBuffers[i], TIME_INFINITE);
163 }
164
165 // Start processing used buffers
166 lbf.start();
167}
static LogLineBuffer lineBuffers[lineBufferCount]
constexpr size_t lineBufferCount
static LoggingBufferFlusher lbf
static chibios_rt::Mailbox< LogLineBuffer *, lineBufferCount > freeBuffers

Referenced by runRusEfi().

Here is the caller graph for this function:

◆ swapOutputBuffers()

const char * swapOutputBuffers ( size_t actualOutputBufferSize)

Actual communication layer invokes this method when it's ready to send some data out

Returns
pointer to the buffer which should be print to console

Definition at line 93 of file loggingcentral.cpp.

93 {
94 {
95 chibios_rt::MutexLocker lock(logBufferMutex);
96
97 // Swap buffers under lock
98 auto temp = writeBuffer;
100 readBuffer = temp;
101
102 // Reset the front buffer - it's now empty
104 }
105
106 *actualOutputBufferSize = readBuffer->length();
107#if EFI_ENABLE_ASSERTS
108 size_t expectedOutputSize = std::strlen(readBuffer->get());
109
110 // Check that the actual length of the buffer matches the expected length of how much we thought we wrote
111 if (*actualOutputBufferSize != expectedOutputSize) {
112 firmwareError(ObdCode::ERROR_LOGGING_SIZE_CALC, "lsize mismatch %d vs strlen %d", *actualOutputBufferSize, expectedOutputSize);
113
114 return nullptr;
115 }
116#endif /* EFI_ENABLE_ASSERTS */
117 return readBuffer->get();
118}
size_t length() const
const char * get() const
void firmwareError(ObdCode code, const char *fmt,...)
LB * readBuffer
@ ERROR_LOGGING_SIZE_CALC

Referenced by handleGetText().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.