xref: /aosp_15_r20/external/perfetto/src/trace_processor/importers/proto/proto_importer_module.cc (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
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 #include "src/trace_processor/importers/proto/proto_importer_module.h"
18 
19 #include "perfetto/trace_processor/ref_counted.h"
20 #include "src/trace_processor/importers/proto/packet_sequence_state_generation.h"
21 #include "src/trace_processor/types/trace_processor_context.h"
22 
23 namespace perfetto {
24 namespace trace_processor {
25 
ProtoImporterModule()26 ProtoImporterModule::ProtoImporterModule() {}
27 
~ProtoImporterModule()28 ProtoImporterModule::~ProtoImporterModule() {}
29 
TokenizePacket(const protos::pbzero::TracePacket_Decoder &,TraceBlobView *,int64_t,RefPtr<PacketSequenceStateGeneration>,uint32_t)30 ModuleResult ProtoImporterModule::TokenizePacket(
31     const protos::pbzero::TracePacket_Decoder&,
32     TraceBlobView* /*packet*/,
33     int64_t /*packet_timestamp*/,
34     RefPtr<PacketSequenceStateGeneration> /*sequence_state*/,
35     uint32_t /*field_id*/) {
36   return ModuleResult::Ignored();
37 }
38 
ParseTracePacketData(const protos::pbzero::TracePacket_Decoder &,int64_t,const TracePacketData &,uint32_t)39 void ProtoImporterModule::ParseTracePacketData(
40     const protos::pbzero::TracePacket_Decoder&,
41     int64_t /*ts*/,
42     const TracePacketData&,
43     uint32_t /*field_id*/) {}
44 
ParseTraceConfig(const protos::pbzero::TraceConfig_Decoder &)45 void ProtoImporterModule::ParseTraceConfig(
46     const protos::pbzero::TraceConfig_Decoder&) {}
47 
RegisterForField(uint32_t field_id,TraceProcessorContext * context)48 void ProtoImporterModule::RegisterForField(uint32_t field_id,
49                                            TraceProcessorContext* context) {
50   if (context->modules_by_field.size() <= field_id) {
51     context->modules_by_field.resize(field_id + 1);
52   }
53   context->modules_by_field[field_id].push_back(this);
54 }
55 
RegisterForAllFields(TraceProcessorContext * context)56 void ProtoImporterModule::RegisterForAllFields(TraceProcessorContext* context) {
57   context->modules_for_all_fields.push_back(this);
58 }
59 
60 }  // namespace trace_processor
61 }  // namespace perfetto
62