[PATCH] D62078: This change adds an API to allow setting the flag to indicate that the profile data has been dumped to the file.

Yuke Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 13:26:12 PDT 2019


liaoyuke created this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

The main use is for users to disable dumping profile data to the file
for certain processes in case the processes don't have permission to
write to the disks, and trying to do so would result in side effects
such as crashes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62078

Files:
  compiler-rt/lib/profile/InstrProfiling.c
  compiler-rt/lib/profile/InstrProfiling.h


Index: compiler-rt/lib/profile/InstrProfiling.h
===================================================================
--- compiler-rt/lib/profile/InstrProfiling.h
+++ compiler-rt/lib/profile/InstrProfiling.h
@@ -125,7 +125,7 @@
 /*!
  * \brief this is a wrapper interface to \c __llvm_profile_write_file.
  * After this interface is invoked, a arleady dumped flag will be set
- * so that profile won't be dumped again during program exit. 
+ * so that profile won't be dumped again during program exit.
  * Invocation of interface __llvm_profile_reset_counters will clear
  * the flag. This interface is designed to be used to collect profile
  * data from user selected hot regions. The use model is
@@ -191,6 +191,14 @@
 uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin,
                                       const __llvm_profile_data *End);
 
+/*!
+ * \brief Set the flag that profile data has been dumped to the file.
+ * This is useful for users to disable dumping profile data to the file for
+ * certain processes in case the processes don't have permission to write to
+ * the disks, and trying to do so would result in side effects such as crashes.
+ */
+void __llvm_profile_set_dumped();
+
 /*!
  * This variable is defined in InstrProfilingRuntime.cc as a hidden
  * symbol. Its main purpose is to enable profile runtime user to
Index: compiler-rt/lib/profile/InstrProfiling.c
===================================================================
--- compiler-rt/lib/profile/InstrProfiling.c
+++ compiler-rt/lib/profile/InstrProfiling.c
@@ -35,6 +35,10 @@
   ProfileDumped = 1;
 }
 
+COMPILER_RT_VISIBILITY void __llvm_profile_set_dumped() {
+  ProfileDumped = 1;
+}
+
 /* Return the number of bytes needed to add to SizeInBytes to make it
  *   the result a multiple of 8.
  */


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62078.200087.patch
Type: text/x-patch
Size: 1809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/edf87355/attachment.bin>


More information about the llvm-commits mailing list