Nil RTOS
Public Member Functions | List of all members
NilStatsFIFO< Type, Size > Class Template Reference

A thread safe FIFO with statistics. More...

#include <NilFIFO.h>

Public Member Functions

void countOverrun ()
 
size_t dataCount ()
 
size_t freeCount ()
 
size_t maxOverrunCount ()
 
size_t minimumFreeCount ()
 
 NilStatsFIFO ()
 
size_t overrunCount ()
 
void printStats (Print *pr)
 
void signalData ()
 
void signalFree ()
 
Type * waitData (systime_t time)
 
Type * waitFree (systime_t time)
 

Detailed Description

template<typename Type, size_t Size>
class NilStatsFIFO< Type, Size >

A thread safe FIFO with statistics.

A FIFO for a single producer/consumer pair with statistics.

Constructor & Destructor Documentation

template<typename Type , size_t Size>
NilStatsFIFO< Type, Size >::NilStatsFIFO ( )
inline

constructor

Member Function Documentation

template<typename Type , size_t Size>
void NilStatsFIFO< Type, Size >::countOverrun ( )
inline

Increment overrun count

Note
Must only be called in producer thread.
template<typename Type , size_t Size>
size_t NilStatsFIFO< Type, Size >::dataCount ( )
inline
Returns
count of data records in the FIFO.
template<typename Type , size_t Size>
size_t NilStatsFIFO< Type, Size >::freeCount ( )
inline
Returns
count of free records in the FIFO.
template<typename Type , size_t Size>
size_t NilStatsFIFO< Type, Size >::maxOverrunCount ( )
inline
Returns
maximum overrun count.
template<typename Type , size_t Size>
size_t NilStatsFIFO< Type, Size >::minimumFreeCount ( )
inline
Returns
minimum free count.
template<typename Type , size_t Size>
size_t NilStatsFIFO< Type, Size >::overrunCount ( )
inline

Count of overruns since last call to signalData().

Note
Must only be called in producer thread.
Returns
overrun count.
template<typename Type , size_t Size>
void NilStatsFIFO< Type, Size >::printStats ( Print *  pr)
inline

Print FIFO statistics.

Parameters
[in]prPrint stream for the output.
Note
Must be called when consumer/producer are idle for consistent results.
template<typename Type , size_t Size>
void NilStatsFIFO< Type, Size >::signalData ( )
inline

Signal that a data record is ready.

Note
Must only be called in producer thread.
template<typename Type , size_t Size>
void NilStatsFIFO< Type, Size >::signalFree ( )
inline

Signal that a record is free.

Note
Must only be called in consumer thread.
template<typename Type , size_t Size>
Type* NilStatsFIFO< Type, Size >::waitData ( systime_t  time)
inline

Wait for a data record.

Parameters
[in]timethe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Note
Must only be called in consumer thread.
Returns
pointer to the data record or null if no data record is availabile.
template<typename Type , size_t Size>
Type* NilStatsFIFO< Type, Size >::waitFree ( systime_t  time)
inline

Wait for a free record.

Parameters
[in]timethe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Note
Must only be called in producer thread.
Returns
pointer to the free record or null if no free record is availabile.

The documentation for this class was generated from the following file: