|
|
|||
File indexing completed on 2026-05-10 08:44:46
0001 //===- XRayRecord.h - XRay Trace Record -----------------------------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file replicates the record definition for XRay log entries. This should 0010 // follow the evolution of the log record versions supported in the compiler-rt 0011 // xray project. 0012 // 0013 //===----------------------------------------------------------------------===// 0014 #ifndef LLVM_XRAY_XRAYRECORD_H 0015 #define LLVM_XRAY_XRAYRECORD_H 0016 0017 #include <cstdint> 0018 #include <vector> 0019 #include <string> 0020 0021 namespace llvm { 0022 namespace xray { 0023 0024 /// XRay traces all have a header providing some top-matter information useful 0025 /// to help tools determine how to interpret the information available in the 0026 /// trace. 0027 struct XRayFileHeader { 0028 /// Version of the XRay implementation that produced this file. 0029 uint16_t Version = 0; 0030 0031 /// A numeric identifier for the type of file this is. Best used in 0032 /// combination with Version. 0033 uint16_t Type = 0; 0034 0035 /// Whether the CPU that produced the timestamp counters (TSC) move at a 0036 /// constant rate. 0037 bool ConstantTSC = false; 0038 0039 /// Whether the CPU that produced the timestamp counters (TSC) do not stop. 0040 bool NonstopTSC = false; 0041 0042 /// The number of cycles per second for the CPU that produced the timestamp 0043 /// counter (TSC) values. Useful for estimating the amount of time that 0044 /// elapsed between two TSCs on some platforms. 0045 uint64_t CycleFrequency = 0; 0046 0047 // This is different depending on the type of xray record. The naive format 0048 // stores a Wallclock timespec. FDR logging stores the size of a thread 0049 // buffer. 0050 char FreeFormData[16] = {}; 0051 }; 0052 0053 /// Determines the supported types of records that could be seen in XRay traces. 0054 /// This may or may not correspond to actual record types in the raw trace (as 0055 /// the loader implementation may synthesize this information in the process of 0056 /// of loading). 0057 enum class RecordTypes { 0058 ENTER, 0059 EXIT, 0060 TAIL_EXIT, 0061 ENTER_ARG, 0062 CUSTOM_EVENT, 0063 TYPED_EVENT 0064 }; 0065 0066 /// An XRayRecord is the denormalized view of data associated in a trace. These 0067 /// records may not correspond to actual entries in the raw traces, but they are 0068 /// the logical representation of records in a higher-level event log. 0069 struct XRayRecord { 0070 /// RecordType values are used as "sub-types" which have meaning in the 0071 /// context of the `Type` below. For function call and custom event records, 0072 /// the RecordType is always 0, while for typed events we store the type in 0073 /// the RecordType field. 0074 uint16_t RecordType; 0075 0076 /// The CPU where the thread is running. We assume number of CPUs <= 65536. 0077 uint16_t CPU; 0078 0079 /// Identifies the type of record. 0080 RecordTypes Type; 0081 0082 /// The function ID for the record, if this is a function call record. 0083 int32_t FuncId; 0084 0085 /// Get the full 8 bytes of the TSC when we get the log record. 0086 uint64_t TSC; 0087 0088 /// The thread ID for the currently running thread. 0089 uint32_t TId; 0090 0091 /// The process ID for the currently running process. 0092 uint32_t PId; 0093 0094 /// The function call arguments. 0095 std::vector<uint64_t> CallArgs; 0096 0097 /// For custom and typed events, we provide the raw data from the trace. 0098 std::string Data; 0099 }; 0100 0101 } // namespace xray 0102 } // namespace llvm 0103 0104 #endif // LLVM_XRAY_XRAYRECORD_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|