Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:45

0001 //===- BlockPrinter.h - FDR Block Pretty Printer -------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // An implementation of the RecordVisitor which formats a block of records for
0010 // easier human consumption.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 #ifndef LLVM_XRAY_BLOCKPRINTER_H
0014 #define LLVM_XRAY_BLOCKPRINTER_H
0015 
0016 #include "llvm/Support/raw_ostream.h"
0017 #include "llvm/XRay/FDRRecords.h"
0018 #include "llvm/XRay/RecordPrinter.h"
0019 
0020 namespace llvm {
0021 namespace xray {
0022 
0023 class BlockPrinter : public RecordVisitor {
0024   enum class State {
0025     Start,
0026     Preamble,
0027     Metadata,
0028     Function,
0029     Arg,
0030     CustomEvent,
0031     End,
0032   };
0033 
0034   raw_ostream &OS;
0035   RecordPrinter &RP;
0036   State CurrentState = State::Start;
0037 
0038 public:
0039   explicit BlockPrinter(raw_ostream &O, RecordPrinter &P) : OS(O), RP(P) {}
0040 
0041   Error visit(BufferExtents &) override;
0042   Error visit(WallclockRecord &) override;
0043   Error visit(NewCPUIDRecord &) override;
0044   Error visit(TSCWrapRecord &) override;
0045   Error visit(CustomEventRecord &) override;
0046   Error visit(CallArgRecord &) override;
0047   Error visit(PIDRecord &) override;
0048   Error visit(NewBufferRecord &) override;
0049   Error visit(EndBufferRecord &) override;
0050   Error visit(FunctionRecord &) override;
0051   Error visit(CustomEventRecordV5 &) override;
0052   Error visit(TypedEventRecord &) override;
0053 
0054   void reset() { CurrentState = State::Start; }
0055 };
0056 
0057 } // namespace xray
0058 } // namespace llvm
0059 
0060 #endif // LLVM_XRAY_BLOCKPRINTER_H