1 //===- BlockPrinter.h - FDR Block Pretty Printer -------------------------===//
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 //===----------------------------------------------------------------------===//
9 // An implementation of the RecordVisitor which formats a block of records for
10 // easier human consumption.
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_
14 #define LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_
16 #include "llvm/Support/raw_ostream.h"
17 #include "llvm/XRay/FDRRecords.h"
18 #include "llvm/XRay/RecordPrinter.h"
23 class BlockPrinter
: public RecordVisitor
{
36 State CurrentState
= State::Start
;
39 explicit BlockPrinter(raw_ostream
&O
, RecordPrinter
&P
)
40 : RecordVisitor(), OS(O
), RP(P
) {}
42 Error
visit(BufferExtents
&) override
;
43 Error
visit(WallclockRecord
&) override
;
44 Error
visit(NewCPUIDRecord
&) override
;
45 Error
visit(TSCWrapRecord
&) override
;
46 Error
visit(CustomEventRecord
&) override
;
47 Error
visit(CallArgRecord
&) override
;
48 Error
visit(PIDRecord
&) override
;
49 Error
visit(NewBufferRecord
&) override
;
50 Error
visit(EndBufferRecord
&) override
;
51 Error
visit(FunctionRecord
&) override
;
52 Error
visit(CustomEventRecordV5
&) override
;
53 Error
visit(TypedEventRecord
&) override
;
55 void reset() { CurrentState
= State::Start
; }
61 #endif // LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_