LLVM
8.0.1
lib
XRay
RecordPrinter.cpp
Go to the documentation of this file.
1
//===- RecordPrinter.cpp - FDR Record Printer -----------------------------===//
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
#include "
llvm/XRay/RecordPrinter.h
"
10
11
#include "
llvm/Support/FormatVariadic.h
"
12
13
namespace
llvm
{
14
namespace
xray {
15
16
Error
RecordPrinter::visit
(
BufferExtents
&R) {
17
OS <<
formatv
(
"<Buffer: size = {0} bytes>"
, R.
size
()) << Delim;
18
return
Error::success
();
19
}
20
21
Error
RecordPrinter::visit
(
WallclockRecord
&R) {
22
OS <<
formatv
(
"<Wall Time: seconds = {0}.{1,0+6}>"
, R.
seconds
(), R.
nanos
())
23
<< Delim;
24
return
Error::success
();
25
}
26
27
Error
RecordPrinter::visit
(
NewCPUIDRecord
&R) {
28
OS <<
formatv
(
"<CPU: id = {0}, tsc = {1}>"
, R.
cpuid
(), R.
tsc
()) << Delim;
29
return
Error::success
();
30
}
31
32
Error
RecordPrinter::visit
(
TSCWrapRecord
&R) {
33
OS <<
formatv
(
"<TSC Wrap: base = {0}>"
, R.
tsc
()) << Delim;
34
return
Error::success
();
35
}
36
37
Error
RecordPrinter::visit
(
CustomEventRecord
&R) {
38
OS <<
formatv
(
39
"<Custom Event: tsc = {0}, cpu = {1}, size = {2}, data = '{3}'>"
,
40
R.
tsc
(), R.
cpu
(), R.
size
(), R.
data
())
41
<< Delim;
42
return
Error::success
();
43
}
44
45
Error
RecordPrinter::visit
(
CustomEventRecordV5
&R) {
46
OS <<
formatv
(
"<Custom Event: delta = +{0}, size = {1}, data = '{2}'>"
,
47
R.
delta
(), R.
size
(), R.
data
())
48
<< Delim;
49
return
Error::success
();
50
}
51
52
Error
RecordPrinter::visit
(
TypedEventRecord
&R) {
53
OS <<
formatv
(
54
"<Typed Event: delta = +{0}, type = {1}, size = {2}, data = '{3}'"
,
55
R.
delta
(), R.
eventType
(), R.
size
(), R.
data
())
56
<< Delim;
57
return
Error::success
();
58
}
59
60
Error
RecordPrinter::visit
(
CallArgRecord
&R) {
61
OS <<
formatv
(
"<Call Argument: data = {0} (hex = {0:x})>"
, R.
arg
()) << Delim;
62
return
Error::success
();
63
}
64
65
Error
RecordPrinter::visit
(
PIDRecord
&R) {
66
OS <<
formatv
(
"<PID: {0}>"
, R.
pid
()) << Delim;
67
return
Error::success
();
68
}
69
70
Error
RecordPrinter::visit
(
NewBufferRecord
&R) {
71
OS <<
formatv
(
"<Thread ID: {0}>"
, R.
tid
()) << Delim;
72
return
Error::success
();
73
}
74
75
Error
RecordPrinter::visit
(
EndBufferRecord
&R) {
76
OS <<
"<End of Buffer>"
<< Delim;
77
return
Error::success
();
78
}
79
80
Error
RecordPrinter::visit
(
FunctionRecord
&R) {
81
// FIXME: Support symbolization here?
82
switch
(R.
recordType
()) {
83
case
RecordTypes::ENTER
:
84
OS <<
formatv
(
"<Function Enter: #{0} delta = +{1}>"
, R.
functionId
(),
85
R.
delta
());
86
break
;
87
case
RecordTypes::ENTER_ARG
:
88
OS <<
formatv
(
"<Function Enter With Arg: #{0} delta = +{1}>"
,
89
R.
functionId
(), R.
delta
());
90
break
;
91
case
RecordTypes::EXIT
:
92
OS <<
formatv
(
"<Function Exit: #{0} delta = +{1}>"
, R.
functionId
(),
93
R.
delta
());
94
break
;
95
case
RecordTypes::TAIL_EXIT
:
96
OS <<
formatv
(
"<Function Tail Exit: #{0} delta = +{1}>"
, R.
functionId
(),
97
R.
delta
());
98
break
;
99
case
RecordTypes::CUSTOM_EVENT
:
100
case
RecordTypes::TYPED_EVENT
:
101
// TODO: Flag as a bug?
102
break
;
103
}
104
OS << Delim;
105
return
Error::success
();
106
}
107
108
}
// namespace xray
109
}
// namespace llvm
llvm::xray::FunctionRecord::functionId
int32_t functionId() const
Definition:
FDRRecords.h:390
llvm::xray::NewCPUIDRecord
Definition:
FDRRecords.h:159
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
llvm::xray::NewCPUIDRecord::cpuid
uint16_t cpuid() const
Definition:
FDRRecords.h:174
llvm::xray::TypedEventRecord
Definition:
FDRRecords.h:263
llvm::xray::FunctionRecord
Definition:
FDRRecords.h:373
llvm::xray::FunctionRecord::recordType
RecordTypes recordType() const
Definition:
FDRRecords.h:389
llvm::xray::RecordTypes::ENTER_ARG
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition:
FormatVariadic.h:254
llvm::xray::CustomEventRecord
Definition:
FDRRecords.h:207
llvm::xray::CallArgRecord::arg
uint64_t arg() const
Definition:
FDRRecords.h:305
llvm::xray::WallclockRecord
Definition:
FDRRecords.h:134
llvm::xray::CustomEventRecord::size
int32_t size() const
Definition:
FDRRecords.h:224
RecordPrinter.h
llvm::xray::TypedEventRecord::size
int32_t size() const
Definition:
FDRRecords.h:280
llvm::xray::PIDRecord::pid
int32_t pid() const
Definition:
FDRRecords.h:328
llvm::xray::CustomEventRecordV5::data
StringRef data() const
Definition:
FDRRecords.h:254
llvm::xray::RecordTypes::CUSTOM_EVENT
llvm::xray::RecordTypes::TAIL_EXIT
FormatVariadic.h
llvm::xray::WallclockRecord::seconds
uint64_t seconds() const
Definition:
FDRRecords.h:149
llvm::xray::CustomEventRecord::cpu
uint16_t cpu() const
Definition:
FDRRecords.h:226
llvm::xray::NewCPUIDRecord::tsc
uint64_t tsc() const
Definition:
FDRRecords.h:176
llvm::xray::TypedEventRecord::eventType
uint16_t eventType() const
Definition:
FDRRecords.h:282
llvm::xray::NewBufferRecord
Definition:
FDRRecords.h:337
llvm::xray::BufferExtents
Definition:
FDRRecords.h:111
llvm::xray::CallArgRecord
Definition:
FDRRecords.h:292
llvm::xray::TSCWrapRecord::tsc
uint64_t tsc() const
Definition:
FDRRecords.h:198
llvm::xray::EndBufferRecord
Definition:
FDRRecords.h:360
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:
Error.h:327
llvm::xray::RecordTypes::ENTER
llvm::xray::CustomEventRecordV5
Definition:
FDRRecords.h:236
llvm::xray::CustomEventRecord::tsc
uint64_t tsc() const
Definition:
FDRRecords.h:225
llvm::xray::PIDRecord
Definition:
FDRRecords.h:314
llvm::xray::CustomEventRecordV5::size
int32_t size() const
Definition:
FDRRecords.h:252
llvm::xray::TSCWrapRecord
Definition:
FDRRecords.h:185
llvm::xray::TypedEventRecord::data
StringRef data() const
Definition:
FDRRecords.h:283
llvm::xray::WallclockRecord::nanos
uint32_t nanos() const
Definition:
FDRRecords.h:150
llvm::xray::CustomEventRecordV5::delta
int32_t delta() const
Definition:
FDRRecords.h:253
llvm::xray::RecordTypes::EXIT
llvm::xray::CustomEventRecord::data
StringRef data() const
Definition:
FDRRecords.h:227
llvm::xray::TypedEventRecord::delta
int32_t delta() const
Definition:
FDRRecords.h:281
llvm::xray::FunctionRecord::delta
uint32_t delta() const
Definition:
FDRRecords.h:391
llvm::xray::RecordTypes::TYPED_EVENT
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:
Error.h:158
llvm::xray::BufferExtents::size
uint64_t size() const
Definition:
FDRRecords.h:125
llvm::xray::NewBufferRecord::tid
int32_t tid() const
Definition:
FDRRecords.h:351
llvm::xray::RecordPrinter::visit
Error visit(BufferExtents &) override
Definition:
RecordPrinter.cpp:16
Generated on Sun Dec 20 2020 14:00:52 for LLVM by
1.8.13