|
@@ -68,3 +68,30 @@ void _starpu_driver_update_job_feedback(starpu_job_t j, struct starpu_worker_s *
|
|
|
|
|
|
(void)STARPU_ATOMIC_ADD(&worker_args->jobq->total_job_performed, 1);
|
|
(void)STARPU_ATOMIC_ADD(&worker_args->jobq->total_job_performed, 1);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/* Workers may block when there is no work to do at all. We assume that the
|
|
|
|
+ * mutex is hold when that function is called. */
|
|
|
|
+void _starpu_block_worker(int workerid, pthread_cond_t *cond, pthread_mutex_t *mutex)
|
|
|
|
+{
|
|
|
|
+ struct timespec start_time, end_time;
|
|
|
|
+
|
|
|
|
+ STARPU_TRACE_WORKER_SLEEP_START
|
|
|
|
+ _starpu_worker_set_status(workerid, STATUS_SLEEPING);
|
|
|
|
+
|
|
|
|
+ starpu_clock_gettime(&start_time);
|
|
|
|
+ _starpu_worker_register_sleeping_start_date(workerid, &start_time);
|
|
|
|
+
|
|
|
|
+ PTHREAD_COND_WAIT(cond, mutex);
|
|
|
|
+
|
|
|
|
+ _starpu_worker_set_status(workerid, STATUS_UNKNOWN);
|
|
|
|
+ STARPU_TRACE_WORKER_SLEEP_END
|
|
|
|
+ starpu_clock_gettime(&end_time);
|
|
|
|
+
|
|
|
|
+ int profiling = starpu_profiling_status_get();
|
|
|
|
+ if (profiling)
|
|
|
|
+ {
|
|
|
|
+ struct timespec sleeping_time;
|
|
|
|
+ starpu_timespec_sub(&end_time, &start_time, &sleeping_time);
|
|
|
|
+ _starpu_worker_update_profiling_info_sleeping(workerid, &start_time, &end_time);
|
|
|
|
+ }
|
|
|
|
+}
|