Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- FDRTraceWriter.h - XRay FDR Trace Writer -----------------*- C++ -*-===//
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 // Test a utility that can write out XRay FDR Mode formatted trace files.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 #ifndef LLVM_XRAY_FDRTRACEWRITER_H
0013 #define LLVM_XRAY_FDRTRACEWRITER_H
0014 
0015 #include "llvm/Support/raw_ostream.h"
0016 #include "llvm/Support/EndianStream.h"
0017 #include "llvm/XRay/FDRRecords.h"
0018 #include "llvm/XRay/XRayRecord.h"
0019 
0020 namespace llvm {
0021 namespace xray {
0022 
0023 /// The FDRTraceWriter allows us to hand-craft an XRay Flight Data Recorder
0024 /// (FDR) mode log file. This is used primarily for testing, generating
0025 /// sequences of FDR records that can be read/processed. It can also be used to
0026 /// generate various kinds of execution traces without using the XRay runtime.
0027 /// Note that this writer does not do any validation, but uses the types of
0028 /// records defined in the FDRRecords.h file.
0029 class FDRTraceWriter : public RecordVisitor {
0030 public:
0031   // Construct an FDRTraceWriter associated with an output stream.
0032   explicit FDRTraceWriter(raw_ostream &O, const XRayFileHeader &H);
0033   ~FDRTraceWriter();
0034 
0035   Error visit(BufferExtents &) override;
0036   Error visit(WallclockRecord &) override;
0037   Error visit(NewCPUIDRecord &) override;
0038   Error visit(TSCWrapRecord &) override;
0039   Error visit(CustomEventRecord &) override;
0040   Error visit(CallArgRecord &) override;
0041   Error visit(PIDRecord &) override;
0042   Error visit(NewBufferRecord &) override;
0043   Error visit(EndBufferRecord &) override;
0044   Error visit(FunctionRecord &) override;
0045   Error visit(CustomEventRecordV5 &) override;
0046   Error visit(TypedEventRecord &) override;
0047 
0048 private:
0049   support::endian::Writer OS;
0050 };
0051 
0052 } // namespace xray
0053 } // namespace llvm
0054 
0055 #endif // LLVM_XRAY_FDRTRACEWRITER_H