summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingUtil.c
AgeCommit message (Collapse)Author
2017-12-21Include process.h for getpid on Windows in instr profilingReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321313 91177308-0d34-0410-b5e6-96231b3b80d8
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-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-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-17[PGO] remove unintended debug trace. NFCRong Xu
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295469 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
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-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-19[Profile] use portable macro /NFCXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18Code refactoring: extract path prefix handling codeXinliang David Li
.. into reusable interfaces. No functional change is expected. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275807 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23Use CreateFileA and add a FIXME to switch to the wide variantReid Kleckner
No functional change. Required to build with -DUNICODE, as is done in http://reviews.llvm.org/D21643 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17Fix most MSVC warnings in compiler-rt profiling libraryReid Kleckner
Here's the warnings and how they were fixed: - InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int Include io.h to get the prototype. - warning C4005: 'FILE_MAP_EXECUTE': macro redefinition Stop trying to support pre-XP versions of Windows, don't attempt to define this macro. - InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header' - InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes' Turn this warning off. This is definitely legal in C++, all compilers accept it, and I only have room for half of one language standard in my brain. - InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)' Fix this with an explicit (void) in the prototype. - InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored Last remaining warning. This is from linking a selectany definition with a strong definition. We need to sort out weak symbols in compiler-rt in general, though. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273026 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] Pass extra build flags (feature enabling macros) to Darwin buildXinliang David Li
Differential Revision: http://reviews.llvm.org/D21119 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272162 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-06-06[profile] code cleanup /NFCXinliang David Li
Address review feedback for better readability. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06[profile] in-process mergeing support (part-2)Xinliang David Li
(Part-1 merging API is in profile runtime) This patch implements a portable file opening API with exclusive access for the process. In-process profile merge requires profile file update to be atomic/fully sychronized. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16[profile] Add portability macro for atomic fetch_and_addXinliang David Li
This is another enabler patch to support value profiling without dynamic memory allocation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269719 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28[libprofile] Handle '\\' in __llvm_profile_recursive_mkdirSean Silva
This is implicitly needed at least by gcc-flag-compatibility.test The thing that needs it is the `\` preceding the "default.profraw" appended internally by clang when doing `-fprofile-use=`. Clang uses `\` because is uses sys::path::append which will use `\` on a Windows host. This is wrong, but I don't think there's an easy way to solve it (maybe just always using `/` since places that accept `\` also tend to accept `/`, but not the other way around). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264665 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-06cleanup: remove dead preprocessing branch /nfcXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-06[PGO] cleanup: move one support method into InstrProfilingUtil.h /NFCXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262791 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-06[PGO] internal API name cleanups (for better consistency)Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262788 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-06Minor cleanupXinliang David Li
move a function def to InstrProfilingUtil.c git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262785 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[PGO] cleanup: unify prefix for portability macrosXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255748 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Compiler-rt cleanup -- introduces macros for various macrosXinliang David Li
This makes code more readable and be made more portable in the future. There is no functional change. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09Add support for generating profiles in a given directory.Diego Novillo
When the file is initialized, this patch checks whether the path specifies a directory. If so, it creates the directory tree before truncating the file. Use default.profdata instead of pgo-data for default indexed profile name. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@241824 91177308-0d34-0410-b5e6-96231b3b80d8