/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PROTO_IMPORTER_MODULE_H_ #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PROTO_IMPORTER_MODULE_H_ #include <cstdint> #include <optional> #include <string> #include "perfetto/base/logging.h" #include "perfetto/base/status.h" #include "perfetto/trace_processor/ref_counted.h" #include "src/trace_processor/importers/common/trace_parser.h" #include "src/trace_processor/importers/proto/packet_sequence_state_generation.h" namespace perfetto { namespace protos::pbzero { class TraceConfig_Decoder; class TracePacket_Decoder; } // namespace protos::pbzero namespace trace_processor { class TraceBlobView; class TraceProcessorContext; // This file contains a base class for ProtoTraceReader/Parser modules. // A module implements support for a subset of features of the TracePacket // proto format. // To add and integrate a new module: // (1) Add MyModule as a subclass of ProtoImporterModule, // overriding the TokenizePacket(), ParsePacket() and/or ParseTraceConfig() // methods. // (2) In the constructor call the RegisterForField method for every field // that the module knows how to handle. // (3) Create a module instance and add it to TraceProcessorContext's |modules| // vector in either default_modules.cc or additional_modules.cc. // See GraphicsEventModule for an example. class ModuleResult { … }; // Base class for modules. class ProtoImporterModule { … }; } // namespace trace_processor } // namespace perfetto #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PROTO_IMPORTER_MODULE_H_