diff --git a/core-buffer/src/BinaryWriter.cpp b/core-buffer/src/BinaryWriter.cpp index 5c891ea..c40847b 100644 --- a/core-buffer/src/BinaryWriter.cpp +++ b/core-buffer/src/BinaryWriter.cpp @@ -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() diff --git a/core-buffer/src/LiveRecvModule.cpp b/core-buffer/src/LiveRecvModule.cpp index 58381b5..e986bb1 100644 --- a/core-buffer/src/LiveRecvModule.cpp +++ b/core-buffer/src/LiveRecvModule.cpp @@ -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); } diff --git a/core-buffer/src/RingBuffer.cpp b/core-buffer/src/RingBuffer.cpp index db40991..61e1f02 100644 --- a/core-buffer/src/RingBuffer.cpp +++ b/core-buffer/src/RingBuffer.cpp @@ -11,14 +11,6 @@ RingBuffer::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 @@ -65,17 +57,6 @@ void RingBuffer::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 @@ -117,17 +98,6 @@ char* RingBuffer::reserve(shared_ptr 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::commit(shared_ptr frame_metadata) lock_guard 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 @@ -195,15 +156,6 @@ pair, char*> RingBuffer::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 lock(ringbuffer_slots_mutex_); diff --git a/core-buffer/src/UdpReceiver.cpp b/core-buffer/src/UdpReceiver.cpp index c6f5455..a71acaa 100644 --- a/core-buffer/src/UdpReceiver.cpp +++ b/core-buffer/src/UdpReceiver.cpp @@ -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; } diff --git a/core-buffer/src/UdpRecvModule.cpp b/core-buffer/src/UdpRecvModule.cpp index 83cf479..d21f438 100644 --- a/core-buffer/src/UdpRecvModule.cpp +++ b/core-buffer/src/UdpRecvModule.cpp @@ -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); diff --git a/core-buffer/src/WriterUtils.cpp b/core-buffer/src/WriterUtils.cpp index bcc8cc4..7653bee 100644 --- a/core-buffer/src/WriterUtils.cpp +++ b/core-buffer/src/WriterUtils.cpp @@ -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()); } diff --git a/core-buffer/test/test_MetadataBuffer.cpp b/core-buffer/test/test_MetadataBuffer.cpp deleted file mode 100644 index e1cc3f4..0000000 --- a/core-buffer/test/test_MetadataBuffer.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "gtest/gtest.h" -#include "MetadataBuffer.hpp" - -using namespace std; - -TEST(MetadataBuffer, basic_operations) -{ - int n_frames = 10; - int n_modules = 3; - - unordered_map header_values { - {"frame", HeaderDataType("uint64")}, - {"module_number", HeaderDataType("uint64", n_modules)} - }; - - MetadataBuffer metadata_buffer( - static_cast(n_frames), - header_values); - - uint64_t base_frame_data = 12345678; - uint64_t base_module_number = 0; - - for (int i = 0; i header_values = { - {"frame", HeaderDataType("uint64")}, - {"module_number", HeaderDataType("uint64", n_modules)} - }; - - MetadataBuffer metadata_buffer(n_frames, header_values); - - uint64_t data = 0; - - metadata_buffer.add_metadata_to_buffer("frame", 0, (char*)&data); - metadata_buffer.get_metadata_values("frame"); - - EXPECT_THROW( - metadata_buffer.get_metadata_values("non_existant"), - runtime_error); - EXPECT_THROW( - metadata_buffer.add_metadata_to_buffer("non_existant", 0, nullptr), - runtime_error); - EXPECT_THROW( - metadata_buffer.add_metadata_to_buffer("frame", n_frames, nullptr), - runtime_error); -} \ No newline at end of file diff --git a/sf-buffer/src/sf_live.cpp b/sf-buffer/src/sf_live.cpp index 9cdd191..b699485 100644 --- a/sf-buffer/src/sf_live.cpp +++ b/sf-buffer/src/sf_live.cpp @@ -36,16 +36,6 @@ void sf_live ( MODULE_N_BYTES, 0); - #ifdef DEBUG_OUTPUT - using namespace date; - using namespace chrono; - - cout << "[" << system_clock::now() << "]"; - cout << "[sf_live::sf_live]"; - cout << " Sent pulse_id "; - cout << current_pulse_id << endl; - #endif - current_pulse_id++; } @@ -74,21 +64,6 @@ int main (int argc, char *argv[]) { ipc_stream << BUFFER_LIVE_IPC_URL << (int)source_id; const auto ipc_address = ipc_stream.str(); - #ifdef DEBUG_OUTPUT - using namespace date; - using namespace chrono; - - cout << "[" << system_clock::now() << "]"; - cout << "[sf_live::main]"; - - cout << " device " << device; - cout << " channel_name " << channel_name; - cout << " source_id " << source_id; - cout << " start_pulse_id " << start_pulse_id; - cout << " ipc_address " << ipc_address; - cout << endl; - #endif - auto ctx = zmq_ctx_new(); auto socket = zmq_socket(ctx, ZMQ_PUSH);