mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
c509534d2e
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
62 lines
2.3 KiB
Plaintext
62 lines
2.3 KiB
Plaintext
RUN: printf '\201rforpl\377' > %t-foo.profraw
|
|
RUN: printf '\5\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
|
|
RUN: printf '\254\275\030\333\114\302\370\134' >> %t-foo.profraw
|
|
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
|
|
RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw
|
|
RUN: printf '\3\0foo\0\0\0' >> %t-foo.profraw
|
|
|
|
RUN: printf '\201rforpl\377' > %t-bar.profraw
|
|
RUN: printf '\5\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
|
|
RUN: printf '\067\265\035\031\112\165\023\344' >> %t-bar.profraw
|
|
RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
|
|
RUN: printf '\067\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw
|
|
RUN: printf '\3\0bar\0\0\0' >> %t-bar.profraw
|
|
|
|
RUN: cat %t-foo.profraw %t-bar.profraw > %t-pad.profraw
|
|
RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s
|
|
|
|
CHECK: Counters:
|
|
CHECK: foo:
|
|
CHECK: Hash: 0x0000000000000001
|
|
CHECK: Counters: 1
|
|
CHECK: Function count: 19
|
|
CHECK: Block counts: []
|
|
CHECK: bar:
|
|
CHECK: Hash: 0x0000000000000002
|
|
CHECK: Counters: 2
|
|
CHECK: Function count: 55
|
|
CHECK: Block counts: [65]
|
|
CHECK: Functions shown: 2
|
|
CHECK: Total functions: 2
|
|
CHECK: Maximum function count: 55
|
|
CHECK: Maximum internal block count: 65
|