浏览代码

do not even measure task duration if perf counters are not enabled

Samuel Thibault 5 年之前
父节点
当前提交
ca3b736346
共有 1 个文件被更改,包括 17 次插入17 次删除
  1. 17 17
      src/drivers/driver_common/driver_common.c

+ 17 - 17
src/drivers/driver_common/driver_common.c

@@ -208,27 +208,27 @@ void _starpu_driver_update_job_feedback(struct _starpu_job *j, struct _starpu_wo
 		calibrate_model = 1;
 #endif
 
-	starpu_timespec_sub(&worker->cl_end, &worker->cl_start, &measured_ts);
-	double measured = starpu_timing_timespec_to_us(&measured_ts);
-
-	if (!_starpu_perf_counter_paused())
+	if ((profiling && profiling_info) || calibrate_model || !_starpu_perf_counter_paused())
 	{
-		worker->__w_total_executed__value++;
-		worker->__w_cumul_execution_time__value += measured;
-		_starpu_perf_counter_update_per_worker_sample(worker->workerid);
-		if (cl->perf_counter_values)
-		{
-			struct starpu_perf_counter_sample_cl_values * const pcv = cl->perf_counter_values;
-			(void)STARPU_ATOMIC_ADD64(&pcv->task.total_executed, 1);
-			_starpu_perf_counter_update_acc_double(&pcv->task.cumul_execution_time, measured);
-			_starpu_perf_counter_update_per_codelet_sample(cl);
-		}
-	}
+		starpu_timespec_sub(&worker->cl_end, &worker->cl_start, &measured_ts);
+		double measured = starpu_timing_timespec_to_us(&measured_ts);
 
-	if ((profiling && profiling_info) || calibrate_model)
-	{
 		STARPU_ASSERT_MSG(measured >= 0, "measured=%lf\n", measured);
 
+		if (!_starpu_perf_counter_paused())
+		{
+			worker->__w_total_executed__value++;
+			worker->__w_cumul_execution_time__value += measured;
+			_starpu_perf_counter_update_per_worker_sample(worker->workerid);
+			if (cl->perf_counter_values)
+			{
+				struct starpu_perf_counter_sample_cl_values * const pcv = cl->perf_counter_values;
+				(void)STARPU_ATOMIC_ADD64(&pcv->task.total_executed, 1);
+				_starpu_perf_counter_update_acc_double(&pcv->task.cumul_execution_time, measured);
+				_starpu_perf_counter_update_per_codelet_sample(cl);
+			}
+		}
+
 		if (profiling && profiling_info)
 		{
 			memcpy(&profiling_info->start_time, &worker->cl_start, sizeof(struct timespec));