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