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 optional double voltage_uv = 6; 31 } 32 33 message BatteryAggregates { 34 // Field numbers for these 3 == the int values from Android 35 optional int64 total_screen_off_ns = 1; 36 optional int64 total_screen_on_ns = 2; 37 optional int64 total_screen_doze_ns = 3; 38 // Total time a wakelock was held 39 optional int64 total_wakelock_ns = 4; 40 // Amount of time the device was suspended. Depends on the ftrace source 41 // "power/suspend_resume". 42 optional int64 sleep_ns = 5; 43 optional int64 sleep_screen_off_ns = 6; 44 optional int64 sleep_screen_on_ns = 7; 45 optional int64 sleep_screen_doze_ns = 8; 46 // Average power over the duration of the trace. 47 optional double avg_power_mw = 9; 48 // Average power from charge difference at the start and end of the trace. 49 optional double avg_power_from_charge_diff_mw = 10; 50 } 51 52 // Period of time during the trace that the device went to sleep completely. 53 message SuspendPeriod { 54 optional int64 timestamp_ns = 1; 55 optional int64 duration_ns = 2; 56 } 57 58 // Battery counters info for each ts of the trace. This should only be 59 // extracted for short traces. 60 repeated BatteryCounters battery_counters = 1; 61 62 optional BatteryAggregates battery_aggregates = 2; 63 64 repeated SuspendPeriod suspend_period = 3; 65} 66