Quellcode durchsuchen

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 vor 15 Jahren
Ursprung
Commit
4ac9f355f0
1 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen
  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);
+
+
 }