Title: [295698] trunk/Source/WTF/wtf/GenerateProfiles.h
Revision
295698
Author
[email protected]
Date
2022-06-21 16:21:07 -0700 (Tue, 21 Jun 2022)

Log Message

Allow build-and-collect-pgo-profiles to write files
https://bugs.webkit.org/show_bug.cgi?id=241692
<rdar://95311491>

Patch by Brianna Fan <[email protected]> on 2022-06-21
Reviewed by Dewei Zhu.

Ran into a missing profiles issue as required permissions to write were missing.
Fixed this issue by moving a code block in GenerateProfiles.h.

* Source/WTF/wtf/GenerateProfiles.h:
(WTF::registerProfileGenerationCallback):

Canonical link: https://commits.webkit.org/251703@main

Modified Paths

Diff

Modified: trunk/Source/WTF/wtf/GenerateProfiles.h (295697 => 295698)


--- trunk/Source/WTF/wtf/GenerateProfiles.h	2022-06-21 23:01:30 UTC (rev 295697)
+++ trunk/Source/WTF/wtf/GenerateProfiles.h	2022-06-21 23:21:07 UTC (rev 295698)
@@ -59,18 +59,19 @@
             "`.");
         WTFLogAlways("<WEBKIT_LLVM_PROFILE> To sanity-check the output: `for f in ./profiles/*; do echo $f; xcrun -sdk macosx.internal llvm-profdata show $f; done;`.");
 
-        {
-            // Maybe we could use %t instead here, but this folder is permitted through the sandbox because of ANGLE.
-            FileSystem::PlatformFileHandle fileHandle;
-            auto filePath = FileSystem::openTemporaryFile(makeString(name, "-", getpid()), fileHandle, ".profraw"_s);
-            profileFileBase.get() = String::fromUTF8(filePath.utf8().data());
-            FileSystem::closeFile(fileHandle);
-        }
-
         WTFLogAlways("<WEBKIT_LLVM_PROFILE><%s><%d>: We will dump the resulting profile to %s.", name, pid, profileFileBase->utf8().data());
 
         int token;
         notify_register_dispatch("com.apple.WebKit.profiledata", &token, dispatch_get_main_queue(), ^(int) {
+            
+            {
+                // Maybe we could use %t instead here, but this folder is permitted through the sandbox because of ANGLE.
+                FileSystem::PlatformFileHandle fileHandle;
+                auto filePath = FileSystem::openTemporaryFile(makeString(name, "-", getpid()), fileHandle, ".profraw"_s);
+                profileFileBase.get() = String::fromUTF8(filePath.utf8().data());
+                FileSystem::closeFile(fileHandle);
+            }
+            
             profileFileName.get() = makeString(profileFileBase.get(), ".", profileCount++, ".profraw");
             __llvm_profile_set_filename(profileFileName->utf8().data()); // Must stay alive while it is used by llvm.
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to