diff --git a/src/cell.c b/src/cell.c index 39fb2c6b308df7c3b91b83b0b7f212f66cbccb36..9ee55dfa3eae40acc77f11eec8c9a544c4235527 100644 --- a/src/cell.c +++ b/src/cell.c @@ -33,35 +33,12 @@ #include "cycle.h" #include "lock.h" #include "task.h" +#include "timers.h" #include "part.h" #include "cell.h" #include "error.h" #include "inline.h" -/* The timers. */ -ticks cell_timer[ cell_timer_count ]; - - -/* Define the timer macros. */ -#ifdef TIMER_VERBOSE - #ifndef TIMER - #define TIMER - #endif -#endif -#ifdef TIMER - #define TIMER_TIC ticks tic = getticks(); - #define TIMER_TOC(t) timer_toc( t , tic ) - #define TIMER_TIC2 ticks tic2 = getticks(); - #define TIMER_TOC2(t) timer_toc( t , tic2 ) - INLINE static ticks timer_toc ( int t , ticks tic ) { - ticks d = (getticks() - tic); - __sync_add_and_fetch( &cell_timer[t] , d ); - return d; - } -#else - #define TIMER_TIC - #define TIMER_TOC(t) -#endif /** * @brief Lock a cell and hold its parents. @@ -76,7 +53,7 @@ int cell_locktree( struct cell *c ) { /* First of all, try to lock this cell. */ if ( c->hold || lock_trylock( &c->lock ) != 0 ) { - TIMER_TOC(cell_timer_tree); + TIMER_TOC(timer_locktree); return 1; } @@ -88,7 +65,7 @@ int cell_locktree( struct cell *c ) { error( "Failed to unlock cell." ); /* Admit defeat. */ - TIMER_TOC(cell_timer_tree); + TIMER_TOC(timer_locktree); return 1; } @@ -111,7 +88,7 @@ int cell_locktree( struct cell *c ) { /* If we reached the top of the tree, we're done. */ if ( finger == NULL ) { - TIMER_TOC(cell_timer_tree); + TIMER_TOC(timer_locktree); return 0; } @@ -127,7 +104,7 @@ int cell_locktree( struct cell *c ) { error( "Failed to unlock cell." ); /* Admit defeat. */ - TIMER_TOC(cell_timer_tree); + TIMER_TOC(timer_locktree); return 1; } @@ -154,7 +131,7 @@ void cell_unlocktree( struct cell *c ) { for ( finger = c->parent ; finger != NULL ; finger = finger->parent ) __sync_fetch_and_sub( &finger->hold , 1 ); - TIMER_TOC(cell_timer_tree); + TIMER_TOC(timer_locktree); } diff --git a/src/cell.h b/src/cell.h index bfa54e6b547bfe07bafd20b744db5966caf37f0b..9f882b9eec10f795496fa0e6bcb3e6a1e5a8d902 100644 --- a/src/cell.h +++ b/src/cell.h @@ -21,15 +21,6 @@ #define cell_sid_dt 13 -/* The queue timers. */ -enum { - cell_timer_none = 0, - cell_timer_tree, - cell_timer_count, - }; -extern ticks cell_timer[ cell_timer_count ]; - - /* Structure to store the data of a single cell. */ struct cell { diff --git a/src/timers.h b/src/timers.h index e192e327328f61b03c699d29ecad7ae33f046ca1..b1ee7c2f939ca58bd2eabbdba7a4b62c946d087e 100644 --- a/src/timers.h +++ b/src/timers.h @@ -36,7 +36,7 @@ enum { timer_doghost, timer_gettask, timer_qlock, - timer_stalled, + timer_locktree, timer_runners, timer_step, timer_count,