Переглянути джерело

fix profiling measurement: we need to reset the "executing" state, otherwise the idle part at the end would be taken as executiong

Samuel Thibault 9 роки тому
батько
коміт
1d6bac2be8

+ 3 - 0
src/drivers/driver_common/driver_common.c

@@ -137,7 +137,10 @@ void _starpu_driver_end_job(struct _starpu_worker *worker, struct _starpu_job *j
 	if (rank == 0)
 	{
 		if ((profiling && profiling_info) || calibrate_model || starpu_top)
+		{
 			_starpu_clock_gettime(codelet_end);
+			_starpu_worker_register_executing_end(workerid);
+		}
 #ifdef HAVE_AYUDAME_H
 		if (AYU_event) AYU_event(AYU_POSTRUNTASK, j->job_id, NULL);
 #endif

+ 10 - 0
src/profiling/profiling.c

@@ -268,6 +268,16 @@ void _starpu_worker_register_executing_start_date(int workerid, struct timespec
 	}
 }
 
+void _starpu_worker_register_executing_end(int workerid)
+{
+	if (starpu_profiling_status_get())
+	{
+		STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
+		worker_registered_executing_start[workerid] = 0;
+		STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
+	}
+}
+
 
 void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks, uint64_t used_cycles, uint64_t stall_cycles, double power_consumed, double flops)
 {

+ 3 - 0
src/profiling/profiling.h

@@ -47,6 +47,9 @@ void _starpu_worker_stop_sleeping(int workerid);
  * end of the codelet. */
 void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start);
 
+/* Record that the worker is not executing any more. */
+void _starpu_worker_register_executing_end(int workerid);
+
 /* When StarPU is initialized, a matrix describing all the bus between memory
  * nodes is created: it indicates whether there is a physical link between two
  * memory nodes or not. This matrix should contain the identifier of the bus