8 Commits

Author SHA1 Message Date
Dean Michael Berris
5fd44bde17 [XRay] Write the TSC along with CPUID
Fixes builds in non-little-endian systems.

This is a follow-up to D51911.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341909 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 07:27:59 +00:00
Dean Michael Berris
817cfcb081 [XRay] Fix FunctionRecord serialization
This change makes the writer implementation more consistent with the way
fields are written down to avoid assumptions on bitfield order and
padding. We also fix an inconsistency between the type returned by the
`delta()` accessor to match the data member it's returning.

This is a follow-up to D51289 and D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341230 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 17:49:59 +00:00
Dean Michael Berris
bff6dcb26b [XRay] Make the FDRTraceWriter Endian-aware
Before this patch, the FDRTraceWriter would not take endianness into
account when writing data into the output stream.

This is a follow-up to D51289 and D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341223 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 16:08:38 +00:00
Dean Michael Berris
50365ce77a [XRay] Attempt to fix failure on Windows
Original version of the code relied on implementation-defined order of bitfields.

Follow-up on D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341194 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 10:03:52 +00:00
Dean Michael Berris
b4ef1e85f8 [XRay] Help gcc disambiguate names
Follow-up to D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 09:04:12 +00:00
Dean Michael Berris
6a0b228274 [XRay] Move out template and use perfect forwarding
Follow up to D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341032 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 08:15:42 +00:00
Dean Michael Berris
058bf39189 [XRay] Remove attribute packed
Followup to D51210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341030 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 07:57:32 +00:00
Dean Michael Berris
20baaad0f3 [XRay] FDRTraceWriter and FDR Trace Loading
Summary:
This is the first step in the larger refactoring and reduction of
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.

Reviewers: eizan

Reviewed By: eizan

Subscribers: mgorny, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341029 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 07:22:21 +00:00