From 5e5dab461e88cd745093a2e91245a5ff1d44d3af Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 8 Apr 2020 10:30:35 +0200 Subject: [PATCH] Add debug output to ProcessManager --- core-writer/src/ProcessManager.cpp | 37 ++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/core-writer/src/ProcessManager.cpp b/core-writer/src/ProcessManager.cpp index 6be51da..e4d373f 100644 --- a/core-writer/src/ProcessManager.cpp +++ b/core-writer/src/ProcessManager.cpp @@ -21,7 +21,6 @@ void ProcessManager::start_rest_api(const uint16_t rest_port) // In case SIGINT stopped the rest_api. // writer_manager.stop(); - #ifdef DEBUG_OUTPUT using namespace date; using namespace chrono; @@ -36,12 +35,30 @@ void ProcessManager::start_writing( const int n_frames, const int user_id) { - recv_module_.start_saving(); + #ifdef DEBUG_OUTPUT + using namespace date; + using namespace chrono; + cout << "[" << system_clock::now() << "]"; + cout << "[ProcessManager::start_writing]"; + cout << " output_file " << output_file; + cout << " n_frames " << n_frames; + cout << " user_id " << user_id << endl; + #endif + + // TODO: Empty buffer to have a clean slate. write_module_.start_writing(output_file, n_frames, user_id); + recv_module_.start_saving(); } void ProcessManager::stop_writing() { + #ifdef DEBUG_OUTPUT + using namespace date; + using namespace chrono; + cout << "[" << system_clock::now() << "]"; + cout << "[ProcessManager::stop_writing]" << endl; + #endif + recv_module_.stop_saving(); write_module_.stop_writing(); } @@ -50,6 +67,15 @@ void ProcessManager::start_receiving( const string& connect_address, const int n_receiving_threads) { + #ifdef DEBUG_OUTPUT + using namespace date; + using namespace chrono; + cout << "[" << system_clock::now() << "]"; + cout << "[ProcessManager::start_receiving]" << endl; + cout << " connect_address " << connect_address; + cout << " n_receiving_threads " << n_receiving_threads; + #endif + recv_module_.start_recv( connect_address, static_cast(n_receiving_threads)); @@ -57,5 +83,12 @@ void ProcessManager::start_receiving( void ProcessManager::stop_receiving() { + #ifdef DEBUG_OUTPUT + using namespace date; + using namespace chrono; + cout << "[" << system_clock::now() << "]"; + cout << "[ProcessManager::stop_receiving]" << endl; + #endif + recv_module_.stop_recv(); } \ No newline at end of file