⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 295698 in webkit


Ignore:
Timestamp:
Jun 21, 2022, 4:21:07 PM (4 years ago)
Author:
commit-queue@webkit.org
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 <​briannaf@berkeley.edu> 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/wtf/GenerateProfiles.h

    r295133 r295698  
    6060        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;`.");
    6161
    62         {
    63             // Maybe we could use %t instead here, but this folder is permitted through the sandbox because of ANGLE.
    64             FileSystem::PlatformFileHandle fileHandle;
    65             auto filePath = FileSystem::openTemporaryFile(makeString(name, "-", getpid()), fileHandle, ".profraw"_s);
    66             profileFileBase.get() = String::fromUTF8(filePath.utf8().data());
    67             FileSystem::closeFile(fileHandle);
    68         }
    69 
    7062        WTFLogAlways("<WEBKIT_LLVM_PROFILE><%s><%d>: We will dump the resulting profile to %s.", name, pid, profileFileBase->utf8().data());
    7163
    7264        int token;
    7365        notify_register_dispatch("com.apple.WebKit.profiledata", &token, dispatch_get_main_queue(), ^(int) {
     66           
     67            {
     68                // Maybe we could use %t instead here, but this folder is permitted through the sandbox because of ANGLE.
     69                FileSystem::PlatformFileHandle fileHandle;
     70                auto filePath = FileSystem::openTemporaryFile(makeString(name, "-", getpid()), fileHandle, ".profraw"_s);
     71                profileFileBase.get() = String::fromUTF8(filePath.utf8().data());
     72                FileSystem::closeFile(fileHandle);
     73            }
     74           
    7475            profileFileName.get() = makeString(profileFileBase.get(), ".", profileCount++, ".profraw");
    7576            __llvm_profile_set_filename(profileFileName->utf8().data()); // Must stay alive while it is used by llvm.
Note: See TracChangeset for help on using the changeset viewer.