1/* 2 * Copyright (C) 2017 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"; 18package android.service.procstats; 19 20option java_multiple_files = true; 21option java_outer_classname = "ProcessStatsServiceProto"; 22 23import "frameworks/base/core/proto/android/util/common.proto"; 24import "frameworks/base/core/proto/android/service/procstats_enum.proto"; 25import "frameworks/base/core/proto/android/privacy.proto"; 26 27/** 28 * Data from ProcStatsService Dumpsys 29 * 30 * Next Tag: 4 31 */ 32message ProcessStatsServiceDumpProto { 33 option (android.msg_privacy).dest = DEST_AUTOMATIC; 34 35 optional ProcessStatsSectionProto procstats_now = 1; 36 37 optional ProcessStatsSectionProto procstats_over_3hrs = 2; 38 39 optional ProcessStatsSectionProto procstats_over_24hrs = 3; 40} 41 42/** 43 * Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java 44 * This proto is defined based on the writeToParcel method. 45 * 46 * Next Tag: 11 47 */ 48message ProcessStatsSectionProto { 49 option (android.msg_privacy).dest = DEST_AUTOMATIC; 50 51 // Elapsed realtime at start of report. 52 optional int64 start_realtime_ms = 1; 53 54 // Elapsed realtime at end of report. 55 optional int64 end_realtime_ms = 2; 56 57 // CPU uptime at start of report. 58 optional int64 start_uptime_ms = 3; 59 60 // CPU uptime at end of report. 61 optional int64 end_uptime_ms = 4; 62 63 // System runtime library. e.g. "libdvm.so", "libart.so". 64 optional string runtime = 5; 65 66 // whether kernel reports swapped pss. 67 optional bool has_swapped_pss = 6; 68 69 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops". 70 enum Status { 71 STATUS_UNKNOWN = 0; 72 STATUS_COMPLETE = 1; 73 STATUS_PARTIAL = 2; 74 STATUS_SHUTDOWN = 3; 75 STATUS_SYSPROPS = 4; 76 } 77 repeated Status status = 7; 78 79 // Number of pages available of various types and sizes, representation fragmentation. 80 repeated ProcessStatsAvailablePagesProto available_pages = 10; 81 82 // Stats for each process. 83 repeated ProcessStatsProto process_stats = 8; 84 85 // Stats for each package. 86 repeated ProcessStatsPackageProto package_stats = 9; 87} 88 89// Next Tag: 5 90message ProcessStatsAvailablePagesProto { 91 option (android.msg_privacy).dest = DEST_AUTOMATIC; 92 93 // Node these pages are in (as per /proc/pagetypeinfo) 94 optional int32 node = 1; 95 96 // Zone these pages are in (as per /proc/pagetypeinfo) 97 optional string zone = 2; 98 99 // Label for the type of these pages (as per /proc/pagetypeinfo) 100 optional string label = 3; 101 102 // Distribution of number of pages available by order size. First entry in array is 103 // order 0, second is order 1, etc. Each order increase is a doubling of page size. 104 repeated int32 pages_per_order = 4; 105} 106 107// Next Tag: 13 108message ProcessStatsStateProto { 109 option (android.msg_privacy).dest = DEST_AUTOMATIC; 110 111 optional ScreenState screen_state = 1; 112 113 optional MemoryState memory_state = 2; 114 115 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java 116 // and not frameworks/base/core/java/android/app/ActivityManager.java 117 optional ProcessState process_state = 3 [deprecated = true]; 118 119 // the AggregatedProcessState needs to keep sync with ProcessStateAggregated 120 optional AggregatedProcessState process_state_aggregated = 10; 121 122 // Millisecond uptime duration spent in this state 123 optional int64 duration_ms = 4 [deprecated = true]; 124 // Same as above, but with minute resolution so it fits into an int32. 125 optional int32 duration_minutes = 11; 126 127 // Millisecond elapsed realtime duration spent in this state 128 optional int64 realtime_duration_ms = 9 [deprecated = true]; 129 // Same as above, but with minute resolution so it fits into an int32. 130 optional int32 realtime_duration_minutes = 12; 131 132 // # of samples taken 133 optional int32 sample_size = 5; 134 135 // PSS is memory reserved for this process 136 optional android.util.AggStats pss = 6; 137 138 // USS is memory shared between processes, divided evenly for accounting 139 optional android.util.AggStats uss = 7; 140 141 // RSS is memory resident for this process 142 optional android.util.AggStats rss = 8; 143} 144 145// Next Tag: 8 146message ProcessStatsProto { 147 option (android.msg_privacy).dest = DEST_AUTOMATIC; 148 149 // Name of process. 150 optional string process = 1; 151 152 // Uid of the process. 153 optional int32 uid = 2; 154 155 // Information about how often kills occurred 156 message Kill { 157 option (android.msg_privacy).dest = DEST_AUTOMATIC; 158 159 // Count of excessive CPU kills 160 optional int32 cpu = 1; 161 162 // Count of kills when cached 163 optional int32 cached = 2; 164 165 // PSS stats during cached kill 166 optional android.util.AggStats cached_pss = 3; 167 } 168 optional Kill kill = 3; 169 170 // Time and memory spent in various states. 171 repeated ProcessStatsStateProto states = 5; 172 173 // Total time process has been running... screen_state, memory_state, and process_state 174 // will not be set. 175 optional ProcessStatsStateProto total_running_state = 6; 176 177 // Association data for this process in this state; 178 // each entry here is one association. 179 repeated ProcessStatsAssociationProto assocs = 7; 180} 181 182// Next Tag: 6 183message ProcessStatsAssociationProto { 184 // Procss Name of the associated process/package 185 optional string assoc_process_name = 1; 186 187 // Package Name of the associated process/package 188 optional string assoc_package_name = 2 [deprecated = true]; 189 190 // UID of the associated process/package 191 optional int32 assoc_uid = 5; 192 193 // Total count of the times this association appeared. 194 optional int32 total_count = 3; 195 196 // Uptime total duration in seconds this association was around. 197 optional int32 total_duration_secs = 4; 198} 199 200// Next Tag: 4 201message PackageServiceOperationStatsProto { 202 option (android.msg_privacy).dest = DEST_AUTOMATIC; 203 204 // Operate enum: Started, Foreground, Bound, Executing 205 optional ServiceOperationState operation = 1; 206 207 // Number of times the service was in this operation. 208 optional int32 count = 2; 209 210 // Information about a state the service can be in. 211 message StateStats { 212 option (android.msg_privacy).dest = DEST_AUTOMATIC; 213 214 // Screen state enum. 215 optional android.service.procstats.ScreenState screen_state = 1; 216 // Memory state enum. 217 optional android.service.procstats.MemoryState memory_state = 2; 218 219 // duration in milliseconds. 220 optional int64 duration_ms = 3; 221 // Millisecond elapsed realtime duration spent in this state 222 optional int64 realtime_duration_ms = 4; 223 } 224 repeated StateStats state_stats = 3; 225} 226 227// Next Tag: 3 228message PackageServiceStatsProto { 229 option (android.msg_privacy).dest = DEST_AUTOMATIC; 230 231 // Name of service component. 232 optional string service_name = 1; 233 234 // The operation stats. 235 // The package_name, package_uid, package_version, service_name will not be set to save space. 236 repeated PackageServiceOperationStatsProto operation_stats = 2; 237} 238 239// Next Tag: 8 240message PackageAssociationSourceProcessStatsProto { 241 option (android.msg_privacy).dest = DEST_AUTOMATIC; 242 243 // Uid of the process. 244 optional int32 process_uid = 1; 245 // Process name. 246 optional string process_name = 2; 247 // Package name. 248 optional string package_name = 7; 249 250 // Total count of the times this association appeared. 251 optional int32 total_count = 3; 252 253 // Millisecond uptime total duration this association was around. 254 optional int64 total_duration_ms = 4; 255 256 // Total count of the times this association became actively impacting its target process. 257 optional int32 active_count = 5; 258 259 // Information on one source in this association. 260 message StateStats { 261 option (android.msg_privacy).dest = DEST_AUTOMATIC; 262 263 // Process state enum. 264 optional android.service.procstats.ProcessState process_state = 1; 265 // Millisecond uptime duration spent in this state 266 optional int64 duration_ms = 2; 267 // Millisecond elapsed realtime duration spent in this state 268 optional int64 realtime_duration_ms = 3; 269 } 270 repeated StateStats active_state_stats = 6; 271} 272 273// Next Tag: 7 274message PackageAssociationProcessStatsProto { 275 option (android.msg_privacy).dest = DEST_AUTOMATIC; 276 277 // Name of the target component. 278 optional string component_name = 1; 279 280 // Total count of the times this association appeared. 281 optional int32 total_count = 3; 282 283 // Millisecond uptime total duration this association was around. 284 optional int64 total_duration_ms = 4; 285 286 // Total count of the times this association became actively impacting its target process. 287 optional int32 active_count = 5; 288 289 // Millisecond uptime total duration this association was around. 290 optional int64 active_duration_ms = 6; 291 292 // Information on one source in this association. 293 repeated PackageAssociationSourceProcessStatsProto sources = 2; 294} 295 296// Next Tag: 7 297message ProcessStatsPackageProto { 298 option (android.msg_privacy).dest = DEST_AUTOMATIC; 299 300 // Name of package. 301 optional string package = 1; 302 303 // Uid of the package. 304 optional int32 uid = 2; 305 306 // Version of the package. 307 optional int64 version = 3; 308 309 // Stats for each process running with the package loaded in to it. 310 repeated ProcessStatsProto process_stats = 4; 311 312 // Stats for each of the package's services. 313 repeated PackageServiceStatsProto service_stats = 5; 314 315 // Stats for each association with the package. 316 repeated PackageAssociationProcessStatsProto association_stats = 6; 317} 318