1 //===- BlockPrinter.cpp - FDR Block Pretty Printer Implementation --------===//
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
7 //===----------------------------------------------------------------------===//
8 #include "llvm/XRay/BlockPrinter.h"
13 Error
BlockPrinter::visit(BufferExtents
&R
) {
14 OS
<< "\n[New Block]\n";
15 CurrentState
= State::Preamble
;
20 Error
BlockPrinter::visit(NewBufferRecord
&R
) {
21 if (CurrentState
== State::Start
)
22 OS
<< "\n[New Block]\n";
25 CurrentState
= State::Preamble
;
29 Error
BlockPrinter::visit(WallclockRecord
&R
) {
30 CurrentState
= State::Preamble
;
34 Error
BlockPrinter::visit(PIDRecord
&R
) {
35 CurrentState
= State::Preamble
;
40 Error
BlockPrinter::visit(NewCPUIDRecord
&R
) {
41 if (CurrentState
== State::Preamble
)
43 if (CurrentState
== State::Function
)
45 CurrentState
= State::Metadata
;
51 Error
BlockPrinter::visit(TSCWrapRecord
&R
) {
52 if (CurrentState
== State::Function
)
54 CurrentState
= State::Metadata
;
60 // Custom events will be rendered like "function" events.
61 Error
BlockPrinter::visit(CustomEventRecord
&R
) {
62 if (CurrentState
== State::Metadata
)
64 CurrentState
= State::CustomEvent
;
70 Error
BlockPrinter::visit(CustomEventRecordV5
&R
) {
71 if (CurrentState
== State::Metadata
)
73 CurrentState
= State::CustomEvent
;
79 Error
BlockPrinter::visit(TypedEventRecord
&R
) {
80 if (CurrentState
== State::Metadata
)
82 CurrentState
= State::CustomEvent
;
88 // Function call printing.
89 Error
BlockPrinter::visit(FunctionRecord
&R
) {
90 if (CurrentState
== State::Metadata
)
92 CurrentState
= State::Function
;
98 Error
BlockPrinter::visit(CallArgRecord
&R
) {
99 CurrentState
= State::Arg
;
101 auto E
= RP
.visit(R
);
105 Error
BlockPrinter::visit(EndBufferRecord
&R
) {
106 CurrentState
= State::End
;
108 auto E
= RP
.visit(R
);