LLVM  4.0.0
XRayRecord.h
Go to the documentation of this file.
1 //===- XRayRecord.h - XRay Trace Record -----------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file replicates the record definition for XRay log entries. This should
11 // follow the evolution of the log record versions supported in the compiler-rt
12 // xray project.
13 //
14 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_XRAY_XRAY_RECORD_H
16 #define LLVM_XRAY_XRAY_RECORD_H
17 
18 #include <cstdint>
19 
20 namespace llvm {
21 namespace 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.
28  uint16_t Version = 0;
29 
30  /// A numeric identifier for the type of file this is. Best used in
31  /// combination with Version.
32  uint16_t Type = 0;
33 
34  /// Whether the CPU that produced the timestamp counters (TSC) move at a
35  /// constant rate.
37 
38  /// Whether the CPU that produced the timestamp counters (TSC) do not stop.
39  bool NonstopTSC;
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.
44  uint64_t CycleFrequency = 0;
45 };
46 
47 /// Determines the supported types of records that could be seen in XRay traces.
48 /// This may or may not correspond to actual record types in the raw trace (as
49 /// the loader implementation may synthesize this information in the process of
50 /// of loading).
51 enum class RecordTypes { ENTER, EXIT };
52 
53 struct XRayRecord {
54  /// The type of record.
55  uint16_t RecordType;
56 
57  /// The CPU where the thread is running. We assume number of CPUs <= 256.
58  uint8_t CPU;
59 
60  /// Identifies the type of record.
62 
63  /// The function ID for the record.
64  int32_t FuncId;
65 
66  /// Get the full 8 bytes of the TSC when we get the log record.
67  uint64_t TSC;
68 
69  /// The thread ID for the currently running thread.
71 };
72 
73 } // namespace xray
74 } // namespace llvm
75 
76 #endif // LLVM_XRAY_XRAY_RECORD_H
uint16_t RecordType
The type of record.
Definition: XRayRecord.h:55
RecordTypes Type
Identifies the type of record.
Definition: XRayRecord.h:61
uint64_t CycleFrequency
The number of cycles per second for the CPU that produced the timestamp counter (TSC) values...
Definition: XRayRecord.h:44
int32_t FuncId
The function ID for the record.
Definition: XRayRecord.h:64
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
RecordTypes
Determines the supported types of records that could be seen in XRay traces.
Definition: XRayRecord.h:51
uint32_t TId
The thread ID for the currently running thread.
Definition: XRayRecord.h:70
bool NonstopTSC
Whether the CPU that produced the timestamp counters (TSC) do not stop.
Definition: XRayRecord.h:39
uint8_t CPU
The CPU where the thread is running. We assume number of CPUs <= 256.
Definition: XRayRecord.h:58
uint64_t TSC
Get the full 8 bytes of the TSC when we get the log record.
Definition: XRayRecord.h:67
bool ConstantTSC
Whether the CPU that produced the timestamp counters (TSC) move at a constant rate.
Definition: XRayRecord.h:36
XRay traces all have a header providing some top-matter information useful to help tools determine ho...
Definition: XRayRecord.h:26
uint16_t Version
Version of the XRay implementation that produced this file.
Definition: XRayRecord.h:28