Browse Source

Make it possible to select the colour of the tasks in the DOT output depending
on the type of task rather than who executed it.

Cédric Augonnet 15 years ago
parent
commit
d8132d45cf
3 changed files with 58 additions and 9 deletions
  1. 15 2
      src/common/fxt.h
  2. 2 1
      src/core/dependencies/tags.c
  3. 41 6
      tools/fxt-tool.c

+ 15 - 2
src/common/fxt.h

@@ -166,8 +166,21 @@ do {									\
 #define TRACE_CODELET_TAG_DEPS(tag_child, tag_father)	\
 	FUT_DO_PROBE2(FUT_CODELET_TAG_DEPS, tag_child, tag_father)
 
-#define TRACE_TASK_DONE(tag)	\
-	FUT_DO_PROBE2(FUT_TASK_DONE, tag, syscall(SYS_gettid))
+#define TRACE_TASK_DONE(tag)							\
+do {										\
+	struct job_s *job = (tag)->job;						\
+	if (job && job->task 							\
+		&& job->task->cl						\
+		&& job->task->cl->model						\
+		&& job->task->cl->model->symbol)				\
+	{									\
+		char *symbol = job->task->cl->model->symbol;			\
+		FUT_DO_PROBE3STR(FUT_TASK_DONE, tag->id, syscall(SYS_gettid), 1, symbol);\
+	}									\
+	else {									\
+		FUT_DO_PROBE3(FUT_TASK_DONE, tag->id, syscall(SYS_gettid), 0);	\
+	}									\
+} while(0);
 
 #define TRACE_DATA_COPY(src_node, dst_node, size)	\
 	FUT_DO_PROBE3(FUT_DATA_COPY, src_node, dst_node, size)

+ 2 - 1
src/core/dependencies/tags.c

@@ -235,7 +235,8 @@ static void notify_tag_dependencies(struct tag_s *tag)
 	starpu_spin_lock(&tag->lock);
 
 	tag->state = DONE;
-	TRACE_TASK_DONE(tag->id);
+
+	TRACE_TASK_DONE(tag);
 
 	nsuccs = tag->nsuccs;
 

+ 41 - 6
tools/fxt-tool.c

@@ -208,6 +208,27 @@ int find_workder_id(unsigned long tid)
 	return id;
 }
 
+static unsigned get_colour_symbol_red(char *name)
+{
+	/* choose some colour ... that's disguting yes */
+	uint32_t hash_symbol = crc32_string(name, 0);
+	return (unsigned)crc32_string("red", hash_symbol) % 1024;
+}
+
+static unsigned get_colour_symbol_green(char *name)
+{
+	/* choose some colour ... that's disguting yes */
+	uint32_t hash_symbol = crc32_string(name, 0);
+	return (unsigned)crc32_string("green", hash_symbol) % 1024;
+}
+
+static unsigned get_colour_symbol_blue(char *name)
+{
+	/* choose some colour ... that's disguting yes */
+	uint32_t hash_symbol = crc32_string(name, 0);
+	return (unsigned)crc32_string("blue", hash_symbol) % 1024;
+}
+
 static void create_paje_state_if_not_found(char *name)
 {
 	symbol_name_itor_t itor;
@@ -230,11 +251,9 @@ static void create_paje_state_if_not_found(char *name)
 	symbol_name_list_push_front(symbol_list, entry);
 	
 	/* choose some colour ... that's disguting yes */
-	uint32_t hash_symbol = crc32_string(name, 0);
-
-	unsigned hash_symbol_red = (unsigned)crc32_string("red", hash_symbol) % 1024;
-	unsigned hash_symbol_green = (unsigned)crc32_string("green", hash_symbol) % 1024;
-	unsigned hash_symbol_blue = (unsigned)crc32_string("blue", hash_symbol) % 1024;
+	unsigned hash_symbol_red = get_colour_symbol_red(name);
+	unsigned hash_symbol_green = get_colour_symbol_green(name);
+	unsigned hash_symbol_blue = get_colour_symbol_blue(name);
 
 	fprintf(stderr, "name %s hash red %d green %d blue %d \n", name, hash_symbol_red, hash_symbol_green, hash_symbol_blue);
 
@@ -539,10 +558,26 @@ void handle_task_done(void)
 	uint64_t tag_id;
 	tag_id = ev.param[0];
 
+	unsigned long has_name = ev.param[2];
+	char *name = has_name?(char *)&ev.param[3]:"unknown";
+
         int worker;
         worker = find_workder_id(ev.param[1]);
 
-	dot_set_tag_done(tag_id, worker_colors[worker]);
+	char *colour;
+	char buffer[32];
+	if (per_task_colour) {
+		snprintf(buffer, 32, "%.4f,%.4f,%.4f",
+			get_colour_symbol_red(name)/1024.0,
+			get_colour_symbol_green(name)/1024.0,
+			get_colour_symbol_blue(name)/1024.0);
+		colour = &buffer[0];
+	}
+	else {
+		colour = worker_colors[worker];
+	}
+
+	dot_set_tag_done(tag_id, colour);
 }
 
 void generate_svg_output(void)