Przeglądaj źródła

Clarify the fact that timing_now returns the current time in us, and correct
its use.

Cédric Augonnet 16 lat temu
rodzic
commit
32d5a4c140

+ 2 - 1
src/common/timing.c

@@ -40,12 +40,13 @@ inline double timing_delay(tick_t *t1, tick_t *t2)
 	return TIMING_DELAY(*t1, *t2);
 }
 
+/* returns the current time in us */
 inline double timing_now(void)
 {
 	tick_t tick_now;
 	GET_TICK(tick_now);
 
-	return tick2usec(((tick_now).ts.tv_sec*1e9) + (tick_now).ts.tv_usec);
+	return tick2usec(((tick_now).ts.tv_sec*1e9) + (tick_now).ts.tv_usec*1e3);
 }
 
 

+ 1 - 1
src/core/mechanisms/deque_queues.c

@@ -52,7 +52,7 @@ struct jobq_s *create_deque(void)
 	deque->njobs = 0;
 	deque->nprocessed = 0;
 
-	deque->exp_start = timing_now()/1000000;
+	deque->exp_start = timing_now();
 	deque->exp_len = 0.0;
 	deque->exp_end = deque->exp_start;
 

+ 1 - 1
src/core/mechanisms/fifo_queues.c

@@ -52,7 +52,7 @@ struct jobq_s *create_fifo(void)
 	fifo->njobs = 0;
 	fifo->nprocessed = 0;
 
-	fifo->exp_start = timing_now()/1000000;
+	fifo->exp_start = timing_now();
 	fifo->exp_len = 0.0;
 	fifo->exp_end = fifo->exp_start;
 

+ 1 - 1
src/core/mechanisms/stack_queues.c

@@ -52,7 +52,7 @@ struct jobq_s *create_stack(void)
 	stack->njobs = 0;
 	stack->nprocessed = 0;
 
-	stack->exp_start = timing_now()/1000000;
+	stack->exp_start = timing_now();
 	stack->exp_len = 0.0;
 	stack->exp_end = stack->exp_start;
 

+ 3 - 4
src/core/policies/deque-modeling-policy-data-aware.c

@@ -30,7 +30,7 @@ static job_t dmda_pop_task(struct jobq_s *q)
 		double model = j->predicted;
 	
 		fifo->exp_len -= model;
-		fifo->exp_start = timing_now()/1000000 + model;
+		fifo->exp_start = timing_now() + model;
 		fifo->exp_end = fifo->exp_start + fifo->exp_len;
 	}	
 
@@ -76,9 +76,8 @@ static int _dmda_push_task(struct jobq_s *q __attribute__ ((unused)) , job_t j,
 	{
 		fifo = queue_array[worker]->queue;
 
-		/* XXX */
-		fifo->exp_start = STARPU_MAX(fifo->exp_start, timing_now()/1000000);
-		fifo->exp_end = STARPU_MAX(fifo->exp_start, timing_now()/1000000);
+		fifo->exp_start = STARPU_MAX(fifo->exp_start, timing_now());
+		fifo->exp_end = STARPU_MAX(fifo->exp_end, timing_now());
 
 		if ((queue_array[worker]->who & j->task->cl->where) == 0)
 		{

+ 4 - 5
src/core/policies/deque-modeling-policy.c

@@ -30,7 +30,7 @@ static job_t dm_pop_task(struct jobq_s *q)
 		double model = j->predicted;
 	
 		fifo->exp_len -= model;
-		fifo->exp_start = timing_now()/1000000 + model;
+		fifo->exp_start = timing_now() + model;
 		fifo->exp_end = fifo->exp_start + fifo->exp_len;
 	}	
 
@@ -52,7 +52,7 @@ static struct job_list_s *dm_pop_every_task(struct jobq_s *q, uint32_t where)
 			double model = i->predicted;
 	
 			fifo->exp_len -= model;
-			fifo->exp_start = timing_now()/1000000 + model;
+			fifo->exp_start = timing_now() + model;
 			fifo->exp_end = fifo->exp_start + fifo->exp_len;
 		}
 	}
@@ -78,9 +78,8 @@ static int _dm_push_task(struct jobq_s *q __attribute__ ((unused)), job_t j, uns
 		
 		fifo = queue_array[worker]->queue;
 
-		/* XXX */
-		fifo->exp_start = STARPU_MAX(fifo->exp_start, timing_now()/1000000);
-		fifo->exp_end = STARPU_MAX(fifo->exp_start, timing_now()/1000000);
+		fifo->exp_start = STARPU_MAX(fifo->exp_start, timing_now());
+		fifo->exp_end = STARPU_MAX(fifo->exp_end, timing_now());
 
 		if ((queue_array[worker]->who & j->task->cl->where) == 0)
 		{