diff options
-rw-r--r-- | lib/block_task.cpp | 14 | ||||
-rw-r--r-- | lib/gras_impl/debug.hpp | 16 |
2 files changed, 26 insertions, 4 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp index c3e93d0..b2b08db 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -108,10 +108,6 @@ GRAS_FORCE_INLINE bool BlockActor::is_work_allowed(void) void BlockActor::handle_task(void) { - #ifdef WORK_DEBUG - WorkDebugPrinter WDP(block_ptr->to_string()); - #endif - //------------------------------------------------------------------ //-- Decide if its possible to continue any processing: //-- Handle task may get called for incoming buffers, @@ -119,6 +115,10 @@ void BlockActor::handle_task(void) //------------------------------------------------------------------ if (not this->is_work_allowed()) return; + #ifdef WORK_DEBUG + WorkDebugPrinter WDP(block_ptr->to_string()); + #endif + //------------------------------------------------------------------ //-- Asynchronous notification through atomic variable //-- that the executor has instructed workers to stop. @@ -230,6 +230,9 @@ void BlockActor::handle_task(void) void BlockActor::consume(const size_t i, const size_t items) { + #ifdef ITEM_CONSPROD + std::cerr << "consume " << items << std::endl; + #endif this->items_consumed[i] += items; const size_t bytes = items*this->input_items_sizes[i]; this->input_queues.consume(i, bytes); @@ -238,6 +241,9 @@ void BlockActor::consume(const size_t i, const size_t items) void BlockActor::produce(const size_t i, const size_t items) { + #ifdef ITEM_CONSPROD + std::cerr << "produce " << items << std::endl; + #endif SBuffer &buff = this->output_queues.front(i); this->items_produced[i] += items; const size_t bytes = items*this->output_items_sizes[i]; diff --git a/lib/gras_impl/debug.hpp b/lib/gras_impl/debug.hpp index 5987951..c8c7dfe 100644 --- a/lib/gras_impl/debug.hpp +++ b/lib/gras_impl/debug.hpp @@ -12,6 +12,8 @@ extern void *operator new(std::size_t n) throw (std::bad_alloc); #include <iostream> #include <stdexcept> #include <boost/current_function.hpp> +#include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/thread/thread.hpp> //---------------------------------------------------------------------- //-- set to 1 to enable these debugs: @@ -25,6 +27,20 @@ extern void *operator new(std::size_t n) throw (std::bad_alloc); //#define WORK_DEBUG #define ASSERTING //#define MESSAGE_TRACING +//#define ITEM_CONSPROD + +//---------------------------------------------------------------------- +//-- time accumulation printer +//---------------------------------------------------------------------- +#define TIME_ACCUM_PRINT(code) \ +{\ + static boost::posix_time::time_duration __t; \ + const boost::system_time __t0 = boost::get_system_time(); \ + {code} \ + const boost::system_time __t1 = boost::get_system_time(); \ + __t += __t1 - __t0; \ + std::cerr << __FILE__ << ":" << __LINE__ << " total time: " << boost::posix_time::to_simple_string(__t) << std::endl; \ +} //---------------------------------------------------------------------- //-- various debug prints |