1*b5893f02SDimitry Andric //===- FDRRecords.cpp -  XRay Flight Data Recorder Mode Records -----------===//
2*b5893f02SDimitry Andric //
3*b5893f02SDimitry Andric //                     The LLVM Compiler Infrastructure
4*b5893f02SDimitry Andric //
5*b5893f02SDimitry Andric // This file is distributed under the University of Illinois Open Source
6*b5893f02SDimitry Andric // License. See LICENSE.TXT for details.
7*b5893f02SDimitry Andric //
8*b5893f02SDimitry Andric //===----------------------------------------------------------------------===//
9*b5893f02SDimitry Andric //
10*b5893f02SDimitry Andric // Define types and operations on these types that represent the different kinds
11*b5893f02SDimitry Andric // of records we encounter in XRay flight data recorder mode traces.
12*b5893f02SDimitry Andric //
13*b5893f02SDimitry Andric //===----------------------------------------------------------------------===//
14*b5893f02SDimitry Andric #include "llvm/XRay/FDRRecords.h"
15*b5893f02SDimitry Andric 
16*b5893f02SDimitry Andric namespace llvm {
17*b5893f02SDimitry Andric namespace xray {
18*b5893f02SDimitry Andric 
apply(RecordVisitor & V)19*b5893f02SDimitry Andric Error BufferExtents::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)20*b5893f02SDimitry Andric Error WallclockRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)21*b5893f02SDimitry Andric Error NewCPUIDRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)22*b5893f02SDimitry Andric Error TSCWrapRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)23*b5893f02SDimitry Andric Error CustomEventRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)24*b5893f02SDimitry Andric Error CallArgRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)25*b5893f02SDimitry Andric Error PIDRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)26*b5893f02SDimitry Andric Error NewBufferRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)27*b5893f02SDimitry Andric Error EndBufferRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)28*b5893f02SDimitry Andric Error FunctionRecord::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)29*b5893f02SDimitry Andric Error CustomEventRecordV5::apply(RecordVisitor &V) { return V.visit(*this); }
apply(RecordVisitor & V)30*b5893f02SDimitry Andric Error TypedEventRecord::apply(RecordVisitor &V) { return V.visit(*this); }
31*b5893f02SDimitry Andric 
kindToString(RecordKind K)32*b5893f02SDimitry Andric StringRef Record::kindToString(RecordKind K) {
33*b5893f02SDimitry Andric   switch (K) {
34*b5893f02SDimitry Andric   case RecordKind::RK_Metadata:
35*b5893f02SDimitry Andric     return "Metadata";
36*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_BufferExtents:
37*b5893f02SDimitry Andric     return "Metadata:BufferExtents";
38*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_WallClockTime:
39*b5893f02SDimitry Andric     return "Metadata:WallClockTime";
40*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_NewCPUId:
41*b5893f02SDimitry Andric     return "Metadata:NewCPUId";
42*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_TSCWrap:
43*b5893f02SDimitry Andric     return "Metadata:TSCWrap";
44*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_CustomEvent:
45*b5893f02SDimitry Andric     return "Metadata:CustomEvent";
46*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_CustomEventV5:
47*b5893f02SDimitry Andric     return "Metadata:CustomEventV5";
48*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_CallArg:
49*b5893f02SDimitry Andric     return "Metadata:CallArg";
50*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_PIDEntry:
51*b5893f02SDimitry Andric     return "Metadata:PIDEntry";
52*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_NewBuffer:
53*b5893f02SDimitry Andric     return "Metadata:NewBuffer";
54*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_EndOfBuffer:
55*b5893f02SDimitry Andric     return "Metadata:EndOfBuffer";
56*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_TypedEvent:
57*b5893f02SDimitry Andric     return "Metadata:TypedEvent";
58*b5893f02SDimitry Andric   case RecordKind::RK_Metadata_LastMetadata:
59*b5893f02SDimitry Andric     return "Metadata:LastMetadata";
60*b5893f02SDimitry Andric   case RecordKind::RK_Function:
61*b5893f02SDimitry Andric     return "Function";
62*b5893f02SDimitry Andric   }
63*b5893f02SDimitry Andric   return "Unknown";
64*b5893f02SDimitry Andric }
65*b5893f02SDimitry Andric 
66*b5893f02SDimitry Andric } // namespace xray
67*b5893f02SDimitry Andric } // namespace llvm
68