|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Manages the internal state storage buffers for a processor. More...
#include <ProcessorInternalStateBufferManager.hpp>
Public Types | |
| using | signal_t = T |
| Signal type to use. Generally __m256i or std::array<int16_t, 16>;. | |
Public Member Functions | |
| ProcessorInternalStateBufferManager () | |
| Constructor. | |
| ~ProcessorInternalStateBufferManager () | |
| Destructor. | |
| void | write_to_active_buffer () |
| Write to the active buffer. | |
| ProcessorMetricArray< signal_t > | switch_buffer_and_read () |
| Read from the inactive buffer. | |
| ProcessorMetricArray< std::array< int16_t, 16 > > | switch_buffer_and_read_casted () |
| Read from the inactive buffer and cast to std::array<int16_t, 16>. | |
| void | configure_from_registry (ProcessorInternalStateNameRegistry< signal_t > *registry) |
| Configure and allocate correct buffer storage given the configuration string. | |
| void | clear () |
| clear all buffers and deallocate memory. | |
| void | clear () |
| ProcessorMetricArray< std::array< int16_t, 16 > > | switch_buffer_and_read_casted () |
| ProcessorMetricArray< std::array< int16_t, 16 > > | switch_buffer_and_read_casted () |
Protected Member Functions | |
| void | allocate_buffers (size_t buffer_size) |
| Allocate the correct size for the double buffer read and write buffers. | |
| void | allocate_cast_buffers (size_t) |
| Allocate the correct size for the double buffer read and write buffers for the casted data. | |
| void | switch_active_buffer () |
| Switch the active buffer. | |
| void | allocate_cast_buffers (size_t n) |
Private Attributes | |
| std::vector< std::shared_ptr< signal_t > > | m_internal_state_item_ptrs |
| The vector of pointers to the internal state items. | |
| ProcessorMetricArray< signal_t > | m_store_buffers [2] {} |
| The double buffers for storing the internal state data. | |
| ProcessorMetricArray< std::array< int16_t, 16 > > | m_cast_store_buffers [2] {} |
| The double buffers for storing the internal state data casted to std::array<int16_t, 16>. | |
| std::atomic< ProcessorMetricArray< std::array< int16_t, 16 > > * > | m_cast_active_buffer { &m_cast_store_buffers[0] } |
| The active buffer for the casted data. | |
| std::atomic< ProcessorMetricArray< signal_t > * > | m_write_buffer = &m_store_buffers[0] |
| The write buffer pointer (buffer writer currently uses). | |
| std::atomic< ProcessorMetricArray< signal_t > * > | m_read_buffer = &m_store_buffers[0] |
| The read buffer pointer (buffer reader currently uses). | |
| std::atomic< uint16_t > | m_write_seq {0} |
| The sequence number for writes (odd=writing, even=complete). | |
| std::atomic< uint16_t > | m_last_read_seq {0} |
| The last sequence number that was read. | |
| size_t | m_buffer_size |
| size of each buffer. | |
Manages the internal state storage buffers for a processor.
Definition at line 32 of file ProcessorInternalStateBufferManager.hpp.
| using tpglibs::ProcessorInternalStateBufferManager< T >::signal_t = T |
Signal type to use. Generally __m256i or std::array<int16_t, 16>;.
Definition at line 35 of file ProcessorInternalStateBufferManager.hpp.
| tpglibs::ProcessorInternalStateBufferManager< T >::ProcessorInternalStateBufferManager | ( | ) |
| tpglibs::ProcessorInternalStateBufferManager< T >::~ProcessorInternalStateBufferManager | ( | ) |
Destructor.
Definition at line 121 of file ProcessorInternalStateBufferManager.hpp.
|
protected |
Allocate the correct size for the double buffer read and write buffers.
| buffer_size | The size of the buffer. |
Definition at line 143 of file ProcessorInternalStateBufferManager.hpp.
|
inlineprotected |
Definition at line 240 of file ProcessorInternalStateBufferManager.hpp.
|
inlineprotected |
Allocate the correct size for the double buffer read and write buffers for the casted data.
| buffer_size | The size of the buffer. |
Definition at line 81 of file ProcessorInternalStateBufferManager.hpp.
|
inline |
clear all buffers and deallocate memory.
Definition at line 65 of file ProcessorInternalStateBufferManager.hpp.
|
inline |
Definition at line 206 of file ProcessorInternalStateBufferManager.hpp.
| void tpglibs::ProcessorInternalStateBufferManager< T >::configure_from_registry | ( | ProcessorInternalStateNameRegistry< signal_t > * | registry | ) |
Configure and allocate correct buffer storage given the configuration string.
| registry | The registry object of internal state names. |
Definition at line 126 of file ProcessorInternalStateBufferManager.hpp.
|
protected |
Switch the active buffer.
| ProcessorMetricArray< typename ProcessorInternalStateBufferManager< T >::signal_t > tpglibs::ProcessorInternalStateBufferManager< T >::switch_buffer_and_read | ( | ) |
Read from the inactive buffer.
Definition at line 175 of file ProcessorInternalStateBufferManager.hpp.
| ProcessorMetricArray< std::array< int16_t, 16 > > tpglibs::ProcessorInternalStateBufferManager< T >::switch_buffer_and_read_casted | ( | ) |
Read from the inactive buffer and cast to std::array<int16_t, 16>.
|
inline |
Definition at line 215 of file ProcessorInternalStateBufferManager.hpp.
|
inline |
Definition at line 252 of file ProcessorInternalStateBufferManager.hpp.
| void tpglibs::ProcessorInternalStateBufferManager< T >::write_to_active_buffer | ( | ) |
Write to the active buffer.
| data | The data to write. |
Definition at line 153 of file ProcessorInternalStateBufferManager.hpp.
|
private |
size of each buffer.
Definition at line 112 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The active buffer for the casted data.
Definition at line 97 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The double buffers for storing the internal state data casted to std::array<int16_t, 16>.
Definition at line 94 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The vector of pointers to the internal state items.
Definition at line 88 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The last sequence number that was read.
Definition at line 109 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The read buffer pointer (buffer reader currently uses).
Definition at line 103 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The double buffers for storing the internal state data.
Definition at line 91 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The write buffer pointer (buffer writer currently uses).
Definition at line 100 of file ProcessorInternalStateBufferManager.hpp.
|
private |
The sequence number for writes (odd=writing, even=complete).
Definition at line 106 of file ProcessorInternalStateBufferManager.hpp.