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
17syntax = "proto2";
18
19package perfetto.protos;
20
21message AndroidBatteryMetric {
22  message BatteryCounters {
23    // Timestamp measured from boot time [ns].
24    optional int64 timestamp_ns = 1;
25    // Fields 2-5 are the same as in BatteryCounters proto in TracePacket.
26    optional double charge_counter_uah = 2;
27    optional float capacity_percent = 3;
28    optional double current_ua = 4;
29    optional double current_avg_ua = 5;
30  }
31
32  message BatteryAggregates {
33    // Field numbers for these 3 == the int values from Android
34    optional int64 total_screen_off_ns = 1;
35    optional int64 total_screen_on_ns = 2;
36    optional int64 total_screen_doze_ns = 3;
37    // Total time a wakelock was held
38    optional int64 total_wakelock_ns = 4;
39    // Amount of time the device was suspended. Depends on the ftrace source
40    // "power/suspend_resume".
41    optional int64 sleep_ns = 5;
42    optional int64 sleep_screen_off_ns = 6;
43    optional int64 sleep_screen_on_ns = 7;
44    optional int64 sleep_screen_doze_ns = 8;
45  }
46
47  // Period of time during the trace that the device went to sleep completely.
48  message SuspendPeriod {
49    optional int64 timestamp_ns = 1;
50    optional int64 duration_ns = 2;
51  }
52
53  // Battery counters info for each ts of the trace. This should only be
54  // extracted for short traces.
55  repeated BatteryCounters battery_counters = 1;
56
57  optional BatteryAggregates battery_aggregates = 2;
58
59  repeated SuspendPeriod suspend_period = 3;
60}
61