Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
4ac9f355f0
1 zmenil súbory, kde vykonal 13 pridanie a 3 odobranie
  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);
+
+
 }