blob: 4c11f1eb022046fb19882f5fb28515326b36cc34 [file] [log] [blame]
Yi Jin9680cfa2017-09-15 15:14:43 -07001/*
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
Yi Jinc7f93072017-09-29 15:29:38 -070017syntax = "proto2";
Yi Jin9680cfa2017-09-15 15:14:43 -070018option java_multiple_files = true;
19option java_outer_classname = "ProcessStatsServiceProto";
20
21import "frameworks/base/core/proto/android/util/common.proto";
Yi Jin0d7bc2d12018-01-23 17:35:19 -080022import "frameworks/base/libs/incident/proto/android/privacy.proto";
Yi Jin9680cfa2017-09-15 15:14:43 -070023
24package android.service.procstats;
25
26/**
27 * Data from ProcStatsService Dumpsys
28 *
29 * Next Tag: 4
30 */
31message ProcessStatsServiceDumpProto {
Yi Jin0d7bc2d12018-01-23 17:35:19 -080032 option (android.msg_privacy).dest = DEST_AUTOMATIC;
Yi Jin9680cfa2017-09-15 15:14:43 -070033
Yi Jinc7f93072017-09-29 15:29:38 -070034 optional ProcessStatsSectionProto procstats_now = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070035
Yi Jinc7f93072017-09-29 15:29:38 -070036 optional ProcessStatsSectionProto procstats_over_3hrs = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070037
Yi Jinc7f93072017-09-29 15:29:38 -070038 optional ProcessStatsSectionProto procstats_over_24hrs = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -070039}
40
41/**
42 * Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
43 * This proto is defined based on the writeToParcel method.
44 *
45 * Next Tag: 9
46 */
47message ProcessStatsSectionProto {
Yi Jin0d7bc2d12018-01-23 17:35:19 -080048 option (android.msg_privacy).dest = DEST_AUTOMATIC;
Yi Jin9680cfa2017-09-15 15:14:43 -070049
50 // Elapsed realtime at start of report.
Yi Jinc7f93072017-09-29 15:29:38 -070051 optional int64 start_realtime_ms = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070052
53 // Elapsed realtime at end of report.
Yi Jinc7f93072017-09-29 15:29:38 -070054 optional int64 end_realtime_ms = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070055
56 // CPU uptime at start of report.
Yi Jinc7f93072017-09-29 15:29:38 -070057 optional int64 start_uptime_ms = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -070058
59 // CPU uptime at end of report.
Yi Jinc7f93072017-09-29 15:29:38 -070060 optional int64 end_uptime_ms = 4;
Yi Jin9680cfa2017-09-15 15:14:43 -070061
62 // System runtime library. e.g. "libdvm.so", "libart.so".
Yi Jinc7f93072017-09-29 15:29:38 -070063 optional string runtime = 5;
Yi Jin9680cfa2017-09-15 15:14:43 -070064
65 // whether kernel reports swapped pss.
Yi Jinc7f93072017-09-29 15:29:38 -070066 optional bool has_swapped_pss = 6;
Yi Jin9680cfa2017-09-15 15:14:43 -070067
68 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
69 enum Status {
70 STATUS_UNKNOWN = 0;
71 STATUS_COMPLETE = 1;
72 STATUS_PARTIAL = 2;
73 STATUS_SHUTDOWN = 3;
74 STATUS_SYSPROPS = 4;
75 }
76 repeated Status status = 7;
77
78 // Stats for each process.
79 repeated ProcessStatsProto process_stats = 8;
80}
81
82// Next Tag: 6
83message ProcessStatsProto {
Yi Jin0d7bc2d12018-01-23 17:35:19 -080084 option (android.msg_privacy).dest = DEST_AUTOMATIC;
Yi Jin9680cfa2017-09-15 15:14:43 -070085
86 // Name of process.
Yi Jinc7f93072017-09-29 15:29:38 -070087 optional string process = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070088
89 // Uid of the process.
Yi Jinc7f93072017-09-29 15:29:38 -070090 optional int32 uid = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070091
92 // Information about how often kills occurred
93 message Kill {
Yi Jin0d7bc2d12018-01-23 17:35:19 -080094 option (android.msg_privacy).dest = DEST_AUTOMATIC;
95
Yi Jin9680cfa2017-09-15 15:14:43 -070096 // Count of excessive CPU kills
Yi Jinc7f93072017-09-29 15:29:38 -070097 optional int32 cpu = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070098
99 // Count of kills when cached
Yi Jinc7f93072017-09-29 15:29:38 -0700100 optional int32 cached = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -0700101
102 // PSS stats during cached kill
Yi Jinc7f93072017-09-29 15:29:38 -0700103 optional android.util.AggStats cached_pss = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -0700104 }
Yi Jinc7f93072017-09-29 15:29:38 -0700105 optional Kill kill = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -0700106
107 message State {
Yi Jin0d7bc2d12018-01-23 17:35:19 -0800108 option (android.msg_privacy).dest = DEST_AUTOMATIC;
109
Yi Jin9680cfa2017-09-15 15:14:43 -0700110 enum ScreenState {
111 SCREEN_UNKNOWN = 0;
112 OFF = 1;
113 ON = 2;
114 }
Yi Jinc7f93072017-09-29 15:29:38 -0700115 optional ScreenState screen_state = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -0700116
117 enum MemoryState {
118 MEMORY_UNKNOWN = 0;
119 NORMAL = 1; // normal.
120 MODERATE = 2; // moderate memory pressure.
121 LOW = 3; // low memory.
122 CRITICAL = 4; // critical memory.
123 }
Yi Jinc7f93072017-09-29 15:29:38 -0700124 optional MemoryState memory_state = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -0700125
Yi Jin0d7bc2d12018-01-23 17:35:19 -0800126 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
127 // and not frameworks/base/core/java/android/app/ActivityManager.java
Yi Jin9680cfa2017-09-15 15:14:43 -0700128 enum ProcessState {
129 PROCESS_UNKNOWN = 0;
130 // Persistent system process.
131 PERSISTENT = 1;
132 // Top activity; actually any visible activity.
133 TOP = 2;
134 // Important foreground process (ime, wallpaper, etc).
135 IMPORTANT_FOREGROUND = 3;
136 // Important background process.
137 IMPORTANT_BACKGROUND = 4;
138 // Performing backup operation.
139 BACKUP = 5;
Yi Jin9680cfa2017-09-15 15:14:43 -0700140 // Background process running a service.
Yi Jin0d7bc2d12018-01-23 17:35:19 -0800141 SERVICE = 6;
Yi Jin9680cfa2017-09-15 15:14:43 -0700142 // Process not running, but would be if there was enough RAM.
Yi Jin0d7bc2d12018-01-23 17:35:19 -0800143 SERVICE_RESTARTING = 7;
Yi Jin9680cfa2017-09-15 15:14:43 -0700144 // Process running a receiver.
Yi Jin0d7bc2d12018-01-23 17:35:19 -0800145 RECEIVER = 8;
146 // Heavy-weight process (currently not used).
147 HEAVY_WEIGHT = 9;
Yi Jin9680cfa2017-09-15 15:14:43 -0700148 // Process hosting home/launcher app when not on top.
149 HOME = 10;
150 // Process hosting the last app the user was in.
151 LAST_ACTIVITY = 11;
152 // Cached process hosting a previous activity.
153 CACHED_ACTIVITY = 12;
154 // Cached process hosting a client activity.
155 CACHED_ACTIVITY_CLIENT = 13;
156 // Cached process that is empty.
157 CACHED_EMPTY = 14;
158 }
Yi Jinc7f93072017-09-29 15:29:38 -0700159 optional ProcessState process_state = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -0700160
161 // Millisecond duration spent in this state
Yi Jinc7f93072017-09-29 15:29:38 -0700162 optional int64 duration_ms = 4;
Yi Jin9680cfa2017-09-15 15:14:43 -0700163
164 // # of samples taken
Yi Jinc7f93072017-09-29 15:29:38 -0700165 optional int32 sample_size = 5;
Yi Jin9680cfa2017-09-15 15:14:43 -0700166
167 // PSS is memory reserved for this process
Yi Jinc7f93072017-09-29 15:29:38 -0700168 optional android.util.AggStats pss = 6;
Yi Jin9680cfa2017-09-15 15:14:43 -0700169
170 // USS is memory shared between processes, divided evenly for accounting
Yi Jinc7f93072017-09-29 15:29:38 -0700171 optional android.util.AggStats uss = 7;
Yi Jin9680cfa2017-09-15 15:14:43 -0700172 }
173 repeated State states = 5;
174}