[compiler-rt] ab694cd - [Profile] Add a warning when lock file failed in __llvm_profile_set_file_object with continuous mode

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 14:38:29 PDT 2021


Author: Zequan Wu
Date: 2021-10-01T14:37:09-07:00
New Revision: ab694cd8453e10158fa61c0a0028a6bd3f474436

URL: https://github.com/llvm/llvm-project/commit/ab694cd8453e10158fa61c0a0028a6bd3f474436
DIFF: https://github.com/llvm/llvm-project/commit/ab694cd8453e10158fa61c0a0028a6bd3f474436.diff

LOG: [Profile] Add a warning when lock file failed in __llvm_profile_set_file_object with continuous mode

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingFile.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 2070f93e39d67..e830d366cb5f6 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -1153,7 +1153,10 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File,
                 fileno(File));
       return 1;
     }
-    lprofLockFileHandle(File);
+    if (lprofLockFileHandle(File) != 0) {
+      PROF_WARN("Data may be corrupted during profile merging : %s\n",
+                "Fail to obtain file lock due to system limit.");
+    }
     uint64_t ProfileFileSize = 0;
     if (getProfileFileSizeForMerging(File, &ProfileFileSize) == -1) {
       lprofUnlockFileHandle(File);


        


More information about the llvm-commits mailing list