1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/unittests/XRay
Dean Michael Berris ddbb57e570 [XRay] FDR Record Producer/Consumer Implementation
Summary:
This patch defines two new base types called `RecordProducer` and
`RecordConsumer` which have default implementations for convenience
(particularly for testing).

A `RecordProducer` implementation has one member function called
`produce()` which serves as a factory constructor for `Record`
instances. This code exercises the `RecordInitializer` code path in the
implementation for `FileBasedRecordProducer`.

A `RecordConsumer` has a single member function called `consume(...)`
which, as the name implies, consumes instances of
`std::unique_ptr<Record>`. We have two implementations, one of which is
used in the test to generate a vector of `std::unique_ptr<Record>`
similar to how the `LogBuilder` implementation works.

We introduce a test in `FDRProducerConsumerTest` which ensures that
records we write through the `FDRTraceWriter` can be loaded by the
`FileBasedRecordProducer`. The record(s) loaded this way are written
again through the `FDRTraceWriter` into a separate string, which we then
compare. This ensures that the read-in bytes to create the `Record`
instances in memory can be replicated when written out through the
`FDRTraceWriter`.

This change depends on D51210 and is part of the refactoring of D50441
into smaller, more focused changes.

Reviewers: eizan, kpw

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 341180
2018-08-31 08:04:56 +00:00
..
CMakeLists.txt [XRay] FDR Record Producer/Consumer Implementation 2018-08-31 08:04:56 +00:00
FDRProducerConsumerTest.cpp [XRay] FDR Record Producer/Consumer Implementation 2018-08-31 08:04:56 +00:00
FDRTraceWriterTest.cpp [XRay] FDRTraceWriter and FDR Trace Loading 2018-08-30 07:22:21 +00:00
GraphTest.cpp [XRay][graph] Disambiguate name of type from member name 2017-02-10 06:59:25 +00:00
ProfileTest.cpp [XRay][llvm] Load XRay Profiles 2018-08-30 01:43:22 +00:00