Преглед изворни кода

allow more than 10 contexts in paje traces

Andra Hugo пре 11 година
родитељ
комит
e87982b3c0
2 измењених фајлова са 77 додато и 24 уклоњено
  1. 73 20
      src/debug/traces/starpu_fxt.c
  2. 4 4
      src/debug/traces/starpu_paje.c

+ 73 - 20
src/debug/traces/starpu_fxt.c

@@ -516,28 +516,81 @@ static void create_paje_state_if_not_found(char *name, struct starpu_fxt_options
 	{
 #ifdef STARPU_HAVE_POTI
 		create_paje_state_color(name, "S", red, green, blue);
-		create_paje_state_color(name, "Ctx1", 255.0, 102.0, 255.0);
-		create_paje_state_color(name, "Ctx2", .0, 255.0, 0.0);
-		create_paje_state_color(name, "Ctx3", 255.0, 255.0, .0);
-		create_paje_state_color(name, "Ctx4", .0, 245.0, 255.0);
-		create_paje_state_color(name, "Ctx5", .0, .0, .0);
-		create_paje_state_color(name, "Ctx6", .0, .0, 128.0);
-		create_paje_state_color(name, "Ctx7", 105.0, 105.0, 105.0);
-		create_paje_state_color(name, "Ctx8", 255.0, .0, 255.0);
-		create_paje_state_color(name, "Ctx9", .0, .0, 1.0);
-		create_paje_state_color(name, "Ctx10", 154.0, 205.0, 50.0);
+		int i;
+		for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
+		{
+			char ctx[10];
+			snprintf(ctx, sizeof(ctx), "Ctx%d", i);
+			if(i%10 == 1)
+				create_paje_state_color(name, ctx, 255.0, 102.0, 255.0);
+			if(i%10 == 2)
+				create_paje_state_color(name, ctx, .0, 255.0, 0.0);
+			if(i%10 == 3)
+				create_paje_state_color(name, ctx, 255.0, 255.0, .0);
+			if(i%10 == 4)
+				create_paje_state_color(name, ctx, .0, 245.0, 255.0);
+			if(i%10 == 5)
+				create_paje_state_color(name, ctx, .0, .0, .0);
+			if(i%10 == 6)
+				create_paje_state_color(name, ctx, .0, .0, 128.0);
+			if(i%10 == 7)
+				create_paje_state_color(name, ctx, 105.0, 105.0, 105.0);
+			if(i%10 == 8)
+				create_paje_state_color(name, ctx, 255.0, .0, 255.0);
+			if(i%10 == 9)
+				create_paje_state_color(name, ctx, .0, .0, 1.0);
+			if(i%10 == 0)
+				create_paje_state_color(name, ctx, 154.0, 205.0, 50.0);
+
+		}
+/* 		create_paje_state_color(name, "Ctx1", 255.0, 102.0, 255.0); */
+/* 		create_paje_state_color(name, "Ctx2", .0, 255.0, 0.0); */
+/* 		create_paje_state_color(name, "Ctx3", 255.0, 255.0, .0); */
+/* 		create_paje_state_color(name, "Ctx4", .0, 245.0, 255.0); */
+/* 		create_paje_state_color(name, "Ctx5", .0, .0, .0); */
+/* 		create_paje_state_color(name, "Ctx6", .0, .0, 128.0); */
+/* 		create_paje_state_color(name, "Ctx7", 105.0, 105.0, 105.0); */
+/* 		create_paje_state_color(name, "Ctx8", 255.0, .0, 255.0); */
+/* 		create_paje_state_color(name, "Ctx9", .0, .0, 1.0); */
+/* 		create_paje_state_color(name, "Ctx10", 154.0, 205.0, 50.0); */
 #else
 		fprintf(out_paje_file, "6	%s	S	%s	\"%f %f %f\" \n", name, name, red, green, blue);
-		fprintf(out_paje_file, "6	%s	Ctx1	%s	\"255.0 102.0 255.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx2	%s	\".0 255.0 .0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx3	%s	\"225.0 225.0 .0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx4	%s	\".0 245.0 255.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx5	%s	\".0 .0 .0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx6	%s	\".0 .0 128.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx7	%s	\"105.0 105.0 105.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx8	%s	\"255.0 .0 255.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx9	%s	\".0 .0 1.0\" \n", name, name);
-		fprintf(out_paje_file, "6	%s	Ctx10	%s	\"154.0 205.0 50.0\" \n", name, name);
+		int i;
+		for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
+		{
+			if(i%10 == 1)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\"255.0 102.0 255.0\" \n", name, i, name);
+			if(i%10 == 2)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\".0 255.0 .0\" \n", name, i, name);
+			if(i%10 == 3)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\"225.0 225.0 .0\" \n", name, i, name);
+			if(i%10 == 4)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\".0 245.0 255.0\" \n", name, i, name);
+			if(i%10 == 5)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\".0 .0 .0\" \n", name, i, name);
+			if(i%10 == 6)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\".0 .0 128.0\" \n", name, i, name);
+			if(i%10 == 7)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\"105.0 105.0 105.0\" \n", name, i, name);
+			if(i%10 == 8)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\"255.0 .0 255.0\" \n", name, i, name);
+			if(i%10 == 9)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\".0 .0 1.0\" \n", name, i, name);
+			if(i%10 == 0)
+				fprintf(out_paje_file, "6	%s	Ctx%d	%s	\"154.0 205.0 50.0\" \n", name, i, name);
+
+		}
+
+/* 		fprintf(out_paje_file, "6	%s	Ctx1	%s	\"255.0 102.0 255.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx2	%s	\".0 255.0 .0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx3	%s	\"225.0 225.0 .0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx4	%s	\".0 245.0 255.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx5	%s	\".0 .0 .0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx6	%s	\".0 .0 128.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx7	%s	\"105.0 105.0 105.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx8	%s	\"255.0 .0 255.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx9	%s	\".0 .0 1.0\" \n", name, name); */
+/* 		fprintf(out_paje_file, "6	%s	Ctx10	%s	\"154.0 205.0 50.0\" \n", name, name); */
 #endif
 	}
 

+ 4 - 4
src/debug/traces/starpu_paje.c

@@ -179,9 +179,9 @@ void _starpu_fxt_write_paje_header(FILE *file)
 	poti_DefineEntityValue("SdC", "CtS", "SendCompleted", "1.0 .5 1.0");
 	poti_DefineEntityValue("RvC", "CtS", "RecieveCompleted", "0.5 1.0 1.0");
 
-	for (i=1; i<=10; i++)
+	for (i=1; i<STARPU_NMAX_SCHED_CTXS; i++)
 	{
-		char inctx[8];
+		char inctx[10];
 		snprintf(inctx, sizeof(inctx), "InCtx%u", i);
 		char *ctx = inctx+2;
 		poti_DefineStateType(ctx, "T", inctx);
@@ -220,7 +220,7 @@ void _starpu_fxt_write_paje_header(FILE *file)
 2       MPIev   MPICt    \"MPI event type\"			\n\
 3       S       T       \"Thread State\"                        \n\
 3       CtS     MPICt    \"Communication Thread State\"          \n");
-	for (i=1; i<=10; i++)
+	for (i=1; i<STARPU_NMAX_SCHED_CTXS; i++)
 		fprintf(file, "3       Ctx%u      T     \"InCtx%u\"         		\n", i, i);
 	fprintf(file, "\
 3       MS       Mm       \"Memory Node State\"                        \n\
@@ -245,7 +245,7 @@ void _starpu_fxt_write_paje_header(FILE *file)
 6       RvS       CtS      RecieveSubmitted  \"0.1 1.0 1.0\"	\n\
 6       SdC       CtS      SendCompleted     \"1.0 .5 1.0\"	\n\
 6       RvC       CtS      RecieveCompleted  \"0.5 1.0 1.0\"	\n");
-	for (i=1; i<=10; i++)
+	for (i=1; i<STARPU_NMAX_SCHED_CTXS; i++)
 		fprintf(file, "\
 6       I       Ctx%u      Initializing       \"0.0 .7 1.0\"            \n\
 6       D       Ctx%u      Deinitializing       \"0.0 .1 .7\"            \n\