mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-06 22:34:14 +02:00
Cache flush not detected
This commit is contained in:
@@ -34,7 +34,8 @@ public:
|
||||
/** Emplace a specific frame and module **/
|
||||
void emplace(uint64_t pulseID, uint64_t moduleID, BufferBinaryFormat& ref_frame){
|
||||
uint64_t idx = pulseID % m_capacity;
|
||||
|
||||
std::cout << " Emplace " << idx << "( " << ref_frame.meta.frame_index << " to " << m_meta[idx].frame_index << " )" << std::endl;
|
||||
|
||||
// Wait for unlocking block
|
||||
while(m_vlock[idx]){ std::this_thread::yield(); }
|
||||
|
||||
@@ -43,10 +44,12 @@ public:
|
||||
|
||||
// A new frame is starting
|
||||
if(ref_frame.meta.frame_index != m_meta[idx].frame_index){
|
||||
std::cout << " New frame " << std::endl;
|
||||
flush_line(idx);
|
||||
start_line(idx, ref_frame.meta);
|
||||
}
|
||||
|
||||
std::cout << " fill/cpy" << std::endl;
|
||||
m_fill[idx]++;
|
||||
char* ptr_dest = m_data[idx].data() + moduleID * m_blocksize;
|
||||
std::memcpy(ptr_dest, (void*)&ref_frame.data, m_blocksize);
|
||||
|
||||
@@ -20,7 +20,7 @@ JfjFrameWorker::~JfjFrameWorker() {
|
||||
|
||||
|
||||
inline uint64_t JfjFrameWorker::process_packets(BufferBinaryFormat& buffer){
|
||||
std::cout << " Called process_packets()" << std::endl;
|
||||
// std::cout << " Called process_packets()" << std::endl;
|
||||
|
||||
while(!m_buffer.is_empty()){
|
||||
// Happens if the last packet from the previous frame gets lost.
|
||||
@@ -36,7 +36,7 @@ inline uint64_t JfjFrameWorker::process_packets(BufferBinaryFormat& buffer){
|
||||
jfjoch_packet_t& c_packet = m_buffer.pop_front();
|
||||
m_frame_index = c_packet.framenum;
|
||||
this->in_progress = true;
|
||||
std::cout << " pp: " << c_packet.packetnum << std::endl;
|
||||
//std::cout << " pp: " << c_packet.packetnum << std::endl;
|
||||
|
||||
// Always copy metadata (otherwise problem when 0th packet gets lost)
|
||||
buffer.meta.pulse_id = c_packet.bunchid;
|
||||
@@ -51,7 +51,7 @@ inline uint64_t JfjFrameWorker::process_packets(BufferBinaryFormat& buffer){
|
||||
|
||||
// Last frame packet received. Frame finished.
|
||||
if (c_packet.packetnum == JF_N_PACKETS_PER_FRAME - 1){
|
||||
std::cout << "Finished pulse: " << buffer.meta.pulse_id << std::endl;
|
||||
// std::cout << "Finished pulse: " << buffer.meta.pulse_id << std::endl;
|
||||
this->in_progress = false;
|
||||
return buffer.meta.pulse_id;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ inline uint64_t JfjFrameWorker::process_packets(BufferBinaryFormat& buffer){
|
||||
}
|
||||
|
||||
uint64_t JfjFrameWorker::get_frame(BufferBinaryFormat& buffer){
|
||||
std::cout << "Called get_frame()" << std::endl;
|
||||
// std::cout << "Called get_frame()" << std::endl;
|
||||
// Reset the metadata and frame buffer for the next frame. (really needed?)
|
||||
memset(&buffer, 0, sizeof(buffer));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user