LLVM 22.0.0git
XRayRecord.h
Go to the documentation of this file.
1//===- XRayRecord.h - XRay Trace Record -----------------------------------===//
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 replicates the record definition for XRay log entries. This should
10// follow the evolution of the log record versions supported in the compiler-rt
11// xray project.
12//
13//===----------------------------------------------------------------------===//
14#ifndef LLVM_XRAY_XRAYRECORD_H
15#define LLVM_XRAY_XRAYRECORD_H
16
17#include <cstdint>
18#include <vector>
19#include <string>
20
21namespace llvm::xray {
22
23/// XRay traces all have a header providing some top-matter information useful
24/// to help tools determine how to interpret the information available in the
25/// trace.
27 /// Version of the XRay implementation that produced this file.
29
30 /// A numeric identifier for the type of file this is. Best used in
31 /// combination with Version.
33
34 /// Whether the CPU that produced the timestamp counters (TSC) move at a
35 /// constant rate.
36 bool ConstantTSC = false;
37
38 /// Whether the CPU that produced the timestamp counters (TSC) do not stop.
39 bool NonstopTSC = false;
40
41 /// The number of cycles per second for the CPU that produced the timestamp
42 /// counter (TSC) values. Useful for estimating the amount of time that
43 /// elapsed between two TSCs on some platforms.
45
46 // This is different depending on the type of xray record. The naive format
47 // stores a Wallclock timespec. FDR logging stores the size of a thread
48 // buffer.
49 char FreeFormData[16] = {};
50};
51
52/// Determines the supported types of records that could be seen in XRay traces.
53/// This may or may not correspond to actual record types in the raw trace (as
54/// the loader implementation may synthesize this information in the process of
55/// of loading).
64
65/// An XRayRecord is the denormalized view of data associated in a trace. These
66/// records may not correspond to actual entries in the raw traces, but they are
67/// the logical representation of records in a higher-level event log.
68struct XRayRecord {
69 /// RecordType values are used as "sub-types" which have meaning in the
70 /// context of the `Type` below. For function call and custom event records,
71 /// the RecordType is always 0, while for typed events we store the type in
72 /// the RecordType field.
74
75 /// The CPU where the thread is running. We assume number of CPUs <= 65536.
77
78 /// Identifies the type of record.
80
81 /// The function ID for the record, if this is a function call record.
82 int32_t FuncId;
83
84 /// Get the full 8 bytes of the TSC when we get the log record.
86
87 /// The thread ID for the currently running thread.
89
90 /// The process ID for the currently running process.
92
93 /// The function call arguments.
94 std::vector<uint64_t> CallArgs;
95
96 /// For custom and typed events, we provide the raw data from the trace.
97 std::string Data;
98};
99
100} // namespace llvm::xray
101
102#endif // LLVM_XRAY_XRAYRECORD_H
RecordTypes
Determines the supported types of records that could be seen in XRay traces.
Definition XRayRecord.h:56
XRay traces all have a header providing some top-matter information useful to help tools determine ho...
Definition XRayRecord.h:26
bool ConstantTSC
Whether the CPU that produced the timestamp counters (TSC) move at a constant rate.
Definition XRayRecord.h:36
uint16_t Type
A numeric identifier for the type of file this is.
Definition XRayRecord.h:32
uint64_t CycleFrequency
The number of cycles per second for the CPU that produced the timestamp counter (TSC) values.
Definition XRayRecord.h:44
bool NonstopTSC
Whether the CPU that produced the timestamp counters (TSC) do not stop.
Definition XRayRecord.h:39
uint16_t Version
Version of the XRay implementation that produced this file.
Definition XRayRecord.h:28
An XRayRecord is the denormalized view of data associated in a trace.
Definition XRayRecord.h:68
uint32_t PId
The process ID for the currently running process.
Definition XRayRecord.h:91
int32_t FuncId
The function ID for the record, if this is a function call record.
Definition XRayRecord.h:82
RecordTypes Type
Identifies the type of record.
Definition XRayRecord.h:79
uint32_t TId
The thread ID for the currently running thread.
Definition XRayRecord.h:88
uint16_t CPU
The CPU where the thread is running. We assume number of CPUs <= 65536.
Definition XRayRecord.h:76
uint64_t TSC
Get the full 8 bytes of the TSC when we get the log record.
Definition XRayRecord.h:85
std::string Data
For custom and typed events, we provide the raw data from the trace.
Definition XRayRecord.h:97
uint16_t RecordType
RecordType values are used as "sub-types" which have meaning in the context of the Type below.
Definition XRayRecord.h:73
std::vector< uint64_t > CallArgs
The function call arguments.
Definition XRayRecord.h:94