瀏覽代碼

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 年之前
父節點
當前提交
4ac9f355f0
共有 1 個文件被更改,包括 13 次插入3 次删除
  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);
+
+
 }