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