mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-06 05:24:14 +02:00
more debug info. bunch/pulseid adjusts.
This commit is contained in:
@@ -4,7 +4,10 @@
|
||||
#include <buffer_config.hpp>
|
||||
#include <zmq.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <chrono>
|
||||
#include "date.h"
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
@@ -136,16 +139,32 @@ BufferUtils::DetectorConfig BufferUtils::read_json_config(
|
||||
rapidjson::Document config_parameters;
|
||||
config_parameters.ParseStream(isw);
|
||||
|
||||
return {
|
||||
config_parameters["streamvis_stream"].GetString(),
|
||||
config_parameters["streamvis_rate"].GetInt(),
|
||||
config_parameters["live_stream"].GetString(),
|
||||
config_parameters["live_rate"].GetInt(),
|
||||
config_parameters["pedestal_file"].GetString(),
|
||||
config_parameters["gain_file"].GetString(),
|
||||
BufferUtils::DetectorConfig det_config = {
|
||||
// config_parameters["streamvis_stream"].GetString(),
|
||||
"",
|
||||
// config_parameters["streamvis_rate"].GetInt(),
|
||||
-1,
|
||||
// config_parameters["live_stream"].GetString(),
|
||||
"",
|
||||
// config_parameters["live_rate"].GetInt(),
|
||||
-1,
|
||||
// config_parameters["pedestal_file"].GetString(),
|
||||
"",
|
||||
// config_parameters["gain_file"].GetString(),
|
||||
"",
|
||||
config_parameters["detector_name"].GetString(),
|
||||
config_parameters["n_modules"].GetInt(),
|
||||
config_parameters["start_udp_port"].GetInt(),
|
||||
config_parameters["buffer_folder"].GetString()
|
||||
};
|
||||
// config_parameters["buffer_folder"].GetString()
|
||||
""
|
||||
};
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
cout << " [" << std::chrono::system_clock::now();
|
||||
cout << "] [BufferUtils::read_json_config] Config:";
|
||||
cout << det_config;
|
||||
cout << endl;
|
||||
#endif
|
||||
return det_config;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <unistd.h>
|
||||
#include "RamBuffer.hpp"
|
||||
#include "buffer_config.hpp"
|
||||
#include "date.h"
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
@@ -40,6 +43,19 @@ RamBuffer::RamBuffer(
|
||||
meta_buffer_ = (ModuleFrame *) buffer_;
|
||||
// Image buffer start right after metadata buffer.
|
||||
image_buffer_ = (char*)buffer_ + (meta_bytes_ * n_slots_);
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
cout << " [" << std::chrono::system_clock::now();
|
||||
cout << "] [RamBuffer::RamBuffer] :";
|
||||
cout << " Details of rambuffer:";
|
||||
cout << "n_modules: " << n_modules_;
|
||||
cout << " || meta_bytes: " << meta_bytes_;
|
||||
cout << " || image_bytes: " << image_bytes_;
|
||||
cout << " || buffer_bytes: " << buffer_bytes_;
|
||||
cout << " || n_slots: " << n_slots_;
|
||||
cout << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
RamBuffer::~RamBuffer()
|
||||
@@ -53,7 +69,8 @@ void RamBuffer::write_frame(
|
||||
const ModuleFrame& src_meta,
|
||||
const char *src_data) const
|
||||
{
|
||||
const int slot_n = src_meta.pulse_id % n_slots_;
|
||||
|
||||
const int slot_n = src_meta.frame_index % n_slots_;
|
||||
|
||||
ModuleFrame *dst_meta = meta_buffer_ +
|
||||
(n_modules_ * slot_n) +
|
||||
@@ -63,6 +80,18 @@ void RamBuffer::write_frame(
|
||||
(image_bytes_ * slot_n) +
|
||||
(MODULE_N_BYTES * src_meta.module_id);
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
cout << " [" << std::chrono::system_clock::now();
|
||||
cout << "] [RamBuffer::write_frame] :";
|
||||
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;
|
||||
cout << " || src_meta.module_id " << src_meta.module_id;
|
||||
cout << " || dst_data " << dst_data;
|
||||
cout << endl;
|
||||
#endif
|
||||
|
||||
memcpy(dst_meta, &src_meta, sizeof(ModuleFrame));
|
||||
memcpy(dst_data, src_data, MODULE_N_BYTES);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user