summaryrefslogtreecommitdiff
path: root/lib/block_task.cpp
diff options
context:
space:
mode:
authorJosh Blum2013-02-12 21:43:27 -0800
committerJosh Blum2013-02-17 20:53:28 -0600
commit9191fbce9f4d161e4f871231469ef009c86f177f (patch)
treec03be55bdd4047db0b82d550d0f6c4bb38cec1ec /lib/block_task.cpp
parent93afc6bff6ce58c08d8ae4b1509f682a05a9c59d (diff)
downloadsandhi-9191fbce9f4d161e4f871231469ef009c86f177f.tar.gz
sandhi-9191fbce9f4d161e4f871231469ef009c86f177f.tar.bz2
sandhi-9191fbce9f4d161e4f871231469ef009c86f177f.zip
gras: working on block stats
Diffstat (limited to 'lib/block_task.cpp')
-rw-r--r--lib/block_task.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index 47c0019..9acf525 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -9,6 +9,7 @@ void BlockActor::mark_done(void)
{
if (this->block_state == BLOCK_STATE_DONE) return; //can re-enter checking done first
+ this->stats.stop_time = time_now();
this->block_ptr->stop();
//flush partial output buffers to the downstream
@@ -98,18 +99,13 @@ void BlockActor::output_fail(const size_t i)
void BlockActor::handle_task(void)
{
+ const time_ticks_t task_start = time_now();
//------------------------------------------------------------------
//-- Decide if its possible to continue any processing:
//-- Handle task may get called for incoming buffers,
//-- however, not all ports may have available buffers.
//------------------------------------------------------------------
- this->handle_task_count++;
if GRAS_UNLIKELY(not this->is_work_allowed()) return;
- this->work_count++;
-
- #ifdef WORK_DEBUG
- WorkDebugPrinter WDP(block_ptr->to_string());
- #endif
//------------------------------------------------------------------
//-- Asynchronous notification through atomic variable
@@ -185,7 +181,12 @@ void BlockActor::handle_task(void)
//------------------------------------------------------------------
//-- the work
//------------------------------------------------------------------
+<<<<<<< HEAD
if GRAS_UNLIKELY(this->interruptible_thread)
+=======
+ const time_ticks_t work_start = time_now();
+ if (this->interruptible_thread)
+>>>>>>> gras: working on block stats
{
this->interruptible_thread->call();
}
@@ -193,6 +194,7 @@ void BlockActor::handle_task(void)
{
this->task_work();
}
+ const time_ticks_t work_stop = time_now();
//------------------------------------------------------------------
//-- Flush output buffers downstream
@@ -216,6 +218,13 @@ void BlockActor::handle_task(void)
//still have IO ready? kick off another task
this->task_kicker();
+
+ //save stats
+ const time_ticks_t task_time = time_now() - task_start;
+ const time_ticks_t work_time = work_stop - work_start;
+ this->stats.work_count++;
+ this->stats.total_time_work += work_time;
+ this->stats.total_time_work_other += task_time - work_time;
}
void BlockActor::consume(const size_t i, const size_t items)