ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
xray_records.h
Go to the documentation of this file.
1//===-- xray_records.h ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is a part of XRay, a dynamic runtime instrumentation system.
10//
11// This header exposes some record types useful for the XRay in-memory logging
12// implementation.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef XRAY_XRAY_RECORDS_H
17#define XRAY_XRAY_RECORDS_H
18
19#include <cstdint>
21namespace __xray {
26};
27
28// FDR mode use of the union field in the XRayFileHeader.
32
33static_assert(sizeof(FdrAdditionalHeaderData) == 16,
34 "FdrAdditionalHeaderData != 16 bytes");
35
36// This data structure is used to describe the contents of the file. We use this
37// for versioning the supported XRay file formats.
38struct alignas(32) XRayFileHeader {
40
41 // The type of file we're writing out. See the FileTypes enum for more
42 // information. This allows different implementations of the XRay logging to
43 // have different files for different information being stored.
45
46 // What follows are a set of flags that indicate useful things for when
47 // reading the data in the file.
48 bool ConstantTSC : 1;
49 bool NonstopTSC : 1;
50
51 // The frequency by which TSC increases per-second.
52 alignas(8) uint64_t CycleFrequency = 0;
53
54 union {
55 char FreeForm[16];
56 // The current civiltime timestamp, as retrieved from 'clock_gettime'. This
57 // allows readers of the file to determine when the file was created or
58 // written down.
59 struct timespec TS;
60
62 };
63} __attribute__((packed));
64
65static_assert(sizeof(XRayFileHeader) == 32, "XRayFileHeader != 32 bytes");
66
71
72struct alignas(32) XRayRecord {
73 // This is the type of the record being written. We use 16 bits to allow us to
74 // treat this as a discriminant, and so that the first 4 bytes get packed
75 // properly. See RecordTypes for more supported types.
77
78 // The CPU where the thread is running. We assume number of CPUs <= 256.
80
81 // The type of the event. One of the following:
82 // ENTER = 0
83 // EXIT = 1
84 // TAIL_EXIT = 2
85 // ENTER_ARG = 3
87
88 // The function ID for the record.
90
91 // Get the full 8 bytes of the TSC when we get the log record.
93
94 // The thread ID for the currently running thread.
96
97 // The ID of process that is currently running
99
100 // Use some bytes in the end of the record for buffers.
101 char Buffer[8] = {};
102} __attribute__((packed));
103
104static_assert(sizeof(XRayRecord) == 32, "XRayRecord != 32 bytes");
105
106struct alignas(32) XRayArgPayload {
107 // We use the same 16 bits as a discriminant for the records in the log here
108 // too, and so that the first 4 bytes are packed properly.
110
111 // Add a few bytes to pad.
113
114 // The function ID for the record.
116
117 // The thread ID for the currently running thread.
119
120 // The ID of process that is currently running
122
123 // The argument payload.
125
126 // The rest of this record ought to be left as padding.
128} __attribute__((packed));
129
130static_assert(sizeof(XRayArgPayload) == 32, "XRayArgPayload != 32 bytes");
131
132} // namespace __xray
133
134#endif // XRAY_XRAY_RECORDS_H
static __inline__ uint32_t
Definition arm_cde.h:25
static __inline__ uint64_t
Definition arm_cde.h:31
static __inline__ int32_t
Definition arm_mve.h:51
static __inline__ uint8_t
Definition arm_mve.h:323
static __inline__ uint16_t
Definition arm_mve.h:315
enum __xray::RecordTypes __attribute__
@ ARG_PAYLOAD
struct FdrAdditionalHeaderData FdrData
struct timespec TS