Browse Source

Show the idle consumption in the energy consumption summary

Samuel Thibault 14 years ago
parent
commit
c74b17beff
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/profiling/profiling_helpers.c

+ 13 - 0
src/profiling/profiling_helpers.c

@@ -55,6 +55,7 @@ void starpu_worker_profiling_helper_display_summary(void)
 	int profiling = starpu_profiling_status_get();
 	fprintf(stderr, "\nWorker statistics:\n");
 	fprintf(stderr,   "******************\n");
+	double overall_time = 0;
 
 	int workerid;
 	int worker_cnt = starpu_worker_get_count();
@@ -70,6 +71,8 @@ void starpu_worker_profiling_helper_display_summary(void)
 			double total_time = starpu_timing_timespec_to_us(&info.total_time) / 1000.;
 			double executing_time = starpu_timing_timespec_to_us(&info.executing_time) / 1000.;
 			double sleeping_time = starpu_timing_timespec_to_us(&info.sleeping_time) / 1000.;
+			if (total_time > overall_time)
+				overall_time = total_time;
 
 			fprintf(stderr, "%-32s\n", name);
 			fprintf(stderr, "\t%d task(s)\n\ttotal: %.2lf ms executing: %.2lf ms sleeping: %.2lf\n", info.executed_tasks, total_time, executing_time, sleeping_time);
@@ -84,6 +87,16 @@ void starpu_worker_profiling_helper_display_summary(void)
 		sum_consumed += info.power_consumed;
 	}
 
+	if (profiling) {
+		const char *strval_idle_power = getenv("STARPU_IDLE_POWER");
+		if (strval_idle_power) {
+			double idle_power = atof(strval_idle_power); /* Watt */
+			double idle_consumption = idle_power * overall_time / 1000.; /* J */
+
+			fprintf(stderr, "Idle consumption: %.2lf J\n", idle_consumption);
+			sum_consumed += idle_consumption;
+		}
+	}
 	if (profiling && sum_consumed)
 		fprintf(stderr, "Total consumption: %.2lf J\n", sum_consumed);
 }