1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_TRACE_PARSER_H_ 18 #define SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_TRACE_PARSER_H_ 19 20 #include <cstdint> 21 #include <string> 22 23 namespace perfetto::trace_processor { 24 namespace perf_importer { 25 struct Record; 26 } 27 namespace instruments_importer { 28 struct Row; 29 } 30 namespace gecko_importer { 31 struct GeckoEvent; 32 } 33 namespace art_method { 34 struct ArtMethodEvent; 35 } 36 namespace perf_text_importer { 37 struct PerfTextEvent; 38 } 39 40 struct AndroidDumpstateEvent; 41 struct AndroidLogEvent; 42 class PacketSequenceStateGeneration; 43 class TraceBlobView; 44 struct InlineSchedSwitch; 45 class FuchsiaRecord; 46 struct SystraceLine; 47 struct InlineSchedWaking; 48 struct TracePacketData; 49 struct TrackEventData; 50 struct LegacyV8CpuProfileEvent; 51 52 class ProtoTraceParser { 53 public: 54 virtual ~ProtoTraceParser(); 55 virtual void ParseTracePacket(int64_t, TracePacketData) = 0; 56 virtual void ParseTrackEvent(int64_t, TrackEventData) = 0; 57 virtual void ParseEtwEvent(uint32_t, int64_t, TracePacketData) = 0; 58 virtual void ParseFtraceEvent(uint32_t, int64_t, TracePacketData) = 0; 59 virtual void ParseInlineSchedSwitch(uint32_t, int64_t, InlineSchedSwitch) = 0; 60 virtual void ParseInlineSchedWaking(uint32_t, int64_t, InlineSchedWaking) = 0; 61 }; 62 63 class JsonTraceParser { 64 public: 65 virtual ~JsonTraceParser(); 66 virtual void ParseJsonPacket(int64_t, std::string) = 0; 67 virtual void ParseSystraceLine(int64_t, SystraceLine) = 0; 68 virtual void ParseLegacyV8ProfileEvent(int64_t, LegacyV8CpuProfileEvent) = 0; 69 }; 70 71 class FuchsiaRecordParser { 72 public: 73 virtual ~FuchsiaRecordParser(); 74 virtual void ParseFuchsiaRecord(int64_t, FuchsiaRecord) = 0; 75 }; 76 77 class PerfRecordParser { 78 public: 79 virtual ~PerfRecordParser(); 80 virtual void ParsePerfRecord(int64_t, perf_importer::Record) = 0; 81 }; 82 83 class SpeRecordParser { 84 public: 85 virtual ~SpeRecordParser(); 86 virtual void ParseSpeRecord(int64_t, TraceBlobView) = 0; 87 }; 88 89 class InstrumentsRowParser { 90 public: 91 virtual ~InstrumentsRowParser(); 92 virtual void ParseInstrumentsRow(int64_t, instruments_importer::Row) = 0; 93 }; 94 95 class AndroidDumpstateEventParser { 96 public: 97 virtual ~AndroidDumpstateEventParser(); 98 virtual void ParseAndroidDumpstateEvent(int64_t, AndroidDumpstateEvent) = 0; 99 }; 100 101 class AndroidLogEventParser { 102 public: 103 virtual ~AndroidLogEventParser(); 104 virtual void ParseAndroidLogEvent(int64_t, AndroidLogEvent) = 0; 105 }; 106 107 class GeckoTraceParser { 108 public: 109 virtual ~GeckoTraceParser(); 110 virtual void ParseGeckoEvent(int64_t, gecko_importer::GeckoEvent) = 0; 111 }; 112 113 class ArtMethodParser { 114 public: 115 virtual ~ArtMethodParser(); 116 virtual void ParseArtMethodEvent(int64_t, art_method::ArtMethodEvent) = 0; 117 }; 118 119 class PerfTextTraceParser { 120 public: 121 virtual ~PerfTextTraceParser(); 122 virtual void ParsePerfTextEvent(int64_t, 123 perf_text_importer::PerfTextEvent) = 0; 124 }; 125 126 } // namespace perfetto::trace_processor 127 128 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_TRACE_PARSER_H_ 129