summaryrefslogtreecommitdiff
path: root/test/xray
AgeCommit message (Collapse)Author
2018-07-25[XRay tests] Don't filter test-critical callsJeremy Morse
By default, xray filters events that takes less than 5uS from its log. In this existing test, should printf complete very quickly this will lead to test-critical function calls being filtered (i.e. print_parent_tid). Given that we're not testing the filtering feature, disable it for this test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337929 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23Reapply "[XRay] Remove scheduling dependency in fork_basic_logging.cc"Matthew Voss
Summary: Continuation of https://reviews.llvm.org/D49501 Second part of the test has an scheduling order when there shouldn't be. Reviewers: dberris, ormris Reviewed By: dberris, ormris Subscribers: TWeaver Differential Revision: https://reviews.llvm.org/D49559 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337745 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19[XRay][compiler-rt] Profiling: No files when emptyDean Michael Berris
This change makes it so that the profiling mode implementation will only write files when there are buffers to write. Before this change, we'd always open a file even if there were no profiles collected when flushing. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337443 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19Remove scheduling dependency from XRay :: Posix/fork_basic_logging.ccMatthew Voss
Summary: We've been seeing intermittent failures on our internal bots and we suspect this may be due to the OS scheduling the child process to run before the parent process. This version ensures that the parent and child can be run in either order. Reviewers: Maknee, dberris Reviewed By: dberris Subscribers: delcypher, #sanitizers, Maknee, llvm-commits Differential Revision: https://reviews.llvm.org/D49501 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18[XRay][compiler-rt] FDR Mode: Allow multiple runsDean Michael Berris
Summary: Fix a bug in FDR mode which didn't allow for re-initialising the logging in the same process. This change ensures that: - When we flush the FDR mode logging, that the state of the logging implementation is `XRAY_LOG_UNINITIALIZED`. - Fix up the thread-local initialisation to use aligned storage and `pthread_getspecific` as well as `pthread_setspecific` for the thread-specific data. - Actually use the pointer provided to the thread-exit cleanup handling, instead of assuming that the thread has thread-local data associated with it, and reaching at thread-exit time. In this change we also have an explicit test for two consecutive sessions for FDR mode tracing, and ensuring both sessions succeed. Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49359 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337341 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13[XRay][compiler-rt] Add PID field to llvm-xray tool and add PID metadata ↵Dean Michael Berris
record entry in FDR mode Summary: llvm-xray changes: - account-mode - process-id {...} shows after thread-id - convert-mode - process {...} shows after thread - parses FDR and basic mode pid entries - Checks version number for FDR log parsing. Basic logging changes: - Update header version from 2 -> 3 FDR logging changes: - Update header version from 2 -> 3 - in writeBufferPreamble, there is an additional PID Metadata record (after thread id record and tsc record) Test cases changes: - fdr-mode.cc, fdr-single-thread.cc, fdr-thread-order.cc modified to catch process id output in the log. Reviewers: dberris Reviewed By: dberris Subscribers: hiraditya, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336974 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13[XRay][compiler-rt] Profiling Mode: Flush logs on exitDean Michael Berris
Summary: This change adds support for writing out profiles at program exit. Depends on D48653. Reviewers: kpw, eizan Reviewed By: kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48956 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336969 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-12[XRay][compiler-rt] Fixup: require x86_64 for profiling mode testsDean Michael Berris
This constrains the build environments we are testing/supporting for the runtime tests until we can be sure xray works in more platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336878 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11[XRay] basic mode PID and TID always fetchDean Michael Berris
Summary: XRayRecords now includes a PID field. Basic handlers fetch pid and tid each time they are called instead of caching the value. Added a testcase that calls fork and checks if the child TID is different from the parent TID to verify that the processes' TID are different in the trace. Reviewers: dberris, Maknee Reviewed By: dberris, Maknee Subscribers: kpw, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49025 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336769 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-30[UBsan] Enable subset of unit tests for OpenBSDDavid Carlier
Reviewers: kubamracek, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D48805 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336053 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28Support for multiarch runtimes layoutPetr Hosek
This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335809 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19[XRay] rm GLOB || true -> rm -fFangrui Song
Summary: `rm -f` does not write diagnostic message when there is no file argument. Reviewers: dberris Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48311 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335025 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12[XRay][profiler] Part 5: Profiler File WritingDean Michael Berris
Summary: This is part of the larger XRay Profiling Mode effort. This patch implements the profile writing mechanism, to allow profiles collected through the profiler mode to be persisted to files. Follow-on patches would allow us to load these profiles and start converting/analysing them through the `llvm-xray` tool. Depends on D44620. Reviewers: echristo, kpw, pelikan Reviewed By: kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45998 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334472 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12[XRay][profiler] Part 4: Profiler Mode WiringDean Michael Berris
Summary: This is part of the larger XRay Profiling Mode effort. This patch implements the wiring required to enable us to actually select the `xray-profiling` mode, and install the handlers to start measuring the time and frequency of the function calls in call stacks. The current way to get the profile information is by working with the XRay API to `__xray_process_buffers(...)`. In subsequent changes we'll implement profile saving to files, similar to how the FDR and basic modes operate, as well as means for converting this format into those that can be loaded/visualised as flame graphs. We will also be extending the accounting tool in LLVM to support stack-based function call accounting. We also continue with the implementation to support building small histograms of latencies for the `FunctionCallTrie::Node` type, to allow us to actually approximate the distribution of latencies per function. Depends on D45758 and D46998. Reviewers: eizan, kpw, pelikan Reviewed By: kpw Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D44620 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334469 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-08[XRay][compiler-rt] Remove reliance on C++ ABI featuresDean Michael Berris
Summary: This fixes http://llvm.org/PR32274. This change adds a test to ensure that we're able to link XRay modes and the runtime to binaries that don't need to depend on the C++ standard library or a C++ ABI library. In particular, we ensure that this will work with C programs compiled+linked with XRay. To make the test pass, we need to change a few things in the XRay runtime implementations to remove the reliance on C++ ABI features. In particular, we change the thread-safe function-local-static initialisation to use pthread_* instead of the C++ features that ensure non-trivial thread-local/function-local-static initialisation. Depends on D47696. Reviewers: dblaikie, jfb, kpw, eizan Reviewed By: kpw Subscribers: echristo, eizan, kpw, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46998 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334262 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01[XRay] Fix supposely failing test for FreeBSDDavid Carlier
One test was marked as XFAIL for FreeBSD however still running when launching make check-xray Reviewers: krytarowski, vitalybuka Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D47622 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333733 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14[XRay][compiler-rt] Support in-memory processing of FDR mode logsDean Michael Berris
Summary: This change allows for handling the in-memory data associated with the FDR mode implementation through the new `__xray_log_process_buffers` API. With this change, we can now allow users to process the data in-memory of the process instead of through writing files. This for example allows users to stream the data of the FDR logging implementation through network sockets, or through other mechanisms instead of saving them to local files. We introduce an FDR-specific flag, for "no_file_flush" which lets the flushing logic skip opening/writing to files. This option can be defaulted to `true` when building the compiler-rt XRay runtime through the `XRAY_FDR_OPTIONS` preprocessor macro. Reviewers: kpw, echristo, pelikan, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46574 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332208 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04[XRay][compiler-rt] Support string-based config for Basic mode.Dean Michael Berris
Summary: This addresses http://llvm.org/PR36790. This change allows the XRay Basic Mode implementation to use the string-based initialization routine provided through `__xray_log_init_mode(...)`. In the process, we've also deprecated some flags defined for the `XRAY_OPTIONS` environment variable. We then introduce another environment variable that can control the XRay Basic Mode implementation through `XRAY_BASIC_OPTIONS`. We also rename files from `xray_inmemory_log` to `xray_basic_logging` to be more in line with the mode implementation. Depends on D46174. Reviewers: echristo, kpw, pelikan, eizan Reviewed By: kpw Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46246 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331507 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04[XRay][compiler-rt] Support string-based config for FDR modeDean Michael Berris
Summary: In this chage we add support for the string-based configuration mechanism for configuring FDR mode. We deprecate most of the `xray_fdr_log_*` flags that are set with the `XRAY_OPTIONS` environment variable. Instead we make the FDR implementation take defaults from the `XRAY_FDR_OPTIONS` environment variable, and use the flags defined in `xray_fdr_flags.{h,cc,inc}` for the options we support. This change addresses http://llvm.org/PR36790. Depends on D46173. Reviewers: eizan, pelikan, kpw, echristo Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D46174 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331506 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04[XRay][compiler-rt+docs] Introduce __xray_log_init_mode(...).Dean Michael Berris
Summary: This addresses http://llvm.org/PR36790. The change Deprecates a number of functions and types in `include/xray/xray_log_interface.h` to recommend using string-based configuration of XRay through the __xray_log_init_mode(...) function. In particular, this deprecates the following: - `__xray_set_log_impl(...)` -- users should instead use the `__xray_log_register_mode(...)` and `__xray_log_select_mode(...)` APIs. - `__xray_log_init(...)` -- users should instead use the `__xray_log_init_mode(...)` function, which also requires using the `__xray_log_register_mode(...)` and `__xray_log_select_mode(...)` functionality. - `__xray::FDRLoggingOptions` -- in following patches, we'll be migrating the FDR logging implementations (and tests) to use the string-based configuration. In later stages we'll remove the `__xray::FDRLoggingOptions` type, and ask users to migrate to using the string-based configuration mechanism instead. - `__xray::BasicLoggingOptions` -- same as `__xray::FDRLoggingOptions`, we'll be removing this type later and instead rely exclusively on the string-based configuration API. We also update the documentation to reflect the new advice and remove some of the deprecated notes. Reviewers: eizan, kpw, echristo, pelikan Reviewed By: kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46173 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331503 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[XRay][compiler-rt] Add APIs for processing logs in memoryDean Michael Berris
Summary: This change adds APIs to allow logging implementations to provide a function for iterating through in-memory buffers (if they hold in-memory buffers) and a way for users to generically deal with these buffers in-process. These APIs are: - __xray_log_set_buffer_iterator(...) and __xray_log_remove_buffer_iterator(): installs and removes an iterator function that takes an XRayBuffer and yields the next one. - __xray_log_process_buffers(...): takes a function pointer that can take a mode identifier (string) and an XRayBuffer to process this data as they see fit. The intent is to have the FDR mode implementation's buffers be available through this `__xray_log_process_buffers(...)` API, so that they can be streamed from memory instead of flushed to disk (useful for getting the data to a network, or doing in-process analysis). Basic mode logging will not support this mechanism as it's designed to write the data mostly to disk. Future implementations will may depend on this API as well, to allow for programmatically working through the XRay buffers exposed to the users in some fashion. Reviewers: eizan, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43495 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326866 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22Try to fix the syntax in testKamil Rytarowski
Reported on a buildbot: Error in XFAIL list: couldn't parse text: '| arm || aarch64 || mips' in expression: 'freebsd | arm || aarch64 || mips' Add || in the place of | Fallout from D43382 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325751 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22Remove empty filesKamil Rytarowski
Left over after D43382 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325744 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22Xray instrumentation / enabling more testsKamil Rytarowski
Summary: The Unix subdirectory mostly allows only on Linux x86_64 but now we can target x86_64 arch in general. Patch by David CARLIER Reviewers: krytarowski, dberris, emaste Reviewed By: krytarowski, dberris, emaste Subscribers: emaste, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43382 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16Add initial XRay support for NetBSDKamil Rytarowski
Summary: Reuse the existing FreeBSD code as it is. Sponsored by <The NetBSD Foundation> Reviewers: dberris, rnk, vitalybuka Reviewed By: dberris Subscribers: mclow.lists, emaste, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43370 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325345 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16Reintroduce FreeBSD support in test/xrayKamil Rytarowski
Tested by Douglas Yung. The original patch from D43278 has been reverted. New patch by myself. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325315 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16Revert part of SVN r. 325240 in lit.cfgKamil Rytarowski
The original change broke a llvm-clang-lld-x86_64-debian setup. This change will be investigated and reintroduced in future. Original commit: "Add Xray instrumentation support to FreeBSD" https://reviews.llvm.org/D43278 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325309 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15Add Xray instrumentation support to FreeBSDKamil Rytarowski
Summary: - Enabling the build. - Using assembly for the cpuid parts. - Using thr_self FreeBSD call to get the thread id Patch by: David CARLIER Reviewers: dberris, rnk, krytarowski Reviewed By: dberris, krytarowski Subscribers: emaste, stevecheckoway, nglevin, srhines, kubamracek, dberris, mgorny, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43278 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325240 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-28[xray] Don't try to run XRay unit tests on DarwinKuba Mracek
This gets rid of a lit warning (input './projects/compiler-rt/test/xray/Unit' contained no tests). Differential Revision: https://reviews.llvm.org/D42597 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overheadDean Michael Berris
Summary: Before this change, XRay would conservatively patch sections of the code one sled at a time. Upon testing/profiling, this turns out to take an inordinate amount of time and cycles. For an instrumented clang binary, the cycles spent both in the patching/unpatching routine constituted 4% of the cycles -- this didn't count the time spent in the kernel while performing the mprotect calls in quick succession. With this change, we're coalescing the number of calls to mprotect from being linear to the number of instrumentation points, to now being a lower constant when patching all the sleds through `__xray_patch()` or `__xray_unpatch()`. In the case of calling `__xray_patch_function()` or `__xray_unpatch_function()` we're now doing an mprotect call once for all the sleds for that function (reduction of at least 2x calls to mprotect). Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[XRay][compiler-rt] Implement XRay Basic Mode FilteringDean Michael Berris
Summary: This change implements the basic mode filtering similar to what we do in FDR mode. The implementation is slightly simpler in basic-mode filtering because we have less details to remember, but the idea is the same. At a high level, we do the following to decide when to filter function call records: - We maintain a per-thread "shadow stack" which keeps track of the XRay instrumented functions we've encountered in a thread's execution. - We push an entry onto the stack when we enter an XRay instrumented function, and note the CPU, TSC, and type of entry (whether we have payload or not when entering). - When we encounter an exit event, we determine whether the function being exited is the same function we've entered recently, was executing in the same CPU, and the delta of the recent TSC and the recorded TSC at the top of the stack is less than the equivalent amount of microseconds we're configured to ignore -- then we un-wind the record offset an appropriate number of times (so we can overwrite the records later). We also support limiting the stack depth of the recorded functions, so that we don't arbitrarily write deep function call stacks. Reviewers: eizan, pelikan, kpw, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40828 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319762 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[XRay][compiler-rt] Implement logging implementation registrationDean Michael Berris
Summary: This change allows for registration of multiple logging implementations through a central mechanism in XRay, mapping an implementation to a "mode". Modes are strings that are used as keys to determine which implementation to install through a single API. This mechanism allows users to choose which implementation to install either from the environment variable 'XRAY_OPTIONS' with the `xray_mode=` flag, or programmatically using the `__xray_select_mode(...)` function. Here, we introduce two API functions for the XRay logging: __xray_log_register_mode(Mode, Impl): Associates an XRayLogImpl to a string Mode. We can only have one implementation associated with a given Mode. __xray_log_select_mode(Mode): Finds the associated Impl for Mode and installs it as if by calling `__xray_set_log_impl(...)`. Along with these changes, we also deprecate the xray_naive_log and xray_fdr_log flags and encourage users to instead use the xray_mode flag. Reviewers: kpw, dblaikie, eizan, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40703 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319759 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21[XRay][compiler-rt] Migrate basic mode logging to the XRay frameworkDean Michael Berris
Summary: Before this patch, XRay's basic (naive mode) logging would be initialised and installed in an adhoc manner. This patch ports the implementation of the basic (naive mode) logging implementation to use the common XRay framework. We also make the following changes to reduce the variance between the usage model of basic mode from FDR (flight data recorder) mode: - Allow programmatic control of the size of the buffers dedicated to per-thread records. This removes some hard-coded constants and turns them into runtime-controllable flags and through an Options structure. - Default the `xray_naive_log` option to false. For now, the only way to start basic mode is to set the environment variable, or set the default at build-time compiler options. Because of this change we've had to update a couple of tests relying on basic mode being always on. - Removed the reliance on a non-trivially destructible per-thread resource manager. We use a similar trick done in D39526 to use pthread_key_create() and pthread_setspecific() to ensure that the per-thread cleanup handling is performed at thread-exit time. We also radically simplify the code structure for basic mode, to move most of the implementation in the `__xray` namespace. Reviewers: pelikan, eizan, kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40164 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15[XRay][compiler-rt][x86_64] Align the stack before and after calling handlersDean Michael Berris
Summary: This change fixes the XRay trampolines aside from the __xray_CustomEvent trampoline to align the stack to 16-byte boundaries before calling the handler. Before this change we've not been explicitly aligning the stack to 16-byte boundaries, which makes it dangerous when calling handlers that leave the stack in a state that isn't strictly 16-byte aligned after calling the handlers. We add a test that makes sure we can handle these cases appropriately after the changes, and prevents us from regressing the state moving forward. Fixes http://llvm.org/PR35294. Reviewers: pelikan, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40004 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318261 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10Revert "[XRay][darwin] Initial XRay in Darwin Support"Dean Michael Berris
This reverts r317875. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[XRay][darwin] Initial XRay in Darwin SupportDean Michael Berris
Summary: This change implements the changes required in both clang and compiler-rt to allow building XRay-instrumented binaries in Darwin. For now we limit this to x86_64. We also start building the XRay runtime library in compiler-rt for osx. A caveat to this is that we don't have the tests set up and running yet, which we'll do in a set of follow-on changes. This patch uses the monorepo layout for the coordinated change across multiple projects. Reviewers: kubamracek Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D39114 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[XRay][compiler-rt][NFC] Clean up xray log files before running testDean Michael Berris
Improves the test behaviour in the face of failure. Without this change the fdr-single-thread.cc test may leave around artefacts of a previous failing run since the cleanup doesn't happen if any of the intermediary steps fail. Non-functional change. Subscribers: llvm-commits git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Factor out "stable-runtime" feature and enable it on all android.Evgeniy Stepanov
This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueueDean Michael Berris
Summary: This change removes the dependency on using a std::deque<...> for the storage of the buffers in the buffer queue. We instead implement a fixed-size circular buffer that's resilient to exhaustion, and preserves the semantics of the BufferQueue. We're moving away from using std::deque<...> for two reasons: - We want to remove dependencies on the STL for data structures. - We want the data structure we use to not require re-allocation in the normal course of operation. The internal implementation of the buffer queue uses heap-allocated arrays that are initialized once when the BufferQueue is created, and re-uses slots in the buffer array as buffers are returned in order. We also change the lock used in the implementation to a spinlock instead of a blocking mutex. We reason that since the release operations now take very little time in the critical section, that a spinlock would be appropriate. This change is related to D38073. This change is a re-submit with the following changes: - Keeping track of the live buffers with a counter independent of the pointers keeping track of the extents of the circular buffer. - Additional documentation of what the data members are meant to represent. Reviewers: dblaikie, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38119 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[XRay] [compiler-rt] make sure single threaded programs get traced tooMartin Pelikan
Summary: When the XRay user calls the API to finish writing the log, the thread which is calling the API still hasn't finished and therefore won't get its trace written. Add a test for only the main thread to check this. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38493 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03Revert "[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue"Dean Michael Berris
This reverts r314766 (rL314766). Unit tests fail in multiple bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueueDean Michael Berris
Summary: This change removes the dependency on using a std::deque<...> for the storage of the buffers in the buffer queue. We instead implement a fixed-size circular buffer that's resilient to exhaustion, and preserves the semantics of the BufferQueue. We're moving away from using std::deque<...> for two reasons: - We want to remove dependencies on the STL for data structures. - We want the data structure we use to not require re-allocation in the normal course of operation. The internal implementation of the buffer queue uses heap-allocated arrays that are initialized once when the BufferQueue is created, and re-uses slots in the buffer array as buffers are returned in order. We also change the lock used in the implementation to a spinlock instead of a blocking mutex. We reason that since the release operations now take very little time in the critical section, that a spinlock would be appropriate. This change is related to D38073. Reviewers: dblaikie, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38119 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314766 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[XRay] [compiler-rt] FDR logging arg1 handlerMartin Pelikan
Summary: Write out records about logged function call first arguments. D32840 implements the reading of this in llvm-xray. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32844 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314378 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[XRay][compiler-rt] Handle tail-call exits in the XRay runtimeDean Michael Berris
Summary: This change starts differentiating tail exits from normal exits. We also increase the version number of the "naive" log to version 2, which will be the starting version where these records start appearing. In FDR mode we treat the tail exits as normal exits, and are thus subject to the same treatment with regard to record unwriting. Updating the version number is important to signal older builds of the llvm-xray tool that do not deal with the tail exit records must fail early (and that users should only use the llvm-xray tool built after the support for tail exits to get accurate handling of these records). Depends on D37964. Reviewers: kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37965 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313515 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06[compiler-rt][xray][mips] Mark some tests as unsupported.Simon Dardis
Thesee tests require the integrated assembler which is still in development / testing for MIPS64. GAS doesn't understand the section directives produced by XRay, so marking the relevant tests as unsupported. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312628 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31[XRay][compiler-rt] Enable the XRay compiler-rt unit tests.Dean Michael Berris
Summary: Before this change we seemed to not be running the unit tests, and therefore we set out to run them. In the process of making this happen we found a divergence between the implementation and the tests. This includes changes to both the CMake files as well as the implementation and headers of the XRay runtime. We've also updated documentation on the changed functions. Reviewers: kpw, eizan Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D37290 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312202 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23[XRay][compiler-rt] Support sled versioning for custom event sledsDean Michael Berris
Summary: This change introduces versions to the instrumentation map entries we emit for XRay instrumentaiton points. The status quo for the version is currently set to 0 (as emitted by the LLVM back-end), and versions will count up to 255 (unsigned char). This change is in preparation for supporting the newer version of the custom event sleds that will be emitted by the LLVM compiler. While we're here, we take the opportunity to stash more registers and align the stack properly in the __xray_CustomEvent trampoline. Reviewers: kpw, pcc, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36816 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311524 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18[XRay][compiler-rt][NFC] Expand the PIC test case for XRayDean Michael Berris
Summary: Here we add a build with -ffunction-sections -fdata-sections and -Wl,--gc-sections to ensure that we're still able to generate XRay traces. This is just adding a test, no functional changes. Differential Revision: https://reviews.llvm.org/D36863 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311145 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31[XRay][compiler-rt] Fix test to not be too strict with output order.Dean Michael Berris
Follow-up to D35789. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31[XRay][compiler-rt] Fix typo for REQUIRES.Dean Michael Berris
Follow-up on D35789. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309540 91177308-0d34-0410-b5e6-96231b3b80d8