|
@@ -31,17 +31,15 @@ static double convert_to_byte_units(float d, unsigned max_unit, unsigned *unit)
|
|
|
return d;
|
|
|
}
|
|
|
|
|
|
-void starpu_profiling_bus_helper_display_summary(void)
|
|
|
+void _starpu_profiling_bus_helper_display_summary(FILE *stream)
|
|
|
{
|
|
|
const char *stats;
|
|
|
int long long sum_transferred = 0;
|
|
|
const char *byte_units[] = { "B", "KB", "MB", "GB", "TB" };
|
|
|
unsigned max_unit = sizeof(byte_units) / sizeof(byte_units[0]);
|
|
|
|
|
|
- if (!((stats = starpu_getenv("STARPU_BUS_STATS")) && atoi(stats))) return;
|
|
|
-
|
|
|
- fprintf(stderr, "\n#---------------------\n");
|
|
|
- fprintf(stderr, "Data transfer stats:\n");
|
|
|
+ fprintf(stream, "\n#---------------------\n");
|
|
|
+ fprintf(stream, "Data transfer stats:\n");
|
|
|
|
|
|
int busid;
|
|
|
int bus_cnt = starpu_bus_get_count();
|
|
@@ -66,10 +64,10 @@ void starpu_profiling_bus_helper_display_summary(void)
|
|
|
_starpu_memory_node_get_name(src, src_name, sizeof(src_name));
|
|
|
_starpu_memory_node_get_name(dst, dst_name, sizeof(dst_name));
|
|
|
|
|
|
- fprintf(stderr, "\t%s -> %s", src_name, dst_name);
|
|
|
- fprintf(stderr, "\t%.2lf %s", d, byte_units[unit]);
|
|
|
- fprintf(stderr, "\t%.2lf %s/s", d / elapsed_time, byte_units[unit]);
|
|
|
- fprintf(stderr, "\t(transfers : %lld - avg %.2lf %s)\n", transfer_cnt, d / transfer_cnt, byte_units[unit]);
|
|
|
+ fprintf(stream, "\t%s -> %s", src_name, dst_name);
|
|
|
+ fprintf(stream, "\t%.2lf %s", d, byte_units[unit]);
|
|
|
+ fprintf(stream, "\t%.2lf %s/s", d / elapsed_time, byte_units[unit]);
|
|
|
+ fprintf(stream, "\t(transfers : %lld - avg %.2lf %s)\n", transfer_cnt, d / transfer_cnt, byte_units[unit]);
|
|
|
|
|
|
sum_transferred += transferred;
|
|
|
}
|
|
@@ -77,23 +75,27 @@ void starpu_profiling_bus_helper_display_summary(void)
|
|
|
unsigned unit = 0;
|
|
|
double d = convert_to_byte_units(sum_transferred, max_unit, &unit);
|
|
|
|
|
|
- fprintf(stderr, "Total transfers: %.2lf %s\n", d, byte_units[unit]);
|
|
|
- fprintf(stderr, "#---------------------\n");
|
|
|
+ fprintf(stream, "Total transfers: %.2lf %s\n", d, byte_units[unit]);
|
|
|
+ fprintf(stream, "#---------------------\n");
|
|
|
}
|
|
|
|
|
|
-void starpu_profiling_worker_helper_display_summary(void)
|
|
|
+void starpu_profiling_bus_helper_display_summary(void)
|
|
|
{
|
|
|
const char *stats;
|
|
|
+ if (!((stats = starpu_getenv("STARPU_BUS_STATS")) && atoi(stats))) return;
|
|
|
+ _starpu_profiling_bus_helper_display_summary(stderr);
|
|
|
+}
|
|
|
+
|
|
|
+void _starpu_profiling_worker_helper_display_summary(FILE *stream)
|
|
|
+{
|
|
|
double sum_consumed = 0.;
|
|
|
int profiling = starpu_profiling_status_get();
|
|
|
double overall_time = 0;
|
|
|
int workerid;
|
|
|
int worker_cnt = starpu_worker_get_count();
|
|
|
|
|
|
- if (!((stats = starpu_getenv("STARPU_WORKER_STATS")) && atoi(stats))) return;
|
|
|
-
|
|
|
- fprintf(stderr, "\n#---------------------\n");
|
|
|
- fprintf(stderr, "Worker stats:\n");
|
|
|
+ fprintf(stream, "\n#---------------------\n");
|
|
|
+ fprintf(stream, "Worker stats:\n");
|
|
|
|
|
|
for (workerid = 0; workerid < worker_cnt; workerid++)
|
|
|
{
|
|
@@ -103,8 +105,8 @@ void starpu_profiling_worker_helper_display_summary(void)
|
|
|
|
|
|
starpu_worker_get_name(workerid, name, sizeof(name));
|
|
|
|
|
|
- fprintf(stderr, "%-32s\n", name);
|
|
|
- fprintf(stderr, "\t%d task(s)\n", info.executed_tasks);
|
|
|
+ fprintf(stream, "%-32s\n", name);
|
|
|
+ fprintf(stream, "\t%d task(s)\n", info.executed_tasks);
|
|
|
|
|
|
if (profiling)
|
|
|
{
|
|
@@ -114,14 +116,14 @@ void starpu_profiling_worker_helper_display_summary(void)
|
|
|
if (total_time > overall_time)
|
|
|
overall_time = total_time;
|
|
|
|
|
|
- fprintf(stderr, "\ttotal: %.2lf ms executing: %.2lf ms sleeping: %.2lf ms overhead %.2lf ms\n",
|
|
|
+ fprintf(stream, "\ttotal: %.2lf ms executing: %.2lf ms sleeping: %.2lf ms overhead %.2lf ms\n",
|
|
|
total_time, executing_time, sleeping_time, total_time - executing_time - sleeping_time);
|
|
|
if (info.used_cycles || info.stall_cycles)
|
|
|
- fprintf(stderr, "\t%llu Mcy %llu Mcy stall\n", (unsigned long long)info.used_cycles/1000000, (unsigned long long)info.stall_cycles/1000000);
|
|
|
+ fprintf(stream, "\t%llu Mcy %llu Mcy stall\n", (unsigned long long)info.used_cycles/1000000, (unsigned long long)info.stall_cycles/1000000);
|
|
|
if (info.energy_consumed)
|
|
|
- fprintf(stderr, "\t%f J consumed\n", info.energy_consumed);
|
|
|
+ fprintf(stream, "\t%f J consumed\n", info.energy_consumed);
|
|
|
if (info.flops)
|
|
|
- fprintf(stderr, "\t%f GFlop/s\n\n", info.flops / total_time / 1000000);
|
|
|
+ fprintf(stream, "\t%f GFlop/s\n\n", info.flops / total_time / 1000000);
|
|
|
}
|
|
|
|
|
|
sum_consumed += info.energy_consumed;
|
|
@@ -135,10 +137,17 @@ void starpu_profiling_worker_helper_display_summary(void)
|
|
|
double idle_power = atof(strval_idle_power); /* Watt */
|
|
|
double idle_energy = idle_power * overall_time / 1000.; /* J */
|
|
|
|
|
|
- fprintf(stderr, "Idle energy: %.2lf J\n", idle_energy);
|
|
|
- fprintf(stderr, "Total energy: %.2lf J\n",
|
|
|
+ fprintf(stream, "Idle energy: %.2lf J\n", idle_energy);
|
|
|
+ fprintf(stream, "Total energy: %.2lf J\n",
|
|
|
sum_consumed + idle_energy);
|
|
|
}
|
|
|
}
|
|
|
- fprintf(stderr, "#---------------------\n");
|
|
|
+ fprintf(stream, "#---------------------\n");
|
|
|
+}
|
|
|
+
|
|
|
+void starpu_profiling_worker_helper_display_summary(void)
|
|
|
+{
|
|
|
+ const char *stats;
|
|
|
+ if (!((stats = starpu_getenv("STARPU_WORKER_STATS")) && atoi(stats))) return;
|
|
|
+ _starpu_profiling_worker_helper_display_summary(stderr);
|
|
|
}
|