[PATCH] D155290: [PGO] Use Unique Profile Files when New Processes are Forked
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 12 08:32:49 PDT 2023
MaskRay added inline comments.
================
Comment at: compiler-rt/lib/profile/InstrProfilingFile.c:94
static lprofFilename lprofCurFilename = {0, 0, 0, {0}, NULL,
{0}, 0, 0, 0, PNS_unknown};
static int ProfileMergeRequested = 0;
----------------
Revert unneeded change.
================
Comment at: compiler-rt/lib/profile/InstrProfilingFile.c:253
+// because the implementation relies on pthread.
+static int ResetNameAtFork = 0;
+
----------------
include stdbool.h and use bool
================
Comment at: compiler-rt/lib/profile/InstrProfilingFile.c:1027
return;
+
parseAndSetFilename(FilenamePat, PNS_runtime_api, 1);
----------------
unneeded change
================
Comment at: compiler-rt/test/profile/Posix/instrprof-fork.c:4
+// RUN: rm -rf %t.d
+// RUN: mkdir -p %t.d && cd %t.d
+// RUN: %clang_pgogen %s -o %t.exe
----------------
I usually use `RUN: rm -rf %t && mkdir %t && cd %t` and then use something like `-o t` to place the executable under `%t` as well.
================
Comment at: compiler-rt/test/profile/Posix/instrprof-fork.c:22
+ pid = fork();
+ if (!pid) {
+ printf("%ld.profraw\n", (long)getpid());
----------------
parent and child have the same logic. Use:
```
if (pid == -1)
return 1;
printf("%ld.profraw\n", (long)getpid());
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155290/new/
https://reviews.llvm.org/D155290
More information about the cfe-commits
mailing list