summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingFile.c
AgeCommit message (Collapse)Author
2017-12-14[profile] Port the runtime to Solaris (retry)Vedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar
runtime to Solaris" This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[profile] Port the runtime to SolarisVedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320726 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31Revert r312240Alex Lorenz
The buildbots have shown that -Wstrict-prototypes behaves differently in GCC and Clang so we should keep it disabled until Clang follows GCC's behaviour git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31Build LLVM with -Wstrict-prototypes enabledAlex Lorenz
Clang 5 supports -Wstrict-prototypes. We should use it to catch any C declarations that declare a non-prototype function. rdar://33705313 Differential Revision: https://reviews.llvm.org/D36669 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23[Profile] create a copy of profile file name from environmentXinliang David Li
Original patch by Max Moroz. Differential Revsion: http://reviews.llvm.org/D36903 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15Revert r310857 due to internal test failureXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14[PGO] Add support for relocate profile dumping directoryXinliang David Li
Differential Revsion: http://reviews.llvm.org/D36648 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28[PGO] Reduce IO in profile dumping with mergingXinliang David Li
Differential Revision: http://reviews.llvm.org/D34709 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306561 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[Profile] Remove redundant callXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[PGO] Refactor file/buffer writer callback interfaces /NFCXinliang David Li
Introduces a 'owner' struct to include the overridable write method and the write context in C. This allows easy introdution of new member API to help reduce profile merge time in the follow up patch. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-writeRong Xu
And also r295364 [PGO] remove unintended debug trace. NFC I removed the test case: it's hard to write synchronized test b/w processes in this framework. I will revisit the test-case later. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298113 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20Revert "[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write"Renato Golin
Revert "[PGO] remove unintended debug trace. NFC" This reverts commit r295469, r295364, as they are unstable on ARM/AArch64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-writeRong Xu
Summary: We found a nondeterministic behavior when doing online profile merging for multi-process applications. The application forks a sub-process and sub-process sets to get SIGKILL when the parent process exits, The first process gets the lock, and dumps the profile. The second one will mmap the file, do the merge and write out the file. Note that before the merged write, we truncate the profile. Depending on the timing, the child process might be terminated abnormally when the parent exits first. If this happens: (1) before the truncation, we will get the profile for the main process (2) after the truncation, and before write-out the profile, we will get 0 size profile. (3) after the merged write, we get merged profile. This patch temporarily suspend the SIGKILL for PR_SET_PDEATHSIG before profile-write and restore it after the write. This patch only applies to Linux system. Reviewers: davidxl Reviewed By: davidxl Subscribers: xur, llvm-commits Differential Revision: https://reviews.llvm.org/D29954 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295364 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14[PGO] Delay profile dir creation until writeXinliang David Li
Differential Revision: http://reviews.llvm.org/D29960 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29[profile] use GetComputerNameExW instead of gethostname on WindowsBob Haarman
Summary: In profile data paths, we replace "%h" with the hostname of the machine the program is running on. On Windows, we used gethostname() to obtain the hostname. This requires linking with ws2_32. With this change, we instead get the hostname from GetComputerNameExW(), which does not require ws2_32. Reviewers: rnk, vsk, amccarth Subscribers: zturner, ruiu, hans Differential Revision: https://reviews.llvm.org/D27178 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288146 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18[profile] Mark lprofCurFilename as COMPILER_RT_WEAKVedant Kumar
This makes __llvm_profile_set_filename() work across dylib boundaries on Darwin. This functionality was originally meant to work on all platforms, but was moved to a Linux-only directory with r272404. The root cause of the test failure on Darwin was that lprofCurFilename was not marked weak. Each dylib maintained its own copy of the variable due to the two-level namespace. Tested with check-profile (on Darwin). I don't expect this to regress other platforms. Differential Revision: https://reviews.llvm.org/D25707 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@284440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23Revert "[profile] Hide lprofCurFilename"Vedant Kumar
This reverts commit r282294. It breaks a Linux bot: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12180 It looks like the test checks that __llvm_profile_set_filename() alters the raw profile filename in both the dylib and the main program. Now that lprofCurFilename is hidden, this can't work, and we get two profiles (one for the call to "main" and one for "func"). Back this change out so that we don't affect external users. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23[profile] Hide lprofCurFilenameVedant Kumar
Differential Revision: https://reviews.llvm.org/D24885 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282294 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22[Profile] suppress verbose rt message by defaultXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08Correctly escape %.Nico Weber
Found be an MSVC warning; I filed PR30320 for adding a similar warning to clang. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280900 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10test commit.Ying Yi
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09[Profile] Implement new API __llvm_profile_dumpXinliang David Li
The API is intended to be used by user to do fine grained (per-region) control of profile dumping. Differential Revision: http://reviews.llvm.org/D23106 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02[Profile] track ownership of filename pattern stringXinliang David Li
Make sure runtime copy and owns the string when passed in from external users of runtime API. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[Profile] deprecate __llvm_profile_override_default_filename (part2)Xinliang David Li
This eliminates unncessary calls and init functions. Differential Revision: http://reviews.llvm.org/D22614 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276355 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[Profile] bug fix: profile dir not recursively createdXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276234 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20Minor cleanup -- clear name structure before parsingXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20[Profile] implement interface to get profile path prefixXinliang David Li
Differential Revision: http://reviews.llvm.org/D22546 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19[Profile] introduce reusable internal interfaces to find dir separator \NFCXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15Fix a typeo.George Burgess IV
(obligatory s/typeo/typo) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15[Profile] instroduce portability macro for dir separator(sXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14[profile] Update a warning message (NFC)Vedant Kumar
It's possible for a merge pool specifier to appear anywhere in a filename pattern. Update the warning to reflect this. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272685 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-10[profile] cleanup file setting codeXinliang David Li
Differential Revision: http://reviews.llvm.org/D21219 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] in-process merging support part-3Xinliang David Li
Differential Revision: http://reviews.llvm.org/D21056 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] Un-hide two symbolsVedant Kumar
- lprofCurFilename was intended to have external visibility. This is pending further discussion. - The raw version number doesn't need to be hidden: hiding it may make it easier to accidentally combine FE/IR profiles. See the mailing list discussion on r272081. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] Hide a few external symbols (NFCI)Vedant Kumar
There are still a few external symbols visible from InstrProfData.inc. The plan for dealing with those isn't as straightforward, so I'll try it in a separate commit. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25[profile] Further cleanup/refactor file handling codeXinliang David Li
Also get rid of the redundant strncpy calls. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270730 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25Fix braced initializer list (NFC)Teresa Johnson
After r270617 I am getting an error when building: projects/compiler-rt/lib/profile/InstrProfilingFile.c:33:36: error: missing field 'PidChars' initializer [-Werror,-Wmissing-field-initializers] lprofFilename lprofCurFilename = {0}; ^ Fix the aggregate initializer. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24[profile] clean up profile file handling codeXinliang David Li
Differentianl Revision: http://reviews.llvm.org/D20572 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270617 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24Fix typo in commentXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24[profile] clean up file initialization codeXinliang David Li
Also added more documentation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20Fix bot failureXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20[profile] PROF_ERR, PROF_WARNXinliang David Li
1) Move common prefix to the macro def 2) Introduced PROF_WARN 3) Make error message unconditionally printed out. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20[profile] Remove anther malloc useXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18[profile] Allow max vals per site to be controllable at runtimeXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14[profile] Eliminate dynamic memory allocation for vp writingXinliang David Li
This is part-3 of the effort to eliminate dependency on libc allocator in instr profiler runtime. With this change, the profile dumper is completely free of malloc/calloc. Value profile instr API implementation is the only remaining piece with calloc dependency. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13[profile] Eliminate dynamic memory allocation for buffered writerXinliang David Li
With this change, dynamic memory allocation is only used for testing purpose. This change is one of the many steps to make instrument profiler dynamic allocation free. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10Reapply r268840: [profile] Simplify value profile writingXinliang David Li
Revert r268864 that reverted 268840 after underlying problem is fixed for arm bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07Revert "[profile] Simplify value profile writing"Renato Golin
This reverts commit r268840, as it breaks Thumb2 self-hosting. There is something unstable in the profiling for Thumb2 that needs to be sorted out before we continue implementing these changes to the profiler. See PR27667. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07[profile] Simplify value profile writingXinliang David Li
With this patch, value data are longer pre-collected before writing. The code is simplified and requires less heap space for dumping. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268840 91177308-0d34-0410-b5e6-96231b3b80d8