LLVM  8.0.1
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 //===----------------------------------------------------------------------===//
10 
12 
13 namespace llvm {
14 namespace xray {
15 
17  OS << formatv("<Buffer: size = {0} bytes>", R.size()) << Delim;
18  return Error::success();
19 }
20 
22  OS << formatv("<Wall Time: seconds = {0}.{1,0+6}>", R.seconds(), R.nanos())
23  << Delim;
24  return Error::success();
25 }
26 
28  OS << formatv("<CPU: id = {0}, tsc = {1}>", R.cpuid(), R.tsc()) << Delim;
29  return Error::success();
30 }
31 
33  OS << formatv("<TSC Wrap: base = {0}>", R.tsc()) << Delim;
34  return Error::success();
35 }
36 
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 
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 
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 
61  OS << formatv("<Call Argument: data = {0} (hex = {0:x})>", R.arg()) << Delim;
62  return Error::success();
63 }
64 
66  OS << formatv("<PID: {0}>", R.pid()) << Delim;
67  return Error::success();
68 }
69 
71  OS << formatv("<Thread ID: {0}>", R.tid()) << Delim;
72  return Error::success();
73 }
74 
76  OS << "<End of Buffer>" << Delim;
77  return Error::success();
78 }
79 
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;
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;
96  OS << formatv("<Function Tail Exit: #{0} delta = +{1}>", R.functionId(),
97  R.delta());
98  break;
101  // TODO: Flag as a bug?
102  break;
103  }
104  OS << Delim;
105  return Error::success();
106 }
107 
108 } // namespace xray
109 } // namespace llvm
int32_t functionId() const
Definition: FDRRecords.h:390
This class represents lattice values for constants.
Definition: AllocatorList.h:24
uint16_t cpuid() const
Definition: FDRRecords.h:174
RecordTypes recordType() const
Definition: FDRRecords.h:389
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
uint64_t arg() const
Definition: FDRRecords.h:305
int32_t pid() const
Definition: FDRRecords.h:328
uint64_t seconds() const
Definition: FDRRecords.h:149
uint64_t tsc() const
Definition: FDRRecords.h:176
uint16_t eventType() const
Definition: FDRRecords.h:282
uint64_t tsc() const
Definition: FDRRecords.h:198
static ErrorSuccess success()
Create a success value.
Definition: Error.h:327
StringRef data() const
Definition: FDRRecords.h:283
uint32_t nanos() const
Definition: FDRRecords.h:150
StringRef data() const
Definition: FDRRecords.h:227
uint32_t delta() const
Definition: FDRRecords.h:391
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
uint64_t size() const
Definition: FDRRecords.h:125
Error visit(BufferExtents &) override