mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-11 01:12:03 +02:00
Remove all DEBUG_OUTPUT references
It turnes out it is not as useful as in the writer project.
This commit is contained in:
@@ -20,17 +20,6 @@ BinaryWriter::BinaryWriter(
|
||||
current_output_filename_(""),
|
||||
output_file_fd_(-1)
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[BinaryWriter::BinaryWriter]";
|
||||
cout << " Starting with";
|
||||
cout << " device_name " << device_name_;
|
||||
cout << " root_folder_ " << root_folder_;
|
||||
cout << " latest_filename_ " << latest_filename_;
|
||||
cout << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
BinaryWriter::~BinaryWriter()
|
||||
|
||||
@@ -19,14 +19,6 @@ LiveRecvModule::LiveRecvModule(
|
||||
ipc_prefix_(ipc_prefix),
|
||||
is_receiving_(true)
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[LiveRecvModule::LiveRecvModule]";
|
||||
cout << endl;
|
||||
#endif
|
||||
|
||||
receiving_thread_ = thread(&LiveRecvModule::receive_thread, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,14 +11,6 @@ RingBuffer<T>::RingBuffer(size_t n_slots) :
|
||||
n_slots_(n_slots),
|
||||
ringbuffer_slots_(n_slots, 0)
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[RingBuffer::RingBuffer]";
|
||||
cout << " Creating ring buffer";
|
||||
cout << " with n_slots " << n_slots << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -65,17 +57,6 @@ void RingBuffer<T>::initialize(const size_t requested_slot_size)
|
||||
buffer_used_slots_ = 0;
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[RingBuffer::initialize]";
|
||||
cout << " Ringbuffer initialized";
|
||||
cout << " with slot_size " << slot_size_;
|
||||
cout << " and n_slots " << n_slots_;
|
||||
cout << " and buffer_size " << buffer_size_ << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -117,17 +98,6 @@ char* RingBuffer<T>::reserve(shared_ptr<T> frame_metadata)
|
||||
|
||||
frame_metadata->buffer_slot_index = write_index_;
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[RingBuafer::reserve]";
|
||||
cout << " Ring buffer slot ";
|
||||
cout << frame_metadata->buffer_slot_index;
|
||||
cout << " reserved for frame_index ";
|
||||
cout << frame_metadata->frame_index << endl;
|
||||
#endif
|
||||
|
||||
write_index_ = (write_index_ + 1) % n_slots_;
|
||||
buffer_used_slots_++;
|
||||
|
||||
@@ -145,15 +115,6 @@ void RingBuffer<T>::commit(shared_ptr<T> frame_metadata)
|
||||
lock_guard<mutex> lock(frame_metadata_queue_mutex_);
|
||||
|
||||
frame_metadata_queue_.push_back(frame_metadata);
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[RingBuffer::commit]";
|
||||
cout << " Metadata for frame_index " << frame_metadata->frame_index;
|
||||
cout << " added to metadata queue." << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -195,15 +156,6 @@ pair<shared_ptr<T>, char*> RingBuffer<T>::read()
|
||||
frame_metadata_queue_.pop_front();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[RingBuffer::read]";
|
||||
cout << " Received metadata for frame_index ";
|
||||
cout << frame_metadata->frame_index << endl;
|
||||
#endif
|
||||
|
||||
// Check if the references ring buffer slot is valid.
|
||||
{
|
||||
lock_guard<mutex> lock(ringbuffer_slots_mutex_);
|
||||
|
||||
@@ -28,15 +28,6 @@ void UdpReceiver::bind(const uint16_t port, const size_t usec_timeout)
|
||||
throw runtime_error("Cannot open socket.");
|
||||
}
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[UdpReceiver::bind]";
|
||||
cout << " port " << port;
|
||||
cout << " usec_timeout " << usec_timeout << endl;
|
||||
#endif
|
||||
|
||||
sockaddr_in server_address = {0};
|
||||
server_address.sin_family = AF_INET;
|
||||
server_address.sin_addr.s_addr = INADDR_ANY;
|
||||
@@ -78,14 +69,6 @@ bool UdpReceiver::receive(void* buffer, size_t buffer_n_bytes)
|
||||
}
|
||||
|
||||
if (data_len != buffer_n_bytes) {
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[UdpReceiver::receive]";
|
||||
cout << " Expected buffer_n_bytes " << buffer_n_bytes;
|
||||
cout << " but got data_len " << data_len << endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,6 @@ UdpRecvModule::UdpRecvModule(
|
||||
queue_(queue),
|
||||
is_receiving_(true)
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[UdpRecvModule::UdpRecvModule]";
|
||||
cout << " Starting with ";
|
||||
cout << "udp_port " << udp_port << endl;
|
||||
#endif
|
||||
|
||||
receiving_thread_ = thread(
|
||||
&UdpRecvModule::receive_thread, this,
|
||||
udp_port);
|
||||
|
||||
@@ -9,14 +9,6 @@ using namespace std;
|
||||
void WriterUtils::set_process_effective_id(int user_id)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[WriterUtils::set_process_effective_id]";
|
||||
cout << " Setting process user to " << user_id << endl;
|
||||
#endif
|
||||
|
||||
// TODO: use setfsuid and setfsgid
|
||||
|
||||
if (setegid(user_id)) {
|
||||
@@ -51,14 +43,6 @@ void WriterUtils::create_destination_folder(const string& output_file)
|
||||
if (file_separator_index != string::npos) {
|
||||
string output_folder(output_file.substr(0, file_separator_index));
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "[WriterUtils::create_destination_folder]";
|
||||
cout << " Creating folder " << output_folder << endl;
|
||||
#endif
|
||||
|
||||
string create_folder_command("mkdir -p " + output_folder);
|
||||
system(create_folder_command.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user