summaryrefslogtreecommitdiff
path: root/lib/profile
AgeCommit message (Collapse)Author
2018-01-03Hide some symbols to avoid a crash on shutdown when using code coverageMarco Castelluccio
Summary: gcov / gcda-based profiling crashes when shared libraries are unloaded Patch by Benoit Belley and test by Marco Castelluccio for Firefox See https://bugs.llvm.org/show_bug.cgi?id=27224 & https://bugzilla.mozilla.org/show_bug.cgi?id=1401230 Reviewers: davidxl, rnk, void Subscribers: jessicah, marco-c, belleyb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38124 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321703 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03Flush gcda files before unlocking themMarco Castelluccio
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=35464. Reviewers: zturner, rnk, void Subscribers: sylvestre.ledru, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D40610 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321702 91177308-0d34-0410-b5e6-96231b3b80d8
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-11-14[profile] Update InstrProfData.inc to sync with llvmVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318230 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Implement flock for Windows in compiler-rtMarco Castelluccio
Summary: This patch implements flock for Windows, needed to make gcda writing work in a multiprocessing scenario. Fixes https://bugs.llvm.org/show_bug.cgi?id=34923. Reviewers: zturner Reviewed By: zturner Subscribers: rnk, zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D38891 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-18Use O_BINARY when opening GCDA file on WindowsMarco Castelluccio
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=34922. Apparently, the mode in **fdopen** gets simply ignored and Windows only cares about the mode of the original **open**. I have verified this both with the simple case from bug 34922 and with a full Firefox build. Reviewers: zturner Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38984 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[profile] Update InstrProfData.incVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313599 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-22[profile] Fix warning about C++ style comment in C fileHans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311496 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-07-28Change INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE from 8 to 16.Dehao Chen
Summary: In the current implementation, the defaul number of values per site tracked by value profiler is 8, which is too small and could introduce inaccuracies to profile. Changing it to 16 will be able to gain more accurate value profiler. Reviewers: davidxl, tejohnson Reviewed By: tejohnson Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D35964 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29[profile] Move __llvm_profile_filename into a separate objectVedant Kumar
Users can specify the path a raw profile is written to by passing -fprofile-instr-generate=<path>, but this functionality broke on Darwin after __llvm_profile_filename was made weak [1], resulting in profiles being written to "default.profraw" even when <path> is specified. The situation is that instrumented programs provide a weak definition of __llvm_profile_filename, which conflicts with a weak redefinition provided by the profiling runtime. The linker appears to pick the 'winning' definition arbitrarily: on Darwin, it usually prefers the larger definition, which is probably why the instrprof-override-filename.c test has been passing. The fix is to move the runtime's definition into a separate object file within the archive. This means that the linker won't "see" the runtime's definition unless the user program has not provided one. I couldn't think of a great way to test this other than to mimic the Darwin failure: use -fprofile-instr-generate=<some-small-path>. Testing: check-{clang,profile}, modified instrprof-override-filename.c. [1] [Profile] deprecate __llvm_profile_override_default_filename https://reviews.llvm.org/D22613 https://reviews.llvm.org/D22614 Differential Revision: https://reviews.llvm.org/D34797 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306710 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-04-15[profile] Sync up InstrProfData.inc (NFC)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300383 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13[Profile] PE binary coverage bug fixXinliang David Li
PR/32584 Differential Revision: https://reviews.llvm.org/D32023 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11Revert 299954 : test failure needs to be fixedXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299960 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11[Profile] PE binary coverage bug fixXinliang David Li
PR/32584 Differential Revision: https://reviews.llvm.org/D31939 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299954 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-03-15[PGO] Value profile support for value rangesRong Xu
This patch adds profile run time support to profile a range of values. This interface will be used in profiling the size of memory intrinsic calls. Differential Revision: http://reviews.llvm.org/D28964 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297895 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
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] Fix value profiler eviction bugXinliang David Li
Differential Revision: https://reviews.llvm.org/D27224 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288204 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] Remove unused variableXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282198 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-30profile: add missing include for WindowsSaleem Abdulrasool
Add a missing Windows.h which is needed for the windows type usage in the TU (e.g. HANDLE). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 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-25Define compatibility flag if not defined with -std=c++Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22[Profile] cleanup: do not reference name directly of vars shared between rt ↵Xinliang David Li
and llvm git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276385 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-20Sync up with llvm copy /NFCXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276198 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