mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-10 04:02:03 +02:00
Rename read block size for sf_replay
This commit is contained in:
@@ -23,7 +23,7 @@ namespace core_buffer {
|
||||
const std::string FILE_EXTENSION = ".h5";
|
||||
|
||||
// How many frames do we read at once during replay.
|
||||
const size_t REPLAY_BLOCK_SIZE = 100;
|
||||
const size_t REPLAY_READ_BLOCK_SIZE = 100;
|
||||
|
||||
// Size of sf_buffer RB in elements.
|
||||
const size_t BUFFER_RB_SIZE = 1000;
|
||||
|
||||
+14
-14
@@ -10,10 +10,10 @@ using namespace std;
|
||||
using namespace core_buffer;
|
||||
|
||||
struct FileBufferMetadata {
|
||||
uint64_t pulse_id[REPLAY_BLOCK_SIZE];
|
||||
uint64_t frame_index[REPLAY_BLOCK_SIZE];
|
||||
uint32_t daq_rec[REPLAY_BLOCK_SIZE];
|
||||
uint16_t n_received_packets[REPLAY_BLOCK_SIZE];
|
||||
uint64_t pulse_id[REPLAY_READ_BLOCK_SIZE];
|
||||
uint64_t frame_index[REPLAY_READ_BLOCK_SIZE];
|
||||
uint32_t daq_rec[REPLAY_READ_BLOCK_SIZE];
|
||||
uint16_t n_received_packets[REPLAY_READ_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
void load_data_from_file (
|
||||
@@ -23,27 +23,27 @@ void load_data_from_file (
|
||||
const size_t start_index)
|
||||
{
|
||||
|
||||
hsize_t b_image_dim[3] = {REPLAY_BLOCK_SIZE, 512, 1024};
|
||||
hsize_t b_image_dim[3] = {REPLAY_READ_BLOCK_SIZE, 512, 1024};
|
||||
H5::DataSpace b_i_space (3, b_image_dim);
|
||||
hsize_t b_i_count[] = {REPLAY_BLOCK_SIZE, 512, 1024};
|
||||
hsize_t b_i_count[] = {REPLAY_READ_BLOCK_SIZE, 512, 1024};
|
||||
hsize_t b_i_start[] = {0, 0, 0};
|
||||
b_i_space.selectHyperslab(H5S_SELECT_SET, b_i_count, b_i_start);
|
||||
|
||||
hsize_t f_image_dim[3] = {FILE_MOD, 512, 1024};
|
||||
H5::DataSpace f_i_space (3, f_image_dim);
|
||||
hsize_t f_i_count[] = {REPLAY_BLOCK_SIZE, 512, 1024};
|
||||
hsize_t f_i_count[] = {REPLAY_READ_BLOCK_SIZE, 512, 1024};
|
||||
hsize_t f_i_start[] = {start_index, 0, 0};
|
||||
f_i_space.selectHyperslab(H5S_SELECT_SET, f_i_count, f_i_start);
|
||||
|
||||
hsize_t b_metadata_dim[2] = {REPLAY_BLOCK_SIZE, 1};
|
||||
hsize_t b_metadata_dim[2] = {REPLAY_READ_BLOCK_SIZE, 1};
|
||||
H5::DataSpace b_m_space (2, b_metadata_dim);
|
||||
hsize_t b_m_count[] = {REPLAY_BLOCK_SIZE, 1};
|
||||
hsize_t b_m_count[] = {REPLAY_READ_BLOCK_SIZE, 1};
|
||||
hsize_t b_m_start[] = {0, 0};
|
||||
b_m_space.selectHyperslab(H5S_SELECT_SET, b_m_count, b_m_start);
|
||||
|
||||
hsize_t f_metadata_dim[2] = {FILE_MOD, 1};
|
||||
H5::DataSpace f_m_space (2, f_metadata_dim);
|
||||
hsize_t f_m_count[] = {REPLAY_BLOCK_SIZE, 1};
|
||||
hsize_t f_m_count[] = {REPLAY_READ_BLOCK_SIZE, 1};
|
||||
hsize_t f_m_start[] = {start_index, 0};
|
||||
f_m_space.selectHyperslab(H5S_SELECT_SET, f_m_count, f_m_start);
|
||||
|
||||
@@ -88,7 +88,7 @@ void sf_replay (
|
||||
{
|
||||
auto metadata_buffer = make_unique<FileBufferMetadata>();
|
||||
auto image_buffer = make_unique<uint16_t[]>(
|
||||
REPLAY_BLOCK_SIZE * MODULE_N_PIXELS);
|
||||
REPLAY_READ_BLOCK_SIZE * MODULE_N_PIXELS);
|
||||
|
||||
auto path_suffixes =
|
||||
BufferUtils::get_path_suffixes(start_pulse_id, stop_pulse_id);
|
||||
@@ -115,7 +115,7 @@ void sf_replay (
|
||||
|
||||
for (size_t file_index_offset=0;
|
||||
file_index_offset < FILE_MOD;
|
||||
file_index_offset += REPLAY_BLOCK_SIZE)
|
||||
file_index_offset += REPLAY_READ_BLOCK_SIZE)
|
||||
{
|
||||
auto start_time = chrono::steady_clock::now();
|
||||
|
||||
@@ -131,7 +131,7 @@ void sf_replay (
|
||||
|
||||
cout << "sf_replay:batch_read_ms " << ms_duration << endl;
|
||||
|
||||
for (size_t i_frame=0; i_frame < REPLAY_BLOCK_SIZE; i_frame++) {
|
||||
for (size_t i_frame=0; i_frame < REPLAY_READ_BLOCK_SIZE; i_frame++) {
|
||||
|
||||
ModuleFrame module_frame = {
|
||||
metadata_buffer->pulse_id[i_frame],
|
||||
@@ -241,7 +241,7 @@ int main (int argc, char *argv[]) {
|
||||
auto ctx = zmq_ctx_new();
|
||||
auto socket = zmq_socket(ctx, ZMQ_PUSH);
|
||||
|
||||
const int sndhwm = REPLAY_BLOCK_SIZE;
|
||||
const int sndhwm = REPLAY_READ_BLOCK_SIZE;
|
||||
if (zmq_setsockopt(socket, ZMQ_SNDHWM, &sndhwm, sizeof(sndhwm)) != 0)
|
||||
throw runtime_error(strerror (errno));
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void receive_replay(
|
||||
void *sockets[n_modules];
|
||||
for (size_t i = 0; i < n_modules; i++) {
|
||||
sockets[i] = zmq_socket(ctx, ZMQ_PULL);
|
||||
int rcvhwm = REPLAY_BLOCK_SIZE;
|
||||
int rcvhwm = REPLAY_READ_BLOCK_SIZE;
|
||||
if (zmq_setsockopt(sockets[i], ZMQ_RCVHWM, &rcvhwm,
|
||||
sizeof(rcvhwm)) != 0) {
|
||||
throw runtime_error(strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user