summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingUtil.h
Commit message (Collapse)AuthorAgeFilesLines
* Add a shim for setenv on PS4 since it does not exist.Douglas Yung2019-11-121-1/+3
| | | | | | | | A few years back a similar change was made for getenv since neither function is supported on the PS4 platform. Recently, commit d889d1e added a call to setenv in compiler-rt which was causing linking errors because the symbol was not found. This fixes that issue by putting in a shim similar to how we previously dealt with the lack of getenv. Differential Revision: https://reviews.llvm.org/D70033
* (Reland with changes) Adding a function for setting coverage output file.Sajjad Mirza2019-06-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: User code can open a file on its own and pass it to the runtime, rather than specifying a name and having the runtime open the file. This supports the use case where a process cannot open a file on its own but can receive a file descriptor from another process. Relanding https://reviews.llvm.org/D62541. The original revision unlocked the file before calling flush, this revision fixes that. Reviewers: Dor1s, davidxl Reviewed By: Dor1s Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D63581 llvm-svn: 364231
* Revert r362676 "[Profile]: Add runtime interface to specify file handle for ↵Hans Wennborg2019-06-121-2/+0
| | | | | | | | | | | | | | | profile data." This caused instrumented Clang to become crashy. See llvm-commits thread for repro steps. This also reverts follow-up r362716 which added test cases. > Author: Sajjad Mirza > > Differential Revision: http://reviews.llvm.org/D62541 llvm-svn: 363134
* [Profile]: Add runtime interface to specify file handle for profile data.Xinliang David Li2019-06-061-0/+2
| | | | | | | | Author: Sajjad Mirza Differential Revision: http://reviews.llvm.org/D62541 llvm-svn: 362676
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [compiler-rt] Add a routine to specify the mode used when creating profile dirs.Matt Davis2018-07-311-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to the compiler-rt profile API. Originally, profile data was placed into a directory that was created with a hard-coded mode value of 0755 (for non-win32 builds). In certain cases, it can be helpful to create directories with a different mode other than 0755. This patch introduces set/get routines to allow users to specify a desired mode. The default remains at 0755. Reviewers: void, probinson Reviewed By: probinson Subscribers: probinson, dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D49953 llvm-svn: 338456
* [profile] Port the runtime to Solaris (retry)Vedant Kumar2017-12-141-0/+3
| | | | | | | | | | | | | 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 llvm-svn: 320731
* Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar2017-12-141-3/+0
| | | | | | | | | | | 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 llvm-svn: 320728
* [profile] Port the runtime to SolarisVedant Kumar2017-12-141-0/+3
| | | | | | | | | | | 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 llvm-svn: 320726
* Revert r312240Alex Lorenz2017-08-311-2/+2
| | | | | | | 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 llvm-svn: 312246
* Build LLVM with -Wstrict-prototypes enabledAlex Lorenz2017-08-311-2/+2
| | | | | | | | | | | 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 llvm-svn: 312240
* Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-writeRong Xu2017-03-171-0/+8
| | | | | | | | 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. llvm-svn: 298113
* Revert "[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write"Renato Golin2017-02-201-8/+0
| | | | | | | | Revert "[PGO] remove unintended debug trace. NFC" This reverts commit r295469, r295364, as they are unstable on ARM/AArch64. llvm-svn: 295664
* [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-writeRong Xu2017-02-161-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 295364
* [Profile] introduce reusable internal interfaces to find dir separator \NFCXinliang David Li2016-07-191-0/+7
| | | | llvm-svn: 276027
* [Profile] move utility interfaces to the right header /NFCXinliang David Li2016-07-191-0/+14
| | | | llvm-svn: 276021
* [profile] in-process mergeing support (part-2)Xinliang David Li2016-06-061-0/+5
| | | | | | | | | | | (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. llvm-svn: 271864
* [profile] Add portability macro for atomic fetch_and_addXinliang David Li2016-05-161-1/+2
| | | | | | | This is another enabler patch to support value profiling without dynamic memory allocation. llvm-svn: 269719
* [PS4] Change the names of some "environmental" things to what ourPaul Robinson2016-05-161-2/+2
| | | | | | | | licensees actually see in the toolchain we deliver to them. This will reduce the set of local patches we have to maintain. The triple is not changing. (The term ORBIS is an internal code name for PS4.) llvm-svn: 269672
* [Fix r262785] Fix missing declaration when COMPILER_RT_BOOL_CMPXCHG was used ↵Filipe Cabecinhas2016-03-071-1/+1
| | | | | | | | but InstrProfilingUtil.h wasn't included. Also fixed declaration which still had the pre-r262788 name. llvm-svn: 262827
* [PGO] cleanup: move one support method into InstrProfilingUtil.h /NFCXinliang David Li2016-03-061-0/+2
| | | | llvm-svn: 262791
* Minor cleanupXinliang David Li2016-03-061-0/+2
| | | | | | move a function def to InstrProfilingUtil.c llvm-svn: 262785
* Add some minimal portability code paths for PS4.Sean Silva2016-03-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Hi David, SCE folks, What is implemented in this patch is enough for the upstream libprofile to work for PGO with the PS4 game codebase I tested ("game7" for you SCE folks; this is with a standalone build of compiler-rt). The first change, which is simple, is to stub out gethostname. PS4 doesn't have a simple analog for this that doesn't bring in extra OS libraries, so for now we do not support `%h` expansion. This is consistent with internal B#136272. The second change implies future work, but is a simple change at present. PS4 does not have `getenv`, so for now we will introduce a shim. This obviously makes it impossible for many of the tests to be run since they require setting `LLVM_PROFILE_FILE=`. I see two paths forward: 1. In the tests we are already wrapping execution with `%run` and so by setting a PS4-specific expansion for `%run` we can pass the information in another way We can adapt the getenv shim as appropriate. We will need to experiment with this internally. Maggie, Phillip, Filipe? Any ideas? Maybe ping me internally since we may need to get into some PS4 vagaries. I'm thinking a fake getenv library that uses some side channel for communication. 2. Another possibility which is more verbose is to use a separate clang invocation with `-profile-generate=<filename>` to set the filename in each test. This might require redundant clang invocations though which may be undesirable for upstream. David, thoughts? Also, this is a fairly libprofile-specific workaround, so it e.g. doesn't help Filipe's ASan work. Overall, this approach sounds like a bit of a hack to me. Small detail: InstrProfilingPort.h seems like the natural place for the getenv shim, but GCDAProfiling.c needs it as well. InstrProfilingUtil.h is currently the only header common between InstrProfilingFile.c and GCDAProfiling.c. I can move the shim to InstrProfilingPort.h and add an include to GCDAProfiling.c as per your preference David. Reviewers: davidxl, MaggieYi, phillip.power, filcab Subscribers: simon.f.whittaker, slingn, probinson, llvm-commits Differential Revision: http://reviews.llvm.org/D17676 llvm-svn: 262527
* Add support for generating profiles in a given directory.Diego Novillo2015-07-091-0/+16
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. llvm-svn: 241824
OpenPOWER on IntegriCloud