Selaa lähdekoodia

tests/microbenchs/tasks_overhead.c: save results into files to be plotted

Nathalie Furmento 14 vuotta sitten
vanhempi
commit
79e897db21
1 muutettua tiedostoa jossa 40 lisäystä ja 0 poistoa
  1. 40 0
      tests/microbenchs/tasks_overhead.c

+ 40 - 0
tests/microbenchs/tasks_overhead.c

@@ -149,6 +149,46 @@ int main(int argc, char **argv)
 	fprintf(stderr, "Total: %lf secs\n", (timing_submit+timing_exec)/1000000);
 	fprintf(stderr, "Per task: %lf usecs\n", (timing_submit+timing_exec)/ntasks);
 
+        {
+                char *output_dir = getenv("STARPU_BENCH_DIR");
+                char *bench_id = getenv("STARPU_BENCH_ID");
+
+                if (output_dir && bench_id) {
+                        char file[1024];
+                        FILE *f;
+
+                        sprintf(file, "%s/total_submit.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, timing_submit/1000000);
+                        fclose(f);
+
+                        sprintf(file, "%s/per_task_submit.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, timing_submit/ntasks);
+                        fclose(f);
+
+                        sprintf(file, "%s/total_execution.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, timing_exec/1000000);
+                        fclose(f);
+
+                        sprintf(file, "%s/per_task_execution.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, timing_exec/ntasks);
+                        fclose(f);
+
+                        sprintf(file, "%s/total_submit_execution.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, (timing_submit+timing_exec)/1000000);
+                        fclose(f);
+
+                        sprintf(file, "%s/per_task_submit_execution.dat", output_dir);
+                        f = fopen(file, "a");
+                        fprintf(f, "%s\t%lf\n", bench_id, (timing_submit+timing_exec)/ntasks);
+                        fclose(f);
+                }
+        }
+
 	starpu_shutdown();
 
 	return 0;