1 //===- RecordPrinter.cpp - FDR Record Printer -----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 #include "llvm/XRay/RecordPrinter.h"
11 #include "llvm/Support/FormatVariadic.h"
16 Error
RecordPrinter::visit(BufferExtents
&R
) {
17 OS
<< formatv("<Buffer: size = {0} bytes>", R
.size()) << Delim
;
18 return Error::success();
21 Error
RecordPrinter::visit(WallclockRecord
&R
) {
22 OS
<< formatv("<Wall Time: seconds = {0}.{1,0+6}>", R
.seconds(), R
.nanos())
24 return Error::success();
27 Error
RecordPrinter::visit(NewCPUIDRecord
&R
) {
28 OS
<< formatv("<CPU: id = {0}, tsc = {1}>", R
.cpuid(), R
.tsc()) << Delim
;
29 return Error::success();
32 Error
RecordPrinter::visit(TSCWrapRecord
&R
) {
33 OS
<< formatv("<TSC Wrap: base = {0}>", R
.tsc()) << Delim
;
34 return Error::success();
37 Error
RecordPrinter::visit(CustomEventRecord
&R
) {
38 OS
<< formatv("<Custom Event: tsc = {0}, size = {1}, data = '{2}'>", R
.tsc(),
41 return Error::success();
44 Error
RecordPrinter::visit(CallArgRecord
&R
) {
45 OS
<< formatv("<Call Argument: data = {0} (hex = {0:x})>", R
.arg()) << Delim
;
46 return Error::success();
49 Error
RecordPrinter::visit(PIDRecord
&R
) {
50 OS
<< formatv("<PID: {0}>", R
.pid()) << Delim
;
51 return Error::success();
54 Error
RecordPrinter::visit(NewBufferRecord
&R
) {
55 OS
<< formatv("<Thread ID: {0}>", R
.tid()) << Delim
;
56 return Error::success();
59 Error
RecordPrinter::visit(EndBufferRecord
&R
) {
60 OS
<< "<End of Buffer>" << Delim
;
61 return Error::success();
64 Error
RecordPrinter::visit(FunctionRecord
&R
) {
65 // FIXME: Support symbolization here?
66 switch (R
.recordType()) {
67 case RecordTypes::ENTER
:
68 OS
<< formatv("<Function Enter: #{0} delta = +{0}>", R
.functionId(),
71 case RecordTypes::ENTER_ARG
:
72 OS
<< formatv("<Function Enter With Arg: #{0} delta = +{0}>",
73 R
.functionId(), R
.delta());
75 case RecordTypes::EXIT
:
76 OS
<< formatv("<Function Exit: #{0} delta = +{0}>", R
.functionId(),
79 case RecordTypes::TAIL_EXIT
:
80 OS
<< formatv("<Function Tail Exit: #{0} delta = +{0}>", R
.functionId(),
85 return Error::success();