Selaa lähdekoodia

add dotty output

Samuel Thibault 14 vuotta sitten
vanhempi
commit
0332a0a7a2
2 muutettua tiedostoa jossa 23 lisäystä ja 0 poistoa
  1. 3 0
      include/starpu_bound.h
  2. 20 0
      src/profiling/bound.c

+ 3 - 0
include/starpu_bound.h

@@ -28,6 +28,9 @@ void starpu_bound_start(int deps, int prio);
 /* Stop recording tasks */
 void starpu_bound_stop(void);
 
+/* Print the DAG that was recorded */
+void starpu_bound_print_dot(FILE *output);
+
 /* Get theoretical upper bound (needs glpk support) */
 void starpu_bound_compute(double *res, double *integer_res, int integer);
 

+ 20 - 0
src/profiling/bound.c

@@ -357,6 +357,26 @@ static int ancestor(struct bound_task *child, struct bound_task *parent) {
 	return 0;
 }
 
+void starpu_bound_print_dot(FILE *output) {
+	struct bound_task *t;
+	struct bound_tag_dep *td;
+	int i;
+
+	if (!recorddeps) {
+		fprintf(output, "Not supported\n");
+		return;
+	}
+	fprintf(output, "strict digraph bounddeps {\n");
+	for (t = tasks; t; t = t->next) {
+		fprintf(output, "\"t%lu\"\n", t->id);
+		for (i = 0; i < t->depsn; i++)
+			fprintf(output, "\"t%lu\" -> \"t%lu\"\n", t->deps[i]->id, t->id);
+	}
+	for (td = tag_deps; td; td = td->next)
+		fprintf(output, "\"tag%lu\" -> \"tag%lu\";\n", (unsigned long) td->dep_tag, (unsigned long) td->tag);
+	fprintf(output, "}\n");
+}
+
 /*
  * lp_solve format
  */