[PATCH] D52220: [XRay][compiler-rt] FDRLogWriter Abstraction

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 00:20:07 PDT 2018


dberris created this revision.
dberris added reviewers: mboerger, eizan.
Herald added subscribers: jfb, mgorny.

This change introduces an `FDRLogWriter` type which is responsible for
serialising metadata and function records to character buffers. This is
the first step in a refactoring of the implementation of the FDR runtime
to allow for more granular testing of the individual components of the
implementation.

The main contribution of this change is a means of hiding the details of
how specific records are written to a buffer, and for managing the
extents of these buffers. We make use of C++ features (templates and
some metaprogramming) to reduce repetition in the act of writing out
specific kinds of records to the buffer.

In this process, we make a number of changes across both LLVM and
compiler-rt to allow us to use the `Trace` abstraction defined in the
LLVM project in the testing of the runtime implementation. This gives us
a closer end-to-end test which version-locks the runtime implementation
with the loading implementation in LLVM.

We also allow using gmock in compiler-rt unit tests, by adding the
requisite definitions in the `AddCompilerRT.cmake` module.

NOTE: This is still a work-in-progress patch. We intend to use the
`FDRLogWriter` API in the actual FDR logging runtime. Eventually we will
abstract away as much of the runtime into smaller components, this being
the lowest-risk one.


https://reviews.llvm.org/D52220

Files:
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/lib/xray/tests/CMakeLists.txt
  compiler-rt/lib/xray/tests/unit/CMakeLists.txt
  compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc
  compiler-rt/lib/xray/xray_fdr_log_records.h
  compiler-rt/lib/xray/xray_fdr_log_writer.h
  llvm/include/llvm/XRay/Trace.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52220.165898.patch
Type: text/x-patch
Size: 11728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/882103e9/attachment.bin>


More information about the llvm-commits mailing list