xref: /aosp_15_r20/external/perfetto/src/trace_processor/importers/proto/android_probes_parser.h (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 #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_PROBES_PARSER_H_
18 #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_PROBES_PARSER_H_
19 
20 #include <cstdint>
21 
22 #include "perfetto/protozero/field.h"
23 #include "src/trace_processor/storage/trace_storage.h"
24 
25 namespace perfetto::trace_processor {
26 
27 class TraceProcessorContext;
28 
29 class AndroidProbesParser {
30  public:
31   using ConstBytes = protozero::ConstBytes;
32 
33   explicit AndroidProbesParser(TraceProcessorContext*);
34 
35   void ParseBatteryCounters(int64_t ts, ConstBytes);
36   void ParsePowerRails(int64_t ts, uint64_t trace_packet_ts, ConstBytes);
37   void ParseEnergyBreakdown(int64_t ts, ConstBytes);
38   void ParseEntityStateResidency(int64_t ts, ConstBytes);
39   void ParseAndroidLogPacket(ConstBytes);
40   void ParseAndroidLogEvent(ConstBytes);
41   void ParseAndroidLogStats(ConstBytes);
42   void ParseStatsdMetadata(ConstBytes);
43   void ParseInitialDisplayState(int64_t ts, ConstBytes);
44   void ParseAndroidSystemProperty(int64_t ts, ConstBytes);
45   void ParseAndroidGameIntervention(ConstBytes);
46 
47  private:
48   TraceProcessorContext* const context_;
49 
50   const StringId device_state_id_;
51   const StringId battery_status_id_;
52   const StringId plug_type_id_;
53   const StringId rail_packet_timestamp_id_;
54   const StringId energy_consumer_id_;
55   const StringId consumer_type_id_;
56   const StringId ordinal_id_;
57 };
58 }  // namespace perfetto::trace_processor
59 
60 #endif  // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_PROBES_PARSER_H_
61