llvm-project/llvm/lib/ProfileData
Vedant Kumar d889d1efef [profile] Add a mode to continuously sync counter updates to a file
Add support for continuously syncing profile counter updates to a file.

The motivation for this is that programs do not always exit cleanly. On
iOS, for example, programs are usually killed via a signal from the OS.
Running atexit() handlers after catching a signal is unreliable, so some
method for progressively writing out profile data is necessary.

The approach taken here is to mmap() the `__llvm_prf_cnts` section onto
a raw profile. To do this, the linker must page-align the counter and
data sections, and the runtime must ensure that counters are mapped to a
page-aligned offset within a raw profile.

Continuous mode is (for the moment) incompatible with the online merging
mode. This limitation is lifted in https://reviews.llvm.org/D69586.

Continuous mode is also (for the moment) incompatible with value
profiling, as I'm not sure whether there is interest in this and the
implementation may be tricky.

As I have not been able to test extensively on non-Darwin platforms,
only Darwin support is included for the moment. However, continuous mode
may "just work" without modification on Linux and some UNIX-likes. AIUI
the default value for the GNU linker's `--section-alignment` flag is set
to the page size on many systems. This appears to be true for LLD as
well, as its `no_nmagic` option is on by default. Continuous mode will
not "just work" on Fuchsia or Windows, as it's not possible to mmap() a
section on these platforms. There is a proposal to add a layer of
indirection to the profile instrumentation to support these platforms.

rdar://54210980

Differential Revision: https://reviews.llvm.org/D68351
2019-10-31 16:04:09 -07:00
..
Coverage [Alignment][NFC] Move and type functions from MathExtras to Alignment 2019-10-14 13:14:34 +00:00
CMakeLists.txt Revert "test commit" 2019-08-11 05:59:20 +00:00
GCOV.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
InstrProf.cpp [PGO] Fix typos from r359612. NFC. 2019-10-01 18:06:50 +00:00
InstrProfReader.cpp [profile] Add a mode to continuously sync counter updates to a file 2019-10-31 16:04:09 -07:00
InstrProfWriter.cpp [PGO] Fix typos from r359612. NFC. 2019-10-01 18:06:50 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProfileSummaryBuilder.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
SampleProf.cpp [llvm-profdata] Minor format fix 2019-10-07 16:30:31 +00:00
SampleProfReader.cpp [SampleFDO] Add profile remapping support for profile on-demand loading used 2019-10-18 22:35:20 +00:00
SampleProfWriter.cpp [SampleFDO] Add indexing for function profiles so they can be loaded on demand 2019-10-09 21:36:03 +00:00