diff --git a/core-buffer/include/buffer_config.hpp b/core-buffer/include/buffer_config.hpp index de9361d..b605a79 100644 --- a/core-buffer/include/buffer_config.hpp +++ b/core-buffer/include/buffer_config.hpp @@ -53,7 +53,7 @@ namespace core_buffer { // Address where Replay streams and writer receives. const std::string REPLAY_STREAM_IPC_URL = "ipc:///tmp/sf-replay-"; // How many frames to read at once from file. - const size_t REPLAY_READ_BUFFER_SIZE = 100; + const size_t BUFFER_BLOCK_SIZE = 100; // How many slots to have in the internal queue between read and send. const int REPLAY_FASTQUEUE_N_SLOTS = 2; // How many frames do we buffer in send. diff --git a/core-buffer/include/formats.hpp b/core-buffer/include/formats.hpp index 2e9acec..d35c056 100644 --- a/core-buffer/include/formats.hpp +++ b/core-buffer/include/formats.hpp @@ -31,7 +31,7 @@ struct BufferBinaryFormat { #pragma pack(1) struct BufferBlock { - BufferBinaryFormat frame[core_buffer::REPLAY_READ_BUFFER_SIZE]; + BufferBinaryFormat frame[core_buffer::BUFFER_BLOCK_SIZE]; uint64_t start_pulse_id; }; #pragma pack(pop) diff --git a/sf-replay/src/ReplayH5Reader.cpp b/sf-replay/src/ReplayH5Reader.cpp index 9a126ab..56f8851 100644 --- a/sf-replay/src/ReplayH5Reader.cpp +++ b/sf-replay/src/ReplayH5Reader.cpp @@ -46,22 +46,22 @@ void ReplayH5Reader::get_buffer( } auto file_index = BufferUtils::get_file_frame_index(pulse_id); - auto cache_start_index = file_index / REPLAY_READ_BUFFER_SIZE; - cache_start_index *= REPLAY_READ_BUFFER_SIZE; + auto cache_start_index = file_index / BUFFER_BLOCK_SIZE; + cache_start_index *= BUFFER_BLOCK_SIZE; uint64_t b_start_pulse_id = pulse_id - (file_index - cache_start_index); metadata->start_pulse_id = b_start_pulse_id; - metadata->n_frames = REPLAY_READ_BUFFER_SIZE; + metadata->n_frames = BUFFER_BLOCK_SIZE; - hsize_t b_m_dims[2] = {REPLAY_READ_BUFFER_SIZE, ModuleFrame_N_FIELDS}; + hsize_t b_m_dims[2] = {BUFFER_BLOCK_SIZE, ModuleFrame_N_FIELDS}; H5::DataSpace b_m_space (2, b_m_dims); - hsize_t b_m_count[] = {REPLAY_READ_BUFFER_SIZE, ModuleFrame_N_FIELDS}; + hsize_t b_m_count[] = {BUFFER_BLOCK_SIZE, ModuleFrame_N_FIELDS}; hsize_t b_m_start[] = {cache_start_index, 0}; b_m_space.selectHyperslab(H5S_SELECT_SET, b_m_count, b_m_start); hsize_t f_m_dims[2] = {FILE_MOD, ModuleFrame_N_FIELDS}; H5::DataSpace f_m_space (2, f_m_dims); - hsize_t f_m_count[] = {REPLAY_READ_BUFFER_SIZE, ModuleFrame_N_FIELDS}; + hsize_t f_m_count[] = {BUFFER_BLOCK_SIZE, ModuleFrame_N_FIELDS}; hsize_t pulse_id_start[] = {cache_start_index, 0}; f_m_space.selectHyperslab(H5S_SELECT_SET, f_m_count, pulse_id_start); @@ -70,17 +70,17 @@ void ReplayH5Reader::get_buffer( H5::PredType::NATIVE_UINT64, b_m_space, f_m_space); hsize_t b_f_dims[3] = - {REPLAY_READ_BUFFER_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; + {BUFFER_BLOCK_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; H5::DataSpace b_f_space (3, b_f_dims); hsize_t b_f_count[] = - {REPLAY_READ_BUFFER_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; + {BUFFER_BLOCK_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; hsize_t b_f_start[] = {0, 0, 0}; b_f_space.selectHyperslab(H5S_SELECT_SET, b_f_count, b_f_start); hsize_t f_frame_dims[3] = {FILE_MOD, MODULE_Y_SIZE, MODULE_X_SIZE}; H5::DataSpace f_f_space (3, f_frame_dims); hsize_t f_f_count[] = - {REPLAY_READ_BUFFER_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; + {BUFFER_BLOCK_SIZE, MODULE_Y_SIZE, MODULE_X_SIZE}; hsize_t f_f_start[] = {cache_start_index, 0, 0}; f_f_space.selectHyperslab(H5S_SELECT_SET, f_f_count, f_f_start); diff --git a/sf-replay/src/ReplayZmqSender.cpp b/sf-replay/src/ReplayZmqSender.cpp index 3d982ae..71b357d 100644 --- a/sf-replay/src/ReplayZmqSender.cpp +++ b/sf-replay/src/ReplayZmqSender.cpp @@ -44,5 +44,5 @@ void ReplayZmqSender::close() { void ReplayZmqSender::send(const ReplayBuffer* metadata, const char* data) { zmq_send(socket_, metadata, sizeof(ReplayBuffer), ZMQ_SNDMORE); - zmq_send(socket_, data, MODULE_N_BYTES * REPLAY_READ_BUFFER_SIZE, 0); + zmq_send(socket_, data, MODULE_N_BYTES * BUFFER_BLOCK_SIZE, 0); } \ No newline at end of file diff --git a/sf-replay/src/main.cpp b/sf-replay/src/main.cpp index e2cddc8..e97e04a 100644 --- a/sf-replay/src/main.cpp +++ b/sf-replay/src/main.cpp @@ -47,7 +47,7 @@ void sf_replay ( // TODO: Proper statistics cout << "sf_replay:avg_read_us "; - cout << read_us_duration / REPLAY_READ_BUFFER_SIZE << endl; + cout << read_us_duration / BUFFER_BLOCK_SIZE << endl; } } @@ -76,7 +76,7 @@ int main (int argc, char *argv[]) { const auto stop_pulse_id = (uint64_t) atoll(argv[6]); FastQueue queue( - MODULE_N_BYTES * REPLAY_READ_BUFFER_SIZE, + MODULE_N_BYTES * BUFFER_BLOCK_SIZE, REPLAY_FASTQUEUE_N_SLOTS); thread file_read_thread(sf_replay,