[XRay][compiler-rt] FDR Mode Controller
authorDean Michael Berris <dberris@google.com>
Mon, 15 Oct 2018 02:57:06 +0000 (02:57 +0000)
committerDean Michael Berris <dberris@google.com>
Mon, 15 Oct 2018 02:57:06 +0000 (02:57 +0000)
commit3c01508409d3e9a7e43950318b626e2bd1bf7e78
treef68110bd424d7adb2a28b98baaa234ca667c6270
parent06aea1720a632634cd4bd0a718042e8507579f1d
[XRay][compiler-rt] FDR Mode Controller

Summary:
This change implements a controller for abstracting away the details of
what happens when tracing with FDR mode. This controller type allows us
to test in isolation the various cases where we're encountering function
entry, exit, and other kinds of events we are handling when FDR mode is
enabled.

This change introduces a number of testing facilities we've needed to
better support expressing the conditions we need for the unit tests. We
leave some TODOs for moving those utilities into the LLVM project,
sitting in the `Testing` library, to make matching conditions on XRay
`Trace` instances through googlemock more manageable and declarative.

We don't wire in the controller right away, to allow us to incrementally
update the implementation(s) as we increase testing coverage of the
controller type. There's a need to re-think the way we're managing
buffers in a multi-threaded environment, which is more invasive than
this implementation.

This step in the process allows us to encode our assumptions in the
implementation of the controller, and then evolve the buffer queue
implementation to support generational buffer management to ensure we
can continue to support the cases we're already supporting with the
controller.

Reviewers: mboerger, eizan

Subscribers: mgorny, llvm-commits, jfb

Differential Revision: https://reviews.llvm.org/D52588

llvm-svn: 344488
compiler-rt/lib/xray/CMakeLists.txt
compiler-rt/lib/xray/tests/unit/CMakeLists.txt
compiler-rt/lib/xray/tests/unit/fdr_controller_test.cc [new file with mode: 0644]
compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc
compiler-rt/lib/xray/tests/unit/test_helpers.cc [new file with mode: 0644]
compiler-rt/lib/xray/tests/unit/test_helpers.h [new file with mode: 0644]
compiler-rt/lib/xray/xray_fdr_controller.h [new file with mode: 0644]
compiler-rt/lib/xray/xray_fdr_log_writer.h