File: procstats.proto

package info (click to toggle)
android-platform-frameworks-base 1%3A10.0.0%2Br36-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 321,788 kB
  • sloc: java: 962,234; cpp: 274,314; xml: 242,770; python: 5,060; sh: 1,432; ansic: 494; makefile: 47; sed: 19
file content (275 lines) | stat: -rw-r--r-- 8,624 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/*
 * 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/core/proto/android/service/procstats_enum.proto";
import "frameworks/base/core/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: 11
 */
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;

    // Number of pages available of various types and sizes, representation fragmentation.
    repeated ProcessStatsAvailablePagesProto available_pages = 10;

    // Stats for each process.
    repeated ProcessStatsProto process_stats = 8;

    // Stats for each package.
    repeated ProcessStatsPackageProto package_stats = 9;
}

// Next Tag: 5
message ProcessStatsAvailablePagesProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Node these pages are in (as per /proc/pagetypeinfo)
    optional int32 node = 1;

    // Zone these pages are in (as per /proc/pagetypeinfo)
    optional string zone = 2;

    // Label for the type of these pages (as per /proc/pagetypeinfo)
    optional string label = 3;

    // Distribution of number of pages available by order size.  First entry in array is
    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
    repeated int32 pages_per_order = 4;
}

// Next Tag: 10
message ProcessStatsStateProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional ScreenState screen_state = 1;

    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
    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: 4
message PackageServiceOperationStatsProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Operate enum: Started, Foreground, Bound, Executing
    optional ServiceOperationState operation = 1;

    // Number of times the service was in this operation.
    optional int32 count = 2;

    // Information about a state the service can be in.
    message StateStats {
        option (android.msg_privacy).dest = DEST_AUTOMATIC;

        // Screen state enum.
        optional android.service.procstats.ScreenState screen_state = 1;
        // Memory state enum.
        optional android.service.procstats.MemoryState memory_state = 2;

        // duration in milliseconds.
        optional int64 duration_ms = 3;
        // Millisecond elapsed realtime duration spent in this state
        optional int64 realtime_duration_ms = 4;
    }
    repeated StateStats state_stats = 3;
}

// Next Tag: 3
message PackageServiceStatsProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Name of service component.
    optional string service_name = 1;

    // The operation stats.
    // The package_name, package_uid, package_version, service_name will not be set to save space.
    repeated PackageServiceOperationStatsProto operation_stats = 2;
}

// Next Tag: 8
message PackageAssociationSourceProcessStatsProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Uid of the process.
    optional int32 process_uid = 1;
    // Process name.
    optional string process_name = 2;
    // Package name.
    optional string package_name = 7;

    // 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;

    // Information on one source in this association.
    message StateStats {
        option (android.msg_privacy).dest = DEST_AUTOMATIC;

        // Process state enum.
        optional android.service.procstats.ProcessState process_state = 1;
        // Millisecond uptime duration spent in this state
        optional int64 duration_ms = 2;
        // Millisecond elapsed realtime duration spent in this state
        optional int64 realtime_duration_ms = 3;
    }
    repeated StateStats active_state_stats = 6;
}

// Next Tag: 3
message PackageAssociationProcessStatsProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Name of the target component.
    optional string component_name = 1;
    // Information on one source in this association.
    repeated PackageAssociationSourceProcessStatsProto sources = 2;
}

// 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 PackageServiceStatsProto service_stats = 5;

    // Stats for each association with the package.
    repeated PackageAssociationProcessStatsProto association_stats = 6;
}