1 /*
2 * Copyright (C) 2021 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/chrome_system_probes_module.h"
18 #include "perfetto/base/build_config.h"
19 #include "src/trace_processor/importers/proto/chrome_system_probes_parser.h"
20
21 #include "protos/perfetto/trace/trace_packet.pbzero.h"
22
23 namespace perfetto {
24 namespace trace_processor {
25
26 using perfetto::protos::pbzero::TracePacket;
27
ChromeSystemProbesModule(TraceProcessorContext * context)28 ChromeSystemProbesModule::ChromeSystemProbesModule(
29 TraceProcessorContext* context)
30 : parser_(context) {
31 RegisterForField(TracePacket::kProcessStatsFieldNumber, context);
32 }
33
ParseTracePacketData(const TracePacket::Decoder & decoder,int64_t ts,const TracePacketData &,uint32_t field_id)34 void ChromeSystemProbesModule::ParseTracePacketData(
35 const TracePacket::Decoder& decoder,
36 int64_t ts,
37 const TracePacketData&,
38 uint32_t field_id) {
39 switch (field_id) {
40 case TracePacket::kProcessStatsFieldNumber:
41 parser_.ParseProcessStats(ts, decoder.process_stats());
42 return;
43 }
44 }
45
46 } // namespace trace_processor
47 } // namespace perfetto
48