LLVM 20.0.0git
RecordPrinter.cpp
Go to the documentation of this file.
1//===- RecordPrinter.cpp - FDR Record Printer -----------------------------===//
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//===----------------------------------------------------------------------===//
9
11
12namespace llvm {
13namespace xray {
14
16 OS << formatv("<Buffer: size = {0} bytes>", R.size()) << Delim;
17 return Error::success();
18}
19
21 OS << formatv("<Wall Time: seconds = {0}.{1,0+6}>", R.seconds(), R.nanos())
22 << Delim;
23 return Error::success();
24}
25
27 OS << formatv("<CPU: id = {0}, tsc = {1}>", R.cpuid(), R.tsc()) << Delim;
28 return Error::success();
29}
30
32 OS << formatv("<TSC Wrap: base = {0}>", R.tsc()) << Delim;
33 return Error::success();
34}
35
37 OS << formatv(
38 "<Custom Event: tsc = {0}, cpu = {1}, size = {2}, data = '{3}'>",
39 R.tsc(), R.cpu(), R.size(), R.data())
40 << Delim;
41 return Error::success();
42}
43
45 OS << formatv("<Custom Event: delta = +{0}, size = {1}, data = '{2}'>",
46 R.delta(), R.size(), R.data())
47 << Delim;
48 return Error::success();
49}
50
52 OS << formatv(
53 "<Typed Event: delta = +{0}, type = {1}, size = {2}, data = '{3}'",
54 R.delta(), R.eventType(), R.size(), R.data())
55 << Delim;
56 return Error::success();
57}
58
60 OS << formatv("<Call Argument: data = {0} (hex = {0:x})>", R.arg()) << Delim;
61 return Error::success();
62}
63
65 OS << formatv("<PID: {0}>", R.pid()) << Delim;
66 return Error::success();
67}
68
70 OS << formatv("<Thread ID: {0}>", R.tid()) << Delim;
71 return Error::success();
72}
73
75 OS << "<End of Buffer>" << Delim;
76 return Error::success();
77}
78
80 // FIXME: Support symbolization here?
81 switch (R.recordType()) {
83 OS << formatv("<Function Enter: #{0} delta = +{1}>", R.functionId(),
84 R.delta());
85 break;
87 OS << formatv("<Function Enter With Arg: #{0} delta = +{1}>",
88 R.functionId(), R.delta());
89 break;
91 OS << formatv("<Function Exit: #{0} delta = +{1}>", R.functionId(),
92 R.delta());
93 break;
95 OS << formatv("<Function Tail Exit: #{0} delta = +{1}>", R.functionId(),
96 R.delta());
97 break;
100 // TODO: Flag as a bug?
101 break;
102 }
103 OS << Delim;
104 return Error::success();
105}
106
107} // namespace xray
108} // namespace llvm
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Error visit(BufferExtents &) override
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>