[llvm-exegesis] Fix missing std::move.
[llvm-complete.git] / lib / XRay / RecordPrinter.cpp
blob09b25ddba25d979b496f5ee8073c391f142b85b9
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"
11 #include "llvm/Support/FormatVariadic.h"
13 namespace llvm {
14 namespace xray {
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())
23 << Delim;
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(),
39 R.size(), R.data())
40 << Delim;
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(),
69 R.delta());
70 break;
71 case RecordTypes::ENTER_ARG:
72 OS << formatv("<Function Enter With Arg: #{0} delta = +{0}>",
73 R.functionId(), R.delta());
74 break;
75 case RecordTypes::EXIT:
76 OS << formatv("<Function Exit: #{0} delta = +{0}>", R.functionId(),
77 R.delta());
78 break;
79 case RecordTypes::TAIL_EXIT:
80 OS << formatv("<Function Tail Exit: #{0} delta = +{0}>", R.functionId(),
81 R.delta());
82 break;
84 OS << Delim;
85 return Error::success();
88 } // namespace xray
89 } // namespace llvm