10#include <unordered_map>
19#include <condition_variable>
27namespace fdreadoutlibs {
31 using ProcRef = std::pair<std::shared_ptr<tpglibs::AbstractProcessor<__m256i>>,
int >;
47 uint8_t num_channels_per_pipeline,
48 uint8_t num_pipelines);
56 std::vector<std::pair<std::string,int16_t>>>
harvest_once();
110 std::vector<std::pair<std::string,int16_t>>>;
size_t m_expected_total_channels
std::condition_variable m_collection_cv
void stop_collection_thread()
Stop the background collection thread Blocks until thread is fully stopped.
bool is_collection_thread_running() const
Check if collection thread is running.
void start_collection_thread()
Start the background collection thread Must be called before using async collection features.
std::vector< std::vector< std::pair< trgdataformats::channel_t, int16_t > > > m_channel_plane_numbers_per_pipeline
std::atomic< bool > m_thread_running
uint8_t m_num_channels_per_pipeline
void trigger_harvest()
Signal the collection thread to perform one harvest cycle Non-blocking - returns immediately.
std::atomic< bool > m_harvest_requested
std::mutex m_config_mutex
std::unordered_map< trgdataformats::channel_t, std::vector< std::pair< std::string, int16_t > > > harvest_once()
Harvest once, outputs channel -> [(metric_name, value)...].
std::unordered_map< trgdataformats::channel_t, std::vector< std::pair< std::string, int16_t > > > get_latest_results() const
Get the latest collected results (thread-safe, non-blocking) Returns a copy of the most recent harves...
void collection_thread_worker_()
std::vector< size_t > m_expected_items_per_pipeline
std::vector< ProcRef > m_processor_references
std::atomic< bool > m_thread_should_stop
void set_processor_references(std::vector< ProcRef > refs)
ResultContainer m_latest_results
~TPGInternalStateHarvester()
std::thread m_collection_thread
std::pair< std::shared_ptr< tpglibs::AbstractProcessor< __m256i > >, int > ProcRef
std::mutex m_results_mutex
const std::vector< ProcRef > & get_processor_references() const
std::mutex m_collection_mutex
std::vector< std::vector< std::string > > m_metric_items_per_proc
std::unordered_map< trgdataformats::channel_t, std::vector< std::pair< std::string, int16_t > > > ResultContainer
void update_channel_plane_numbers(const std::vector< std::pair< trgdataformats::channel_t, int16_t > > &channel_plane_numbers, uint8_t num_channels_per_pipeline, uint8_t num_pipelines)
Cuts a full list of (channel, plane) into per-pipeline lists of 16 lanes each.
void rebuild_prealloc_caches_()