From f36bddec19418092a9370a3fa1dbb6ee73637915 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <pedro.gonnet@durham.ac.uk> Date: Tue, 2 Jul 2013 11:19:10 +0000 Subject: [PATCH] time only the queue lock. Former-commit-id: 62e5b572c185f871689ee5cc94c42ad4f70ab6e0 --- src/queue.c | 8 +++----- src/timers.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/queue.c b/src/queue.c index dba27a663e..3820267ee2 100644 --- a/src/queue.c +++ b/src/queue.c @@ -146,20 +146,19 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) { lock_type *qlock = &q->lock; struct task *qtasks, *res = NULL; struct cell *ci, *cj; - TIMER_TIC /* If there are no tasks, leave immediately. */ - if ( q->count == 0 ) { - TIMER_TOC(timer_queue); + if ( q->count == 0 ) return NULL; - } /* Main loop, while there are tasks... */ while ( q->count > 0 ) { /* Grab the task lock. */ + TIMER_TIC if ( lock_lock( qlock ) != 0 ) error( "Locking the qlock failed.\n" ); + TIMER_TOC( timer_qlock ); /* Set some pointers we will use often. */ qtid = q->tid; @@ -264,7 +263,6 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) { } /* while there are tasks. */ /* Take the money and run. */ - TIMER_TOC(timer_queue); return res; } diff --git a/src/timers.h b/src/timers.h index 071ee6a722..e192e32732 100644 --- a/src/timers.h +++ b/src/timers.h @@ -35,7 +35,7 @@ enum { timer_dopair_subset, timer_doghost, timer_gettask, - timer_queue, + timer_qlock, timer_stalled, timer_runners, timer_step, -- GitLab