| /* |
| * Copyright (C) 2017 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| syntax = "proto2"; |
| package android.service.procstats; |
| |
| option java_multiple_files = true; |
| option java_outer_classname = "ProcessStatsServiceProto"; |
| |
| import "frameworks/base/core/proto/android/util/common.proto"; |
| import "frameworks/base/libs/incident/proto/android/privacy.proto"; |
| |
| /** |
| * Data from ProcStatsService Dumpsys |
| * |
| * Next Tag: 4 |
| */ |
| message ProcessStatsServiceDumpProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| optional ProcessStatsSectionProto procstats_now = 1; |
| |
| optional ProcessStatsSectionProto procstats_over_3hrs = 2; |
| |
| optional ProcessStatsSectionProto procstats_over_24hrs = 3; |
| } |
| |
| /** |
| * Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java |
| * This proto is defined based on the writeToParcel method. |
| * |
| * Next Tag: 10 |
| */ |
| message ProcessStatsSectionProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Elapsed realtime at start of report. |
| optional int64 start_realtime_ms = 1; |
| |
| // Elapsed realtime at end of report. |
| optional int64 end_realtime_ms = 2; |
| |
| // CPU uptime at start of report. |
| optional int64 start_uptime_ms = 3; |
| |
| // CPU uptime at end of report. |
| optional int64 end_uptime_ms = 4; |
| |
| // System runtime library. e.g. "libdvm.so", "libart.so". |
| optional string runtime = 5; |
| |
| // whether kernel reports swapped pss. |
| optional bool has_swapped_pss = 6; |
| |
| // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops". |
| enum Status { |
| STATUS_UNKNOWN = 0; |
| STATUS_COMPLETE = 1; |
| STATUS_PARTIAL = 2; |
| STATUS_SHUTDOWN = 3; |
| STATUS_SYSPROPS = 4; |
| } |
| repeated Status status = 7; |
| |
| // Stats for each process. |
| repeated ProcessStatsProto process_stats = 8; |
| |
| // Stats for each package. |
| repeated ProcessStatsPackageProto package_stats = 9; |
| } |
| |
| // Next Tag: 10 |
| message ProcessStatsStateProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| enum ScreenState { |
| SCREEN_UNKNOWN = 0; |
| OFF = 1; |
| ON = 2; |
| } |
| optional ScreenState screen_state = 1; |
| |
| enum MemoryState { |
| MEMORY_UNKNOWN = 0; |
| NORMAL = 1; // normal. |
| MODERATE = 2; // moderate memory pressure. |
| LOW = 3; // low memory. |
| CRITICAL = 4; // critical memory. |
| } |
| optional MemoryState memory_state = 2; |
| |
| // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java |
| // and not frameworks/base/core/java/android/app/ActivityManager.java |
| enum ProcessState { |
| PROCESS_UNKNOWN = 0; |
| // Persistent system process. |
| PERSISTENT = 1; |
| // Top activity; actually any visible activity. |
| TOP = 2; |
| // Important foreground process (ime, wallpaper, etc). |
| IMPORTANT_FOREGROUND = 3; |
| // Important background process. |
| IMPORTANT_BACKGROUND = 4; |
| // Performing backup operation. |
| BACKUP = 5; |
| // Background process running a service. |
| SERVICE = 6; |
| // Process not running, but would be if there was enough RAM. |
| SERVICE_RESTARTING = 7; |
| // Process running a receiver. |
| RECEIVER = 8; |
| // Heavy-weight process (currently not used). |
| HEAVY_WEIGHT = 9; |
| // Process hosting home/launcher app when not on top. |
| HOME = 10; |
| // Process hosting the last app the user was in. |
| LAST_ACTIVITY = 11; |
| // Cached process hosting a previous activity. |
| CACHED_ACTIVITY = 12; |
| // Cached process hosting a client activity. |
| CACHED_ACTIVITY_CLIENT = 13; |
| // Cached process that is empty. |
| CACHED_EMPTY = 14; |
| } |
| optional ProcessState process_state = 3; |
| |
| // Millisecond uptime duration spent in this state |
| optional int64 duration_ms = 4; |
| |
| // Millisecond elapsed realtime duration spent in this state |
| optional int64 realtime_duration_ms = 9; |
| |
| // # of samples taken |
| optional int32 sample_size = 5; |
| |
| // PSS is memory reserved for this process |
| optional android.util.AggStats pss = 6; |
| |
| // USS is memory shared between processes, divided evenly for accounting |
| optional android.util.AggStats uss = 7; |
| |
| // RSS is memory resident for this process |
| optional android.util.AggStats rss = 8; |
| } |
| |
| // Next Tag: 7 |
| message ProcessStatsProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Name of process. |
| optional string process = 1; |
| |
| // Uid of the process. |
| optional int32 uid = 2; |
| |
| // Information about how often kills occurred |
| message Kill { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Count of excessive CPU kills |
| optional int32 cpu = 1; |
| |
| // Count of kills when cached |
| optional int32 cached = 2; |
| |
| // PSS stats during cached kill |
| optional android.util.AggStats cached_pss = 3; |
| } |
| optional Kill kill = 3; |
| |
| // Time and memory spent in various states. |
| repeated ProcessStatsStateProto states = 5; |
| |
| // Total time process has been running... screen_state, memory_state, and process_state |
| // will not be set. |
| optional ProcessStatsStateProto total_running_state = 6; |
| } |
| |
| // Next Tag: 7 |
| message ProcessStatsServiceStateProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Name of service component. |
| optional string service_name = 1; |
| |
| // Information about a state the service can be in. |
| message OperationInfo { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Number of times the service was in this operation. |
| optional int32 count = 1; |
| |
| // Time this operation was active in various states. process_state will not be set; |
| // includes only uptime, not memory info. |
| repeated ProcessStatsStateProto states = 2; |
| } |
| |
| // Information about when the service was operating as running (that is how long it was |
| // running for any reason, such as the finer-grained started, bound, and executing times |
| // also reported in this proto). |
| optional OperationInfo running_op = 2; |
| |
| // Information about when the service was operating as started. |
| optional OperationInfo started_op = 3; |
| |
| // Information about when the service was operating as foreground. |
| optional OperationInfo foreground_op = 4; |
| |
| // Information about when the service was operating as bound. |
| optional OperationInfo bound_op = 5; |
| |
| // Information about when the service was operating as executing. |
| optional OperationInfo executing_op = 6; |
| } |
| |
| // Next Tag: 7 |
| message ProcessStatsAssociationStateProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Name of the target component. |
| optional string component_name = 1; |
| |
| // Information on one source in this association. |
| message Source { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Name of source process. |
| optional string process = 1; |
| |
| // Uid of the source process. |
| optional int32 uid = 2; |
| |
| // Total count of the times this association appeared. |
| optional int32 total_count = 3; |
| |
| // Millisecond uptime total duration this association was around. |
| optional int64 total_duration_ms = 4; |
| |
| // Total count of the times this association became actively impacting its target process. |
| optional int32 active_count = 5; |
| |
| // Time association was active in various states. screen_state and memory_state will not |
| // be set; includes only uptime, not memory info. |
| repeated ProcessStatsStateProto active_states = 6; |
| } |
| repeated Source sources = 3; |
| } |
| |
| // Next Tag: 7 |
| message ProcessStatsPackageProto { |
| option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| |
| // Name of package. |
| optional string package = 1; |
| |
| // Uid of the package. |
| optional int32 uid = 2; |
| |
| // Version of the package. |
| optional int64 version = 3; |
| |
| // Stats for each process running with the package loaded in to it. |
| repeated ProcessStatsProto process_stats = 4; |
| |
| // Stats for each of the package's services. |
| repeated ProcessStatsServiceStateProto service_stats = 5; |
| |
| // Stats for each association with the package. |
| repeated ProcessStatsAssociationStateProto association_stats = 6; |
| } |