1/* 2 * Copyright (C) 2023 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 android.os.statsd.adpf; 20 21import "frameworks/proto_logging/stats/atom_field_options.proto"; 22import "frameworks/proto_logging/stats/atoms.proto"; 23import "frameworks/proto_logging/stats/atoms/adpf/adpf_atoms.proto"; 24import "frameworks/proto_logging/stats/enums/os/enums.proto"; 25 26option java_package = "com.android.os.adpf"; 27option java_multiple_files = true; 28 29extend Atom { 30 // Pushed atoms 31 optional ThermalStatusCalled thermal_status_called = 772 [(module) = "framework"]; 32 optional ThermalHeadroomCalled thermal_headroom_called = 773 [(module) = "framework"]; 33 optional ThermalHeadroomThresholdsCalled thermal_headroom_thresholds_called = 774 [(module) = "framework"]; 34 optional AdpfHintSessionTidCleanup adpf_hint_session_tid_cleanup = 839 [(module) = "framework"]; 35 36 // Pulled atoms 37 optional ThermalHeadroomThresholds thermal_headroom_thresholds = 10201 [(module) = "framework"]; 38 optional AdpfSessionSnapshot adpf_session_snapshot = 10218 [(module) = "framework"]; 39} 40 41enum ThermalApiStatus { 42 UNSPECIFIED_THERMAL_API_FAILURE = 0; 43 SUCCESS = 1; 44 HAL_NOT_READY = 2; 45 FEATURE_NOT_SUPPORTED = 3; 46 INVALID_ARGUMENT = 4; 47 // If the thermal HAL reports no temperature for SKIN type 48 NO_TEMPERATURE = 5; 49 // If the thermal HAL reports no matching threshold for the SKIN temperature 50 NO_TEMPERATURE_THRESHOLD = 6; 51} 52 53enum AdpfSessionUidState { 54 DEFAULT_UID_STATE = 0; 55 FOREGROUND = 1; 56 BACKGROUND = 2; 57} 58 59enum AdpfSessionState { 60 DEFAULT_SESSION_STATE = 0; 61 // This state is used to mark the session is paused. 62 PAUSE = 1; 63 // This state is used to mark the session is resumed. 64 RESUME = 2; 65} 66 67/** 68 * Logs the PowerManager#getCurrentThermalStatus API usage. 69 * Logged from frameworks/base/services/core/java/com/android/server/power/ThermalManagerService.java. 70 */ 71message ThermalStatusCalled { 72 // UID of the package. 73 optional int32 uid = 1 [(is_uid) = true]; 74 75 // API call status. 76 optional ThermalApiStatus api_status = 2; 77 78 // Thermal throttling status. 79 optional android.os.ThrottlingSeverityEnum status = 3; 80} 81 82/** 83 * Logs the PowerManager#getThermalHeadroom API usage. 84 * Logged from frameworks/base/services/core/java/com/android/server/power/ThermalManagerService.java. 85 */ 86message ThermalHeadroomCalled { 87 // UID of the package. 88 optional int32 uid = 1 [(is_uid) = true]; 89 90 // API call status. 91 optional ThermalApiStatus api_status = 2; 92 93 // Thermal headroom. 94 optional float headroom = 3; 95 96 // Forcast seconds. 97 optional int32 forecast_seconds = 4; 98} 99 100/** 101 * Logs the PowerManager#getThermalHeadroomThresholds API usage. 102 * Logged from frameworks/base/services/core/java/com/android/server/power/ThermalManagerService.java. 103 */ 104message ThermalHeadroomThresholdsCalled { 105 // UID of the package. 106 optional int32 uid = 1 [(is_uid) = true]; 107 108 // API call status. 109 optional ThermalApiStatus api_status = 2; 110} 111 112/** 113 * Logs the current thermal headroom thresholds of a device. 114 * Logged from frameworks/base/services/core/java/com/android/server/power/ThermalManagerService.java. 115 */ 116message ThermalHeadroomThresholds { 117 // Thermal headroom threshold for that status. 118 repeated float headroom = 1; 119} 120 121/** 122 * Logs the ADPF TID cleanup result. 123 * Logged from frameworks/base/services/core/java/com/android/server/power/hint/HintManagerService.java 124 */ 125message AdpfHintSessionTidCleanup { 126 optional int32 uid = 1 [(is_uid) = true]; 127 // Total duration of cleaning up all sessions of the uid in microseconds 128 optional int32 total_duration_us = 2; 129 // Max duration of cleaning up a session in microseconds 130 optional int32 max_duration_us = 3; 131 // Total tid count for all sessions of the uid 132 optional int32 total_tid_count = 4; 133 // Total invalid tid count for all sessions of the uid 134 optional int32 total_invalid_tid_count = 5; 135 // Max invalid tid count per session 136 optional int32 max_invalid_tid_count = 6; 137 // Count of all session under the same uid 138 optional int32 session_count = 7; 139 // If the UID is foreground when running cleanup 140 optional bool is_uid_foreground = 8; 141} 142 143/* 144 * Logs the ADPF session snapshot upon pulled. 145 * Logged from frameworks/base/services/core/java/com/android/server/power/hint/HintManagerService.java 146 */ 147message AdpfSessionSnapshot { 148 // Uid of the session, this uid is per-app 149 optional int32 uid = 1 [(is_uid) = true]; 150 151 // Session tag of the snapshot. One uid can generate session with different tags. 152 optional AdpfSessionTag session_tag = 2; 153 154 // Maximum number of sessions that concurrently existed 155 optional int32 max_concurrent_session = 3; 156 157 // Maximum number of threads created in one session 158 optional int32 max_tid_count = 4; 159 160 // Power efficiency mode status 161 optional int32 num_power_efficient_session = 5; 162 163 // list of different target durations requested 164 repeated int64 target_duration_ns = 6; 165} 166