summaryrefslogtreecommitdiff
path: root/test/xray
AgeCommit message (Collapse)Author
2017-03-06[XRay] [compiler-rt] Allow logging the first argument of a function call.Dean Michael Berris
Summary: Functions with the LOG_ARGS_ENTRY sled kind at their beginning will be handled in a way to (optionally) pass their first call argument to your logging handler. For practical and performance reasons, only the first argument is supported, and only up to 64 bits. Reviewers: javed.absar, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29703 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297000 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28[XRay][compiler-rt] Switch default XRay 'patch_premain' to falseDean Michael Berris
Summary: Currently, we assume that applications built with XRay would like to have the instrumentation sleds patched before main starts. This patch changes the default so that we do not patch the instrumentation sleds before main. This default is more helpful for deploying applications in environments where changing the current default is harder (i.e. on remote machines, or work-pool-like systems). This default (not to patch pre-main) makes it easier to selectively run applications with XRay instrumentation enabled, than with the current state. Reviewers: echristo, timshen Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30396 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15[Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64elSagar Thakur
Summary: Adds support for xray on mips/mipsel/mips64/mips64el. Reviewed by sdardis, dberris Differential: D27699 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-25[XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris
Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293015 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-19[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing testsSerge Rogatch
Summary: Testing of XRay was occasionally disabled on 32-bit Arm targets (someone assumed that XRay was supported on 64-bit targets only). This patch should fix that problem. Also here the instruction&data cache incoherency problem is fixed, because it may be causing a test to fail. This patch is one of a series: see also - https://reviews.llvm.org/D28624 Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown Differential Revision: https://reviews.llvm.org/D28623 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18Revert "[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing tests"Renato Golin
This reverts commit r292211, as it broke the Thumb buldbot with: clang-5.0: error: the clang compiler does not support '-fxray-instrument on thumbv7-unknown-linux-gnueabihf' git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing testsSerge Rogatch
Summary: Testing of XRay was occasionally disabled on 32-bit Arm targets (someone assumed that XRay was supported on 64-bit targets only). This patch should fix that problem. Also here the instruction&data cache incoherency problem is fixed, because it may be causing a test to fail. This patch is one of a series: see also - https://reviews.llvm.org/D28624 Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown Differential Revision: https://reviews.llvm.org/D28623 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292211 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch
the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin, pelikan, rovka Subscribers: rovka, llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291568 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03[XRay] [compiler-rt] Include argv[0] in the log file name.Dean Michael Berris
Summary: If you decide to recompile parts of your Linux distro with XRay, it may be useful to know which trace belongs to which binary. While there, get rid of the incorrect strncat() usage; it always returns a pointer to the start which makes that if() always true. Replace with snprintf which is bounded so that enough from both strings fits nicely. Reviewers: dberris Subscribers: danalbert, srhines, kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D27912 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290861 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03Revert "[XRay][compiler-rt] XRay Flight Data Recorder Mode"Dean Michael Berris
This reverts rL290852 as it breaks aarch64 and arm. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03[XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris
Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290852 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by ↵Renato Golin
flushing the instruction cache after code modification" This reverts commit r290452, not quite there yet. We need to test this offline. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch
the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by ↵Renato Golin
flushing the instruction cache after code modification" This reverts commit r290354, as it broke the build. We need to make sure this builds on AArch64 before committing again. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290362 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch
the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12[XRay][CMake] Check target for XRay Flight Data RecorderPetr Hosek
This target doesn't currently do anything, but it is required by the runtimes build. Differential Revision: https://reviews.llvm.org/D27640 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07[XRay][AArch64] Disable the unstable test ↵Serge Rogatch
XRay-aarch64-linux::patching-unpatching.cc Summary: The test `XRay-aarch64-linux::patching-unpatching.cc` sometimes passes, sometimes fails on buildbots. This patch disables test `patching-unpatching.cc` for AArch64 targets. Reviewers: rengolin, dberris Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27528 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06[XRay][compiler-rt] Only add unit tests if we're building XRay.Dean Michael Berris
As constructed before this patch, in case we run into case where we don't actually build the XRay library, we really ought to not be adding the unit test runs. This should fix the bootstrap build failures. This is a follow-up further to D26232. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288788 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06[XRay][compiler-rt] CMake fixes for XRay -- take 2.Dean Michael Berris
The bootstrap buildbot complains about not being able to find the unittests for XRay, when the conditionals to include or not include tests and unit tests don't match. This is a follow-up to D26232. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288786 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06[XRay][compiler-rt] Fix unit test adding logic.Dean Michael Berris
Before this change we would add the unit tests potentially even if we don't actually include the unit tests. This is a follow-up on D26232. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288785 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06[XRay][compiler-rt] XRay Buffer QueueDean Michael Berris
This implements a simple buffer queue to manage a pre-allocated queue of fixed-sized buffers to hold XRay records. We need this to support Flight Data Recorder (FDR) mode. We also implement this as a sub-library first to allow for development before actually using it in an implementation. Some important properties of the buffer queue: - Thread-safe enqueueing/dequeueing of fixed-size buffers. - Pre-allocation of buffers at construction. This is a re-roll of the previous attempt to submit, because it caused failures in arm and aarch64. Reviewers: majnemer, echristo, rSerge Subscribers: tberghammer, danalbert, srhines, modocache, mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26232 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288775 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29[sanitizer] Add macOS minimum deployment target to all compiler invocations ↵Kuba Mracek
in lit tests The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden). Differential Revision: https://reviews.llvm.org/D26929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25Revert "[XRay][compiler-rt] XRay Buffer Queue"Dean Michael Berris
Broke the build on arm7 and aarch64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25[XRay][compiler-rt] XRay Buffer QueueDean Michael Berris
Summary: This implements a simple buffer queue to manage a pre-allocated queue of fixed-sized buffers to hold XRay records. We need this to support Flight Data Recorder (FDR) mode. We also implement this as a sub-library first to allow for development before actually using it in an implementation. Some important properties of the buffer queue: - Thread-safe enqueueing/dequeueing of fixed-size buffers. - Pre-allocation of buffers at construction. Reviewers: majnemer, rSerge, echristo Subscribers: mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26232 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[compiler-rt][XRay] Initial per-thread inmemory logging implementationDean Michael Berris
Depends on D21612 which implements the building blocks for the compiler-rt implementation of the XRay runtime. We use a naive in-memory log of fixed-size entries that get written out to a log file when the buffers are full, and when the thread exits. This implementation lays some foundations on to allowing for more complex XRay records to be written to the log in subsequent changes. It also defines the format that the function call accounting tool in D21987 will start building upon. Once D21987 lands, we should be able to start defining more tests using that tool once the function call accounting tool becomes part of the llvm distribution. Reviewers: echristo, kcc, rnk, eugenis, majnemer, rSerge Subscribers: sdardis, rSerge, dberris, tberghammer, danalbert, srhines, majnemer, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D21982 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279805 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26Include tests only if COMPILER_RT_BUILD_XRAY is ON.Dean Michael Berris
This should un-break users that have not re-generated their CMake configs when they ran it when this was defaulted to OFF. Related to r277975 post-commit review. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279802 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08[compiler-rt][XRay] Only add xray dependency if XRay is built and is ↵Dean Michael Berris
available for the platform git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277983 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08[compiler-rt][XRay] Fix XRay test build dependenciesDean Michael Berris
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277974 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08[compiler-rt][XRay] Implement __xray_unpatch() and __xray_remove_handler()Dean Michael Berris
Summary: We also add one test (and the XRay testing infrastructure) to exercise the patching and unpatching code. This uses the XRay API exported through the headers as well, installing a custom log handler. Depends on D23101 for the updated emitted code alignment for the return/entry sleds. Reviewers: rSerge, echristo, rnk Subscribers: tberghammer, danalbert, srhines, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23154 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277971 91177308-0d34-0410-b5e6-96231b3b80d8