[PATCH] D51210: [XRay] FDRTraceWriter and FDR Trace Loading

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 03:49:35 PDT 2018


dberris created this revision.
dberris added a reviewer: eizan.
Herald added subscribers: hiraditya, mgorny.

This is the first step in the larger refactoring and reduction of
https://reviews.llvm.org/D50441.

This step in the process does the following:

- Introduces more granular types of `Record`s representing the many kinds of records written/read by the Flight Data Recorder (FDR) mode `Trace` loading function(s).

- Introduces an abstract `RecordVisitor` type meant to handle the processing of the various `Record` derived types. This `RecordVisitor` has two implementations in this patch: `RecordInitializer` and `FDRTraceWriter`.

- We also introduce a convenience interface for building a collection of `Record` instances called a `LogBuilder`. This allows us to generate sequences of `Record` instances manually (used in unit tests but useful otherwise).

- The`FDRTraceWriter` class implements the `RecordVisitor` interface and handles the writing of metadata records to a `raw_ostream`. We demonstrate that in the unit test, we can generate in-memory FDR mode traces using the specific `Record` derived types, which we load through the `loadTrace(...)` function yielding valid `Trace` objects.

This patch introduces the required types and concepts for us to start
replacing the logic implemented in the `loadFDRLog` function to use the
more granular types. In subsequent patches, we will introduce more
visitor implementations which isolate the verification, printing,
indexing, production/consumption, and finally the conversion of the FDR
mode logs.

The overarching goal of these changes is to make handling FDR mode logs
better tested, more understandable, more extensible, and more
systematic. This will also allow us to better represent the execution
trace, as we improve the fidelity of the events we represent in an XRay
`Trace` object, which we intend to do after FDR mode log processing is
in better shape.


https://reviews.llvm.org/D51210

Files:
  llvm/include/llvm/XRay/FDRLogBuilder.h
  llvm/include/llvm/XRay/FDRRecords.h
  llvm/include/llvm/XRay/FDRTraceWriter.h
  llvm/lib/XRay/CMakeLists.txt
  llvm/lib/XRay/FDRRecords.cpp
  llvm/lib/XRay/FDRTraceWriter.cpp
  llvm/lib/XRay/RecordInitializer.cpp
  llvm/unittests/XRay/CMakeLists.txt
  llvm/unittests/XRay/FDRTraceWriterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51210.162357.patch
Type: text/x-patch
Size: 35585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180824/df88ea08/attachment.bin>


More information about the llvm-commits mailing list