mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-08 05:22:04 +02:00
Merge branch 'eiger' of https://github.com/paulscherrerinstitute/sf_daq_buffer into eiger
Conflicts: core-buffer/test/test_RamBuffer.cpp jf-assembler/src/main.cpp
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include "RamBuffer.hpp"
|
||||
#include "buffer_config.hpp"
|
||||
#include "date.h"
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
@@ -30,8 +29,8 @@ RamBuffer::RamBuffer(const string& buffer_name,
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
cout << " [" << std::chrono::system_clock::now();
|
||||
cout << "] [RamBuffer::RamBuffer] :";
|
||||
cout << " || buffer_name_ " << buffer_name;
|
||||
cout << "] [RamBuffer::RamBuffer] ";
|
||||
cout << " buffer_name_ " << buffer_name;
|
||||
cout << " || n_modules_ " << n_modules_;
|
||||
cout << " || n_slots_ " << n_slots_;
|
||||
cout << " || meta_bytes_" << meta_bytes_;
|
||||
@@ -91,7 +90,8 @@ void RamBuffer::write_frame(
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
cout << " [" << std::chrono::system_clock::now();
|
||||
cout << "] [RamBuffer::write_frame] :";
|
||||
cout << "] [RamBuffer::write_frame] ";
|
||||
cout << " src_meta.id " << src_meta.id;
|
||||
cout << " || src_meta.frame_index " << src_meta.frame_index;
|
||||
cout << " || src_meta.n_recv_packets " << src_meta.n_recv_packets;
|
||||
cout << " || src_meta.daq_rec " << src_meta.daq_rec;
|
||||
|
||||
@@ -4,16 +4,21 @@
|
||||
using namespace std;
|
||||
using namespace buffer_config;
|
||||
|
||||
|
||||
TEST(RamBuffer, simple_store)
|
||||
{
|
||||
const int n_modules = 3;
|
||||
RamBuffer buffer("test_detector", n_modules, 10);
|
||||
const size_t DATA_N_BYTES = MODULE_N_PIXELS * 2;
|
||||
|
||||
RamBuffer buffer("test_detector",
|
||||
sizeof(ModuleFrame), DATA_N_BYTES, n_modules, 10);
|
||||
|
||||
ModuleFrame frame_meta;
|
||||
frame_meta.id = 12345678;
|
||||
frame_meta.pulse_id = 123523;
|
||||
frame_meta.daq_rec = 1234;
|
||||
frame_meta.frame_index = 12342300;
|
||||
frame_meta.n_recv_packets = EIGER_N_PACKETS_PER_FRAME;
|
||||
frame_meta.n_recv_packets = 128;
|
||||
|
||||
auto frame_buffer = make_unique<uint16_t[]>(MODULE_N_PIXELS);
|
||||
|
||||
@@ -28,10 +33,22 @@ TEST(RamBuffer, simple_store)
|
||||
buffer.write_frame(frame_meta, (char *) (frame_buffer.get()));
|
||||
}
|
||||
|
||||
ImageMetadata image_meta;
|
||||
buffer.assemble_image(frame_meta.pulse_id, image_meta);
|
||||
ASSERT_EQ(image_meta.pulse_id, frame_meta.pulse_id);
|
||||
ASSERT_EQ(image_meta.daq_rec, frame_meta.daq_rec);
|
||||
ASSERT_EQ(image_meta.frame_index, frame_meta.frame_index);
|
||||
ASSERT_EQ(image_meta.status, 0);
|
||||
auto meta_buffer = (ModuleFrame*) buffer.get_slot_meta(frame_meta.id);
|
||||
for (int i_module=0; i_module<n_modules; i_module++) {
|
||||
ASSERT_EQ(meta_buffer[i_module].id, frame_meta.id);
|
||||
ASSERT_EQ(meta_buffer[i_module].pulse_id, frame_meta.pulse_id);
|
||||
ASSERT_EQ(meta_buffer[i_module].daq_rec, frame_meta.daq_rec);
|
||||
ASSERT_EQ(meta_buffer[i_module].frame_index, frame_meta.frame_index);
|
||||
ASSERT_EQ(meta_buffer[i_module].module_id, i_module);
|
||||
}
|
||||
|
||||
auto data_buffer = (uint16_t*) buffer.get_slot_data(frame_meta.id);
|
||||
for (int i_module=0; i_module<n_modules; i_module++) {
|
||||
auto module_buffer = data_buffer + (MODULE_N_PIXELS * i_module);
|
||||
|
||||
for (size_t i = 0; i < MODULE_N_PIXELS; i++) {
|
||||
ASSERT_EQ(module_buffer[i], i%100);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ extern "C" {
|
||||
#include "bitshuffle/bitshuffle.h"
|
||||
}
|
||||
|
||||
#ifdef USE_EIGER
|
||||
#include "eiger.hpp"
|
||||
#else
|
||||
#include "jungfrau.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace buffer_config;
|
||||
|
||||
|
||||
@@ -4,13 +4,6 @@
|
||||
#include "date.h"
|
||||
#include <chrono>
|
||||
|
||||
#ifdef USE_EIGER
|
||||
#include "eiger.hpp"
|
||||
#else
|
||||
#include "jungfrau.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
#include <RamBuffer.hpp>
|
||||
#include <BufferUtils.hpp>
|
||||
#include <AssemblerStats.hpp>
|
||||
@@ -18,7 +11,12 @@
|
||||
#include "EigerAssembler.hpp"
|
||||
#include "assembler_config.hpp"
|
||||
#include "ZmqPulseSyncReceiver.hpp"
|
||||
#include "buffer_config.hpp"
|
||||
|
||||
#ifdef USE_EIGER
|
||||
#include "eiger.hpp"
|
||||
#else
|
||||
#include "jungfrau.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace buffer_config;
|
||||
|
||||
Reference in New Issue
Block a user