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 <vector>
21 
22 #include "perfetto/protozero/field.h"
23 #include "src/trace_processor/storage/trace_storage.h"
24 
25 namespace perfetto {
26 namespace trace_processor {
27 
28 class TraceProcessorContext;
29 
30 class AndroidProbesParser {
31  public:
32   using ConstBytes = protozero::ConstBytes;
33 
34   explicit AndroidProbesParser(TraceProcessorContext*);
35 
36   void ParseBatteryCounters(int64_t ts, ConstBytes);
37   void ParsePowerRails(int64_t ts, ConstBytes);
38   void ParseAndroidLogPacket(ConstBytes);
39   void ParseAndroidLogEvent(ConstBytes);
40   void ParseAndroidLogStats(ConstBytes);
41   void ParseStatsdMetadata(ConstBytes);
42   void ParseAndroidPackagesList(ConstBytes);
43 
44  private:
45   TraceProcessorContext* const context_;
46 
47   const StringId batt_charge_id_;
48   const StringId batt_capacity_id_;
49   const StringId batt_current_id_;
50   const StringId batt_current_avg_id_;
51   std::vector<StringId> power_rails_strs_id_;
52 };
53 }  // namespace trace_processor
54 }  // namespace perfetto
55 
56 #endif  // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_PROBES_PARSER_H_
57