• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: 10
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;
118
119    // Millisecond uptime duration spent in this state
120    optional int64 duration_ms = 4;
121
122    // Millisecond elapsed realtime duration spent in this state
123    optional int64 realtime_duration_ms = 9;
124
125    // # of samples taken
126    optional int32 sample_size = 5;
127
128    // PSS is memory reserved for this process
129    optional android.util.AggStats pss = 6;
130
131    // USS is memory shared between processes, divided evenly for accounting
132    optional android.util.AggStats uss = 7;
133
134    // RSS is memory resident for this process
135    optional android.util.AggStats rss = 8;
136}
137
138// Next Tag: 7
139message ProcessStatsProto {
140    option (android.msg_privacy).dest = DEST_AUTOMATIC;
141
142    // Name of process.
143    optional string process = 1;
144
145    // Uid of the process.
146    optional int32 uid = 2;
147
148    // Information about how often kills occurred
149    message Kill {
150        option (android.msg_privacy).dest = DEST_AUTOMATIC;
151
152      // Count of excessive CPU kills
153      optional int32 cpu = 1;
154
155      // Count of kills when cached
156      optional int32 cached = 2;
157
158      // PSS stats during cached kill
159      optional android.util.AggStats cached_pss = 3;
160    }
161    optional Kill kill = 3;
162
163    // Time and memory spent in various states.
164    repeated ProcessStatsStateProto states = 5;
165
166    // Total time process has been running...  screen_state, memory_state, and process_state
167    // will not be set.
168    optional ProcessStatsStateProto total_running_state = 6;
169}
170
171// Next Tag: 4
172message PackageServiceOperationStatsProto {
173    option (android.msg_privacy).dest = DEST_AUTOMATIC;
174
175    // Operate enum: Started, Foreground, Bound, Executing
176    optional ServiceOperationState operation = 1;
177
178    // Number of times the service was in this operation.
179    optional int32 count = 2;
180
181    // Information about a state the service can be in.
182    message StateStats {
183        option (android.msg_privacy).dest = DEST_AUTOMATIC;
184
185        // Screen state enum.
186        optional android.service.procstats.ScreenState screen_state = 1;
187        // Memory state enum.
188        optional android.service.procstats.MemoryState memory_state = 2;
189
190        // duration in milliseconds.
191        optional int64 duration_ms = 3;
192        // Millisecond elapsed realtime duration spent in this state
193        optional int64 realtime_duration_ms = 4;
194    }
195    repeated StateStats state_stats = 3;
196}
197
198// Next Tag: 3
199message PackageServiceStatsProto {
200    option (android.msg_privacy).dest = DEST_AUTOMATIC;
201
202    // Name of service component.
203    optional string service_name = 1;
204
205    // The operation stats.
206    // The package_name, package_uid, package_version, service_name will not be set to save space.
207    repeated PackageServiceOperationStatsProto operation_stats = 2;
208}
209
210// Next Tag: 8
211message PackageAssociationSourceProcessStatsProto {
212    option (android.msg_privacy).dest = DEST_AUTOMATIC;
213
214    // Uid of the process.
215    optional int32 process_uid = 1;
216    // Process name.
217    optional string process_name = 2;
218    // Package name.
219    optional string package_name = 7;
220
221    // Total count of the times this association appeared.
222    optional int32 total_count = 3;
223
224    // Millisecond uptime total duration this association was around.
225    optional int64 total_duration_ms = 4;
226
227    // Total count of the times this association became actively impacting its target process.
228    optional int32 active_count = 5;
229
230    // Information on one source in this association.
231    message StateStats {
232        option (android.msg_privacy).dest = DEST_AUTOMATIC;
233
234        // Process state enum.
235        optional android.service.procstats.ProcessState process_state = 1;
236        // Millisecond uptime duration spent in this state
237        optional int64 duration_ms = 2;
238        // Millisecond elapsed realtime duration spent in this state
239        optional int64 realtime_duration_ms = 3;
240    }
241    repeated StateStats active_state_stats = 6;
242}
243
244// Next Tag: 3
245message PackageAssociationProcessStatsProto {
246    option (android.msg_privacy).dest = DEST_AUTOMATIC;
247
248    // Name of the target component.
249    optional string component_name = 1;
250    // Information on one source in this association.
251    repeated PackageAssociationSourceProcessStatsProto sources = 2;
252}
253
254// Next Tag: 7
255message ProcessStatsPackageProto {
256    option (android.msg_privacy).dest = DEST_AUTOMATIC;
257
258    // Name of package.
259    optional string package = 1;
260
261    // Uid of the package.
262    optional int32 uid = 2;
263
264    // Version of the package.
265    optional int64 version = 3;
266
267    // Stats for each process running with the package loaded in to it.
268    repeated ProcessStatsProto process_stats = 4;
269
270    // Stats for each of the package's services.
271    repeated PackageServiceStatsProto service_stats = 5;
272
273    // Stats for each association with the package.
274    repeated PackageAssociationProcessStatsProto association_stats = 6;
275}
276