diff options
author | Dean Michael Berris <dberris@google.com> | 2017-10-05 05:45:51 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-10-05 05:45:51 +0000 |
commit | 37fa92b11dfec2ed39c2144db78000926348ec13 (patch) | |
tree | 65dc6c10d66925f317549e4cf404c5bb1cbfb0dc /compiler-rt/include | |
parent | 5faab3b3a823db47307c242417a9b8e3c32deaae (diff) |
[XRay][compiler-rt] Write out arg1 payload in naive mode logging
Summary:
This change allows the XRay basic (naive) mode logging implementation to
start writing the payload entries through the arg1 logging handler. This
implementation writes out the records that the llvm-xray tool and the
trace reader library will start processing in D38550.
This introduces a new payload record type which logs the data through
the in-memory buffer. It uses the same size/alignment that the normal
XRay record entries use. We use a new record type to indicate these new
entries, so that the trace reader library in LLVM can start reading
these entries.
Depends on D38550.
Reviewers: pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38551
Diffstat (limited to 'compiler-rt/include')
-rw-r--r-- | compiler-rt/include/xray/xray_records.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/compiler-rt/include/xray/xray_records.h b/compiler-rt/include/xray/xray_records.h index 98e54cb6903..d4b7b4c31a9 100644 --- a/compiler-rt/include/xray/xray_records.h +++ b/compiler-rt/include/xray/xray_records.h @@ -67,13 +67,14 @@ static_assert(sizeof(XRayFileHeader) == 32, "XRayFileHeader != 32 bytes"); enum RecordTypes { NORMAL = 0, + ARG_PAYLOAD = 1, }; struct alignas(32) XRayRecord { // This is the type of the record being written. We use 16 bits to allow us to // treat this as a discriminant, and so that the first 4 bytes get packed // properly. See RecordTypes for more supported types. - uint16_t RecordType = 0; + uint16_t RecordType = RecordTypes::NORMAL; // The CPU where the thread is running. We assume number of CPUs <= 256. uint8_t CPU = 0; @@ -82,6 +83,7 @@ struct alignas(32) XRayRecord { // ENTER = 0 // EXIT = 1 // TAIL_EXIT = 2 + // ENTER_ARG = 3 uint8_t Type = 0; // The function ID for the record. @@ -99,6 +101,32 @@ struct alignas(32) XRayRecord { static_assert(sizeof(XRayRecord) == 32, "XRayRecord != 32 bytes"); +struct alignas(32) XRayArgPayload { + // We use the same 16 bits as a discriminant for the records in the log here + // too, and so that the first 4 bytes are packed properly. + uint16_t RecordType = RecordTypes::ARG_PAYLOAD; + + // Add a few bytes to pad. + uint8_t Padding[2] = {}; + + // The function ID for the record. + int32_t FuncId = 0; + + // The thread ID for the currently running thread. + uint32_t TId = 0; + + // Add more padding. + uint8_t Padding2[4] = {}; + + // The argument payload. + uint64_t Arg = 0; + + // The rest of this record ought to be left as padding. + uint8_t TailPadding[8] = {}; +} __attribute__((packed)); + +static_assert(sizeof(XRayArgPayload) == 32, "XRayArgPayload != 32 bytes"); + } // namespace __xray #endif // XRAY_XRAY_RECORDS_H |