|
FastLED 3.9.15
|
High-performance SPSC async log queue.
| DescriptorCount | Number of message descriptors (must be power of 2) |
| ArenaSize | Size of string arena in bytes (must be power of 2) |
Definition at line 18 of file async_log_queue.h.
#include <async_log_queue.h>
Inheritance diagram for fl::AsyncLogQueue< DescriptorCount, ArenaSize >:
Collaboration diagram for fl::AsyncLogQueue< DescriptorCount, ArenaSize >:Classes | |
| struct | Descriptor |
| Descriptor for one log message. More... | |
Public Types | |
| enum | { MAX_MESSAGE_LENGTH = 512 } |
| Maximum message length (bounded for ISR safety) More... | |
Public Member Functions | |
| AsyncLogQueue () FL_NOEXCEPT | |
| constexpr fl::size | capacity () const |
| Get maximum descriptor capacity. | |
| void | commit () |
| Consumer: Commit the popped message to free space (main thread only) | |
| fl::u32 | droppedCount () const |
| Get number of messages dropped due to overflow. | |
| bool | empty () const |
| Check if queue is empty. | |
| bool | push (const char *str) |
| Push a C-string message (ISR-safe) | |
| bool | push (const fl::string &msg) |
| Push a message from fl::string (ISR-safe) | |
| fl::size | size () const |
| Get current number of messages in queue. | |
| bool | tryPop (const char **outPtr, fl::u16 *outLen) |
| Consumer: Try to pop one message (main thread only) | |
Private Member Functions | |
| bool | arenaHasSpace (fl::u32 aHead, fl::u32 aTail, fl::u16 len) const |
| void | atomicIncDropped () |
| FL_STATIC_ASSERT ((ArenaSize &(ArenaSize - 1))==0, "ArenaSize must be power of 2") | |
| FL_STATIC_ASSERT ((DescriptorCount &(DescriptorCount - 1))==0, "DescriptorCount must be power of 2") | |
| FL_STATIC_ASSERT (ArenaSize >=32, "ArenaSize must be >= 32") | |
| FL_STATIC_ASSERT (DescriptorCount >=4, "DescriptorCount must be >= 4") | |
| fl::u32 | loadArenaTail () const |
| fl::u32 | loadHead () const |
| fl::u32 | loadTail () const |
| bool | push (const char *str, fl::u16 len) |
| Implementation details. | |
Static Private Member Functions | |
| static fl::u16 | boundedStrlen (const char *str, fl::u16 maxLen) |
Private Attributes | |
| char | mArena [ArenaSize] |
| String storage arena. | |
| volatile fl::u32 | mArenaHead |
| Producer write position (arena) | |
| volatile fl::u32 | mArenaTail |
| Consumer read position (arena) | |
| Descriptor | mDescriptors [DescriptorCount] |
| Ring of message descriptors. | |
| volatile fl::u32 | mDropped |
| Count of dropped messages (overflow) | |
| volatile fl::u32 | mHead |
| Producer write position (descriptor ring) | |
| volatile fl::u32 | mTail |
| Consumer read position (descriptor ring) | |