Browse Source

Add possibility to select ploted codelets in starpu_fxt_data_trace

Joris Pablo 11 years ago
parent
commit
aef3279a06
2 changed files with 36 additions and 10 deletions
  1. 4 2
      doc/doxygen/chapters/performance_feedback.doxy
  2. 32 8
      tools/starpu_fxt_data_trace.c

+ 4 - 2
doc/doxygen/chapters/performance_feedback.doxy

@@ -585,9 +585,11 @@ Synthetic GFlops : 44.21
 \section DataTrace Data trace and tasks length
 It is possible to get statistics about tasks length and data size by using :
 \verbatim
-$starpu_fxt_data_trace filename
+$starpu_fxt_data_trace filename [codelet1 codelet2 ... codeletn]
 \endverbatim
-Where filename is the FxT trace file. This will create a file, <c>data_trace.gp</c> which
+Where filename is the FxT trace file and codeletX the names of the codelets you 
+want to profile (if no names are specified, starpu_fxt_data_trace will use them all). 
+This will create a file, <c>data_trace.gp</c> which
 can be plotted to get a .eps image of these results. On the image, each point represents a 
 task, and each color corresponds to a codelet.
 

+ 32 - 8
tools/starpu_fxt_data_trace.c

@@ -8,11 +8,11 @@
 
 static void usage(char *progname)
 {
-	fprintf(stderr, "Usage : %s <filename>\n", progname);
+	fprintf(stderr, "Usage : %s <filename> [codelet...]\n", progname);
 	exit(77);
 }
 
-static void write_plt(){
+static void write_plt(int argc, char **argv){
 	FILE *codelet_list = fopen("codelet_list", "r");
 	if(!codelet_list)
 	{
@@ -35,17 +35,41 @@ static void write_plt(){
 	fprintf(plt, "set xlabel \"tasks size (ms)\"\n");
 	fprintf(plt, "set ylabel \"data size (B)\"\n");
 	fprintf(plt, "plot ");
+	int c_iter;
+	char *v_iter;
 	int begin = 1;
 	while(fgets(codelet_name, MAX_LINE_SIZE, codelet_list) != NULL)
 	{
-		if(begin)
-			begin = 0;
-		else
+		if(argc == 0)
+		{
+			if(begin)
+				begin = 0;
+			else
 			fprintf(plt, ", ");
+		}
 		int size = strlen(codelet_name);
 		if(size > 0)
 			codelet_name[size-1] = '\0';
-		fprintf(plt, "\"%s\" using 1:2 with dots lw 1 title \"%s\"", codelet_name, codelet_name);
+		if(argc != 0)
+		{
+			for(c_iter = 0, v_iter = argv[c_iter];
+			    c_iter < argc;
+			    c_iter++, v_iter = argv[c_iter])
+			{
+				if(!strcmp(v_iter, codelet_name))
+				{
+					if(begin)
+						begin = 0;
+					else
+						fprintf(plt, ", ");
+					fprintf(plt, "\"%s\" using 1:2 with dots lw 1 title \"%s\"", codelet_name, codelet_name);
+				}
+			}
+		}
+		else
+		{
+			fprintf(plt, "\"%s\" using 1:2 with dots lw 1 title \"%s\"", codelet_name, codelet_name);
+		}
 	}
 	fprintf(plt, "\n");
 
@@ -64,11 +88,11 @@ static void write_plt(){
 
 int main(int argc, char **argv)
 {
-	if(argc != 2)
+	if(argc < 2)
 	{
 		usage(argv[0]);
 	}
 	starpu_fxt_write_data_trace(argv[1]);
-	write_plt();
+	write_plt(argc - 2, argv + 2);
 	return 0;
 }