Pārlūkot izejas kodu

In case we have multiple processes using StarPU (eg. with MPI), we need to
generate multiple traces at the same time, so we suffix the trace file's name
with the pid of the process.

Cédric Augonnet 15 gadi atpakaļ
vecāks
revīzija
4ac9f355f0
1 mainītis faili ar 13 papildinājumiem un 3 dzēšanām
  1. 13 3
      src/common/fxt.c

+ 13 - 3
src/common/fxt.c

@@ -38,9 +38,19 @@ static void profile_set_tracefile(char *fmt, ...)
 	va_start(vl, fmt);
 	vsprintf(PROF_FILE_USER, fmt, vl);
 	va_end(vl);
-	strcat(PROF_FILE_USER, "_user_");
-	if ((user = getenv("USER")))
-		strcat(PROF_FILE_USER, user);
+
+	user = getenv("USER");
+	if (!user)
+		user = "";
+
+	int pid = getpid();
+
+	char suffix[128];
+	snprintf(suffix, 128, "_user_%s_%d", user, pid);
+
+	strcat(PROF_FILE_USER, suffix);
+
+
 }