blob: 805534307e8ec292beb8e4bdf7606c1644fed319 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -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
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080025
Yao Chend54f9dd2017-10-17 17:37:48 +000026/**
Stefan Lafonae2df012017-11-14 09:17:21 -080027 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000028 * raw stats log events from the Android system, also known as "atoms."
29 *
30 * This field contains a single oneof with all of the available messages.
31 * The stats-log-api-gen tool runs as part of the Android build and
32 * generates the android.util.StatsLog class, which contains the constants
33 * and methods that Android uses to log.
34 *
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * Instead, statsd on Android constructs these messages synthetically,
37 * in the format defined here and in stats_log.proto.
38 */
Stefan Lafonae2df012017-11-14 09:17:21 -080039message Atom {
40 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070041 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070042 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
43 BleScanStateChanged ble_scan_state_changed = 2;
44 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
45 BleScanResultReceived ble_scan_result_received = 4;
46 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080047 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070048 SyncStateChanged sync_state_changed = 7;
49 ScheduledJobStateChanged scheduled_job_state_changed = 8;
50 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070051 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080052 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
53 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
54 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
55 // TODO: 14-19 are blank, but need not be
56 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
57 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
58 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070059 AudioStateChanged audio_state_changed = 23;
60 MediaCodecActivityChanged media_codec_activity_changed = 24;
61 CameraStateChanged camera_state_changed = 25;
62 FlashlightStateChanged flashlight_state_changed = 26;
63 UidProcessStateChanged uid_process_state_changed = 27;
64 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
65 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070066 BatteryLevelChanged battery_level_changed = 30;
67 ChargingStateChanged charging_state_changed = 31;
68 PluggedStateChanged plugged_state_changed = 32;
69 DeviceTemperatureReported device_temperature_reported = 33;
70 DeviceOnStatusChanged device_on_status_changed = 34;
71 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
72 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070073 WifiLockStateChanged wifi_lock_state_changed = 37;
74 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
75 WifiScanStateChanged wifi_scan_state_changed = 39;
76 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070077 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070078 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070079 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090080 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080081 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080082 AnomalyDetected anomaly_detected = 46;
83 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000084 AppStartChanged app_start_changed = 48;
85 AppStartCancelChanged app_start_cancel_changed = 49;
86 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080087 LmkEventOccurred lmk_event_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080088 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080089 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Bookatzc1a050a2017-10-10 15:49:28 -070090 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000091 }
David Chenc8a43242017-10-17 16:23:28 -070092
David Chen6e3e6cb2018-01-03 16:14:06 -080093 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070094 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080095 WifiBytesTransfer wifi_bytes_transfer = 10000;
96 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
97 MobileBytesTransfer mobile_bytes_transfer = 10002;
98 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
99 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800100 SubsystemSleepState subsystem_sleep_state = 10005;
101 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800102 CpuTimePerFreq cpu_time_per_freq = 10008;
103 CpuTimePerUid cpu_time_per_uid = 10009;
104 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
105 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
106 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar27572b92018-01-23 16:12:51 -0800107 ProcessMemoryStat process_memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800108 CpuSuspendTime cpu_suspend_time = 10014;
109 CpuIdleTime cpu_idle_time = 10015;
110 CpuActiveTime cpu_active_time = 10016;
111 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800112 DiskSpace disk_space = 10018;
113 SystemUptime system_uptime = 10019;
David Chenc8a43242017-10-17 16:23:28 -0700114 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700115}
116
Yao Chend54f9dd2017-10-17 17:37:48 +0000117/**
Yangster-mac20877162017-12-22 17:19:39 -0800118 * This proto represents a node of an attribution chain.
119 * Note: All attribution chains are represented as a repeated field of type
120 * AttributionNode. It is understood that in such arrays, the order is that
121 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000122 */
Yangster-mac20877162017-12-22 17:19:39 -0800123message AttributionNode {
124 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800125 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800126
Yangster-mac20877162017-12-22 17:19:39 -0800127 // The (optional) string tag for an element in the attribution chain. If the
128 // element has no tag, it is encoded as an empty string.
129 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700130}
131
Yao Chend54f9dd2017-10-17 17:37:48 +0000132/*
133 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800134 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000135 *
136 * RULES:
137 * - The field ids for each atom must start at 1, and count upwards by 1.
138 * Skipping field ids is not allowed.
139 * - These form an API, so renaming, renumbering or removing fields is
140 * not allowed between android releases. (This is not currently enforced,
141 * but there will be a tool to enforce this restriction).
142 * - The types must be built-in protocol buffer types, namely, no sub-messages
143 * are allowed (yet). The bytes type is also not allowed.
144 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800145 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000146 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800147 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000148 * - A field that is a uid should be a string field, tagged with the [xxx]
149 * annotation. The generated code on android will be represented by UIDs,
150 * and those UIDs will be translated in xxx to those strings.
151 *
152 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700153 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000154 * - If there is a UID, it goes first. Think in an object-oriented fashion.
155 * *****************************************************************************
156 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700157
Yao Chend54f9dd2017-10-17 17:37:48 +0000158/**
159 * Logs when the screen state changes.
160 *
161 * Logged from:
162 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
163 */
164message ScreenStateChanged {
165 // TODO: Use the real screen state.
166 enum State {
167 STATE_UNKNOWN = 0;
168 STATE_OFF = 1;
169 STATE_ON = 2;
170 STATE_DOZE = 3;
171 STATE_DOZE_SUSPEND = 4;
172 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800173 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000174 }
175 // New screen state.
176 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700177}
Yao Chend54f9dd2017-10-17 17:37:48 +0000178
179/**
Bookatzc1a050a2017-10-10 15:49:28 -0700180 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 *
182 * Logged from:
183 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
184 */
Bookatzc1a050a2017-10-10 15:49:28 -0700185message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000186 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
187
Bookatzdb026a22018-01-10 19:01:56 -0800188 // The state, from frameworks/base/core/proto/android/app/enums.proto.
189 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000190}
191
192/**
Bookatzc1a050a2017-10-10 15:49:28 -0700193 * Logs that a process started, finished, crashed, or ANRed.
194 *
195 * Logged from:
196 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
197 */
198message ProcessLifeCycleStateChanged {
199 // TODO: Use the real (mapped) process states.
200 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
201
202 // TODO: What is this?
203 optional string name = 2;
204
Bookatzddccf0a2017-11-28 16:48:14 -0800205 // What lifecycle state the process changed to.
206 // This enum is specific to atoms.proto.
207 enum Event {
208 PROCESS_FINISHED = 0;
209 PROCESS_STARTED = 1;
210 PROCESS_CRASHED = 2;
211 PROCESS_ANRED = 3;
212 }
213 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700214}
215
Bookatzc1a050a2017-10-10 15:49:28 -0700216/**
217 * Logs when the ble scan state changes.
218 *
219 * Logged from:
220 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
221 */
222message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800223 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700224
225 enum State {
226 OFF = 0;
227 ON = 1;
228 }
229 optional State state = 2;
230}
231
232/**
233 * Logs when an unoptimized ble scan state changes.
234 *
235 * Logged from:
236 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
237 */
238// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
239message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800240 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700241
242 enum State {
243 OFF = 0;
244 ON = 1;
245 }
246 optional State state = 2;
247}
248
249/**
250 * Logs reporting of a ble scan finding results.
251 *
252 * Logged from:
253 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
254 */
255// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
256message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800257 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700258
259 // Number of ble scan results returned.
260 optional int32 num_of_results = 2;
261}
262
263/**
264 * Logs when a sensor state changes.
265 *
266 * Logged from:
267 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
268 */
269message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800270 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700271
272 // TODO: Is there a way to get the actual name of the sensor?
273 // The id (int) of the sensor.
274 optional int32 sensor_id = 2;
275
276 enum State {
277 OFF = 0;
278 ON = 1;
279 }
280 optional State state = 3;
281}
282
283
284/**
285 * Logs when GPS state changes.
286 *
287 * Logged from:
288 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
289 */
290message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800291 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700292
293 enum State {
294 OFF = 0;
295 ON = 1;
296 }
297 optional State state = 2;
298}
299
300
301/**
302 * Logs when a sync manager sync state changes.
303 *
304 * Logged from:
305 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
306 */
307message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800308 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700309
310 // Name of the sync (as named in the app)
311 optional string name = 2;
312
313 enum State {
314 OFF = 0;
315 ON = 1;
316 }
317 optional State state = 3;
318}
319
320/**
321 * Logs when a job scheduler job state changes.
322 *
323 * Logged from:
324 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
325 */
326message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800327 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700328
329 // Name of the job (as named in the app)
330 optional string name = 2;
331
332 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800333 FINISHED = 0;
334 STARTED = 1;
335 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700336 }
337 optional State state = 3;
338
339 // TODO: Consider adding the stopReason (int)
340}
341
342/**
343 * Logs when the audio state changes.
344 *
345 * Logged from:
346 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
347 */
348message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800349 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700350
351 enum State {
352 OFF = 0;
353 ON = 1;
354 }
355 optional State state = 2;
356}
357
358/**
359 * Logs when the video codec state changes.
360 *
361 * Logged from:
362 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
363 */
364message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800365 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700366
367 enum State {
368 OFF = 0;
369 ON = 1;
370 }
371 optional State state = 2;
372}
373
374/**
375 * Logs when the flashlight state changes.
376 *
377 * Logged from:
378 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
379 */
380message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800381 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700382
383 enum State {
384 OFF = 0;
385 ON = 1;
386 }
387 optional State state = 2;
388}
389
390/**
391 * Logs when the camera state changes.
392 *
393 * Logged from:
394 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
395 */
396message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800397 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700398
399 enum State {
400 OFF = 0;
401 ON = 1;
402 }
403 optional State state = 2;
404}
405
406/**
407 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000408 *
409 * Logged from:
410 * TODO
411 */
Bookatzd6746242017-10-24 18:39:35 -0700412message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800413 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000414
Bookatzc1a050a2017-10-10 15:49:28 -0700415 // Type of wakelock.
416 enum Type {
417 PARTIAL = 0;
418 FULL = 1;
419 WINDOW = 2;
420 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800421 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
423 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
424 optional string tag = 3;
425
426 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800427 RELEASE = 0;
428 ACQUIRE = 1;
429 CHANGE_RELEASE = 2;
430 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700431 }
432 optional State state = 4;
433}
434
435/**
Bookatzc1a050a2017-10-10 15:49:28 -0700436 * Logs when a partial wakelock is considered 'long' (over 1 min).
437 *
438 * Logged from:
439 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
440 */
441message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800442 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700443
Yao Chend54f9dd2017-10-17 17:37:48 +0000444 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
445 optional string tag = 2;
446
Bookatzc1a050a2017-10-10 15:49:28 -0700447 // TODO: I have no idea what this is.
448 optional string history_tag = 3;
449
450 enum State {
451 OFF = 0;
452 ON = 1;
453 }
454 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000455}
456
Bookatzc1a050a2017-10-10 15:49:28 -0700457/**
458 * Logs Battery Saver state change.
459 *
460 * Logged from:
461 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
462 */
463message BatterySaverModeStateChanged {
464 enum State {
465 OFF = 0;
466 ON = 1;
467 }
468 optional State state = 1;
469}
470
471/**
472 * Logs Doze mode state change.
473 *
474 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800475 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700476 */
477message DeviceIdleModeStateChanged {
478 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800479 enum State {
480 DEVICE_IDLE_MODE_OFF = 0;
481 DEVICE_IDLE_MODE_LIGHT = 1;
482 DEVICE_IDLE_MODE_DEEP = 2;
483 }
484 optional State state = 1;
485}
486
487
488/**
489 * Logs state change of Doze mode including maintenance windows.
490 *
491 * Logged from:
492 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
493 */
494message DeviceIdlingModeStateChanged {
495 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
496 enum State {
497 DEVICE_IDLE_MODE_OFF = 0;
498 DEVICE_IDLE_MODE_LIGHT = 1;
499 DEVICE_IDLE_MODE_DEEP = 2;
500 }
501 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700502}
503
504/**
505 * Logs screen brightness level.
506 *
507 * Logged from:
508 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
509 */
510message ScreenBrightnessChanged {
511 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
512 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700513}
514
515/**
516 * Logs battery level (percent full, from 0 to 100).
517 *
518 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700519 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700520 */
521message BatteryLevelChanged {
522 // Battery level. Should be in [0, 100].
523 optional int32 battery_level = 1;
524}
525
526/**
527 * Logs change in charging status of the device.
528 *
529 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700530 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700531 */
532message ChargingStateChanged {
533 // TODO: Link directly to BatteryManager.java's constants (via a proto).
534 enum State {
535 BATTERY_STATUS_UNKNOWN = 1;
536 BATTERY_STATUS_CHARGING = 2;
537 BATTERY_STATUS_DISCHARGING = 3;
538 BATTERY_STATUS_NOT_CHARGING = 4;
539 BATTERY_STATUS_FULL = 5;
540 }
541 optional State charging_state = 1;
542}
543
544/**
545 * Logs whether the device is plugged in, and what power source it is using.
546 *
547 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700548 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700549 */
550message PluggedStateChanged {
551 // TODO: Link directly to BatteryManager.java's constants (via a proto).
552 enum State {
553 // Note that NONE is not in BatteryManager.java's constants.
554 BATTERY_PLUGGED_NONE = 0;
555 // Power source is an AC charger.
556 BATTERY_PLUGGED_AC = 1;
557 // Power source is a USB port.
558 BATTERY_PLUGGED_USB = 2;
559 // Power source is wireless.
560 BATTERY_PLUGGED_WIRELESS = 4;
561 }
562 optional State plugged_state = 1;
563}
564
565/**
566 * Logs the temperature of the device, in tenths of a degree Celsius.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message DeviceTemperatureReported {
572 // Temperature in tenths of a degree C.
573 optional int32 temperature = 1;
574}
575
576// TODO: Define this more precisely.
577// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
578/**
579 * Logs when the device turns off or on.
580 *
581 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700582 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700583 */
584message DeviceOnStatusChanged {
585 enum State {
586 OFF = 0;
587 ON = 1;
588 }
589 optional State state = 1;
590}
591
592/**
593 * Logs when an app's wakeup alarm fires.
594 *
595 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700596 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700597 */
598message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800599 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800600
601 // Name of the wakeup alarm.
602 optional string tag = 2;
603}
604
605/**
606 * Logs when an an app causes the mobile radio to change state.
607 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
608 *
609 * Logged from:
610 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
611 */
612message MobileRadioPowerStateChanged {
613 // TODO: Add attribution instead of uid?
614 optional int32 uid = 1;
615
616 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
617 enum PowerState {
618 DC_POWER_STATE_LOW = 1;
619 DC_POWER_STATE_MEDIUM = 2;
620 DC_POWER_STATE_HIGH = 3;
621 }
622 optional PowerState power_state = 2;
623}
624
625/**
626 * Logs when an an app causes the wifi radio to change state.
627 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
628 *
629 * Logged from:
630 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
631 */
632message WifiRadioPowerStateChanged {
633 // TODO: Add attribution instead of uid?
634 optional int32 uid = 1;
635
636 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
637 enum PowerState {
638 DC_POWER_STATE_LOW = 1;
639 DC_POWER_STATE_MEDIUM = 2;
640 DC_POWER_STATE_HIGH = 3;
641 }
642 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700643}
644
645/**
646 * Logs kernel wakeup reasons and aborts.
647 *
648 * Logged from:
649 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
650 */
651message KernelWakeupReported {
652 // Name of the kernel wakeup reason (or abort).
653 optional string wakeup_reason_name = 1;
654
655 // Duration (in microseconds) for the wake-up interrupt to be serviced.
656 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700657}
658
659/**
660 * Logs wifi locks held by an app.
661 *
662 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700663 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700664 */
665message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800666 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700667
668 enum State {
669 OFF = 0;
670 ON = 1;
671 }
672 optional State state = 2;
673}
674
675/**
676 * Logs wifi signal strength changes.
677 *
678 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700679 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700680 */
681message WifiSignalStrengthChanged {
682 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
683 enum SignalStrength {
684 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
685 SIGNAL_STRENGTH_POOR = 1;
686 SIGNAL_STRENGTH_MODERATE = 2;
687 SIGNAL_STRENGTH_GOOD = 3;
688 SIGNAL_STRENGTH_GREAT = 4;
689 }
690 optional SignalStrength signal_strength = 1;
691}
692
693/**
694 * Logs wifi scans performed by an app.
695 *
696 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700697 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700698 */
699message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800700 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700701
702 enum State {
703 OFF = 0;
704 ON = 1;
705 }
706 optional State state = 2;
707}
708
709/**
Tej Singh4503e102018-01-04 14:35:01 -0800710 * Logs wifi multicast locks held by an app
711 *
712 * Logged from:
713 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
714 */
715message WifiMulticastLockStateChanged {
716 repeated AttributionNode attribution_node = 1;
717
718 enum State {
719 OFF = 0;
720 ON = 1;
721 }
722 optional State state = 2;
723}
724
725/**
Bookatze5885242017-10-24 20:10:31 -0700726 * Logs phone signal strength changes.
727 *
728 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700729 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700730 */
731message PhoneSignalStrengthChanged {
732 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
733 enum SignalStrength {
734 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
735 SIGNAL_STRENGTH_POOR = 1;
736 SIGNAL_STRENGTH_MODERATE = 2;
737 SIGNAL_STRENGTH_GOOD = 3;
738 SIGNAL_STRENGTH_GREAT = 4;
739 }
740 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700741}
742
743/**
744 * Logs that a setting was updated.
745 * Logged from:
746 * frameworks/base/core/java/android/provider/Settings.java
747 * The tag and is_default allow resetting of settings to default values based on the specified
748 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
749 */
750message SettingChanged {
751 // The name of the setting.
752 optional string setting = 1;
753
754 // The change being imposed on this setting. May represent a number, eg "3".
755 optional string value = 2;
756
757 // The new value of this setting. For most settings, this is same as value. For some settings,
758 // value is +X or -X where X represents an element in a set. For example, if the previous value
759 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
760 // The +/- feature is currently only used for location_providers_allowed.
761 optional string new_value = 3;
762
763 // The previous value of this setting.
764 optional string prev_value = 4;
765
766 // The tag used with the is_default for resetting sets of settings. This is generally null.
767 optional string tag = 5;
768
769 // 1 indicates that this setting with tag should be resettable.
770 optional int32 is_default = 6;
771
772 // The user ID associated. Defined in android/os/UserHandle.java
773 optional int32 user = 7;
774}
Chenjie Yub3dda412017-10-24 13:41:59 -0700775
Chenjie Yu05013b32017-11-21 10:21:41 -0800776/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700777 * Logs activity going to foreground or background
778 *
779 * Logged from:
780 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
781 */
782message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800783 optional int32 uid = 1;
784 optional string pkg_name = 2;
785 optional string class_name = 3;
786
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700787 enum Activity {
788 MOVE_TO_BACKGROUND = 0;
789 MOVE_TO_FOREGROUND = 1;
790 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700791 optional Activity activity = 4;
792}
David Chenc8a43242017-10-17 16:23:28 -0700793
794/**
David Chen9e3808c2017-11-20 17:25:34 -0800795 * Logs when an error is written to dropbox.
796 * Logged from:
797 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
798 */
799message DropboxErrorChanged {
800 // The uid if available. -1 means not available.
801 optional int32 uid = 1;
802
803 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
804 optional string tag = 2;
805
806 // The name of the process.
807 optional string process_name = 3;
808
809 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800810 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800811
812 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800813 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800814
815 // The activity name if available.
816 optional string activity_name = 6;
817
David Chen6e3e6cb2018-01-03 16:14:06 -0800818 // The package name if available.
819 optional string package_name = 7;
820
David Chen9e3808c2017-11-20 17:25:34 -0800821 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800822 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800823}
824
David Chen0a368b22017-12-06 16:28:16 -0800825/*
826 * Allows other apps to push events into statsd.
827 * Logged from:
828 * frameworks/base/core/java/android/util/StatsLog.java
829 */
830message AppHook {
831 // The uid of the application that sent this custom atom.
832 optional int32 uid = 1;
833
834 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
835 optional int32 label = 2;
836
837 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
838 // predicates for the metrics).
839 enum State {
840 UNKNOWN = 0;
841 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
842 STOP = 2;
843 START = 3;
844 }
845 optional State state = 3;
846}
847
David Chen9e3808c2017-11-20 17:25:34 -0800848/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800849 * Logs when statsd detects an anomaly.
850 *
851 * Logged from:
852 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
853 */
854message AnomalyDetected {
855 // Uid that owns the config whose anomaly detection alert fired.
856 optional int32 config_uid = 1;
857
Yangster-mac94e197c2018-01-02 16:03:03 -0800858 // Id of the config whose anomaly detection alert fired.
859 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800860
Yangster-mac94e197c2018-01-02 16:03:03 -0800861 // Id of the alert (i.e. name of the anomaly that was detected).
862 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800863}
864
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000865message AppStartChanged {
866 // The uid if available. -1 means not available.
867 optional int32 uid = 1;
868
869 // The app package name.
870 optional string pkg_name = 2;
871
872 enum TransitionType {
873 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
874 WARM = 1;
875 HOT = 2;
876 COLD = 3;
877 }
878 // The transition type.
879 optional TransitionType type = 3;
880
881 // The activity name.
882 optional string activity_name = 4;
883
884 // The name of the calling app. Empty if not set.
885 optional string calling_pkg_name = 5;
886
887 // Whether the app is an instant app.
888 optional bool is_instant_app = 6;
889
890 // Device uptime when activity started.
891 optional int64 activity_start_msec = 7;
892
Bookatz80d11a02018-01-16 10:46:35 -0800893 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000894
895 optional int32 transition_delay_msec = 9;
896 // -1 if not set.
897 optional int32 starting_window_delay_msec = 10;
898 // -1 if not set.
899 optional int32 bind_application_delay_msec = 11;
900 optional int32 windows_drawn_delay_msec = 12;
901
902 // Empty if not set.
903 optional string launch_token = 13;
904
905}
906
907message AppStartCancelChanged {
908 // The uid if available. -1 means not available.
909 optional int32 uid = 1;
910
911 // The app package name.
912 optional string pkg_name = 2;
913
914 enum TransitionType {
915 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
916 WARM = 1;
917 HOT = 2;
918 COLD = 3;
919 }
920 // The transition type.
921 optional TransitionType type = 3;
922
923 // The activity name.
924 optional string activity_name = 4;
925}
926
927message AppStartFullyDrawnChanged {
928 // The uid if available. -1 means not available.
929 optional int32 uid = 1;
930
931 // The app package name.
932 optional string pkg_name = 2;
933
934 enum TransitionType {
935 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
936 WITH_BUNDLE = 1;
937 WITHOUT_BUNDLE = 2;
938 }
939 // The transition type.
940 optional TransitionType type = 3;
941
942 // The activity name.
943 optional string activity_name = 4;
944
945 optional bool transition_process_running = 5;
946
947 // App startup time (until call to Activity#reportFullyDrawn()).
948 optional int64 app_startup_time_ms = 6;
949}
950
Bookatz8fcd09a2017-12-18 13:01:10 -0800951/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800952 * Logs a picture-in-picture action
953 * Logged from:
954 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
955 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
956 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
957 */
958message PictureInPictureStateChanged {
959 optional int32 uid = 1;
960
961 optional string package_name = 2;
962
963 optional string class_name = 3;
964
965 // Picture-in-Picture action occurred, similar to
966 // frameworks/base/proto/src/metrics_constants.proto
967 enum State {
968 ENTERED = 1;
969 EXPANDED_TO_FULL_SCREEN = 2;
970 MINIMIZED = 3;
971 DISMISSED = 4;
972 }
973 optional State state = 4;
974}
975
976/**
David Chenc8a43242017-10-17 16:23:28 -0700977 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
978 *
979 * Pulled from:
980 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
981 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800982message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700983 optional int32 uid = 1;
984
985 optional int64 rx_bytes = 2;
986
987 optional int64 rx_packets = 3;
988
989 optional int64 tx_bytes = 4;
990
991 optional int64 tx_packets = 5;
992}
993
994/**
995 * Pulls bytes transferred via wifi (separated by foreground and background usage).
996 *
997 * Pulled from:
998 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
999 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001000message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001001 optional int32 uid = 1;
1002
1003 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1004 optional int32 is_foreground = 2;
1005
1006 optional int64 rx_bytes = 3;
1007
1008 optional int64 rx_packets = 4;
1009
1010 optional int64 tx_bytes = 5;
1011
1012 optional int64 tx_packets = 6;
1013}
1014
1015/**
1016 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1017 *
1018 * Pulled from:
1019 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1020 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001021message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001022 optional int32 uid = 1;
1023
1024 optional int64 rx_bytes = 2;
1025
1026 optional int64 rx_packets = 3;
1027
1028 optional int64 tx_bytes = 4;
1029
1030 optional int64 tx_packets = 5;
1031}
1032
1033/**
1034 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1035 *
1036 * Pulled from:
1037 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1038 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001039message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001040 optional int32 uid = 1;
1041
1042 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1043 optional int32 is_foreground = 2;
1044
1045 optional int64 rx_bytes = 3;
1046
1047 optional int64 rx_packets = 4;
1048
1049 optional int64 tx_bytes = 5;
1050
1051 optional int64 tx_packets = 6;
1052}
1053
1054/**
1055 * Pulls the kernel wakelock durations. This atom is adapted from
1056 * android/internal/os/KernelWakelockStats.java
1057 *
1058 * Pulled from:
1059 * StatsCompanionService using KernelWakelockReader.
1060 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001061message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001062 optional string name = 1;
1063
1064 optional int32 count = 2;
1065
1066 optional int32 version = 3;
1067
1068 optional int64 time = 4;
1069}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001070
Chenjie Yu05013b32017-11-21 10:21:41 -08001071/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001072 * Pulls low power state information. This includes platform and subsystem sleep state information,
1073 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001074 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001075 * hardware/interfaces/power/1.1/types.hal
1076 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001077message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001078 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1079 // YYY is corresponding voter name.
1080 // If there are no voters, the format should just be XXX (with no dot).
1081 // XXX and YYY should not contain a "." in it.
1082 optional string name = 1;
1083 // The number of times it entered, or voted for entering the sleep state
1084 optional uint64 count = 2;
1085 // The length of time spent in, or spent voting for, the sleep state
1086 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001087}
David Chen21582962017-11-01 17:32:46 -07001088
1089/**
1090 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1091 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1092 * attributed back to the parent (host) uid. One example is Chrome.
1093 *
1094 * Logged from:
1095 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1096 */
1097message IsolatedUidChanged {
1098 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1099 optional int32 parent_uid = 1;
1100
1101 optional int32 isolated_uid = 2;
1102
1103 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1104 // be removed before if it's used for another parent uid.
1105 optional int32 is_create = 3;
1106}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001107
Chenjie Yu05013b32017-11-21 10:21:41 -08001108/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001109 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001110 * Pulls the time the cpu spend on the frequency index. Frequency index
1111 * starts from highest to lowest. The value should be monotonically
1112 * increasing since boot. However, if there is a cpu
1113 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001114 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001115message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001116 optional uint32 cluster = 1;
1117 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001118 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001119}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001120
Chenjie Yu05013b32017-11-21 10:21:41 -08001121/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001122 * Pulls Cpu Time Per Uid.
1123 * Note that isolated process uid time should be attributed to host uids.
1124 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001125message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001126 optional uint64 uid = 1;
1127 optional uint64 user_time_ms = 2;
1128 optional uint64 sys_time_ms = 3;
1129}
1130
1131/**
1132 * Pulls Cpu Time Per Uid per frequency.
1133 * Note that isolated process uid time should be attributed to host uids.
1134 * For each uid, we order the time by descending frequencies.
1135 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001136message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001137 optional uint64 uid = 1;
1138 optional uint64 freq_idx = 2;
1139 optional uint64 time_ms = 3;
1140}
Hugo Benichi884970e2017-11-14 22:42:46 +09001141
1142/*
1143 * Logs the reception of an incoming network packet causing the main system to wake up for
1144 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1145 * and processed by WakeupController.cpp.
1146 */
1147message PacketWakeupOccurred {
1148 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1149 // delivered nowhere.
1150 optional int32 uid = 1;
1151 // The interface name on which the packet was received.
1152 optional string iface = 2;
1153 // The ethertype value of the packet.
1154 optional int32 ethertype = 3;
1155 // String representation of the destination MAC address of the packet.
1156 optional string destination_hardware_address = 4;
1157 // String representation of the source address of the packet if this was an IP packet.
1158 optional string source_ip = 5;
1159 // String representation of the destination address of the packet if this was an IP packet.
1160 optional string destination_ip = 6;
1161 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1162 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1163 // families.
1164 optional int32 ip_next_header = 7;
1165 // The source port if this was a TCP or UDP packet.
1166 optional int32 source_port = 8;
1167 // The destination port if this was a TCP or UDP packet.
1168 optional int32 destination_port = 9;
1169}
Chenjie Yu05013b32017-11-21 10:21:41 -08001170
1171/**
1172 * Pulls Wifi Controller Activity Energy Info
1173 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001174message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001175 // timestamp(wall clock) of record creation
1176 optional uint64 timestamp_ms = 1;
1177 // stack reported state
1178 // TODO: replace this with proto enum
1179 optional int32 stack_state = 2;
1180 // tx time in ms
1181 optional uint64 controller_tx_time_ms = 3;
1182 // rx time in ms
1183 optional uint64 controller_rx_time_ms = 4;
1184 // idle time in ms
1185 optional uint64 controller_idle_time_ms = 5;
1186 // product of current(mA), voltage(V) and time(ms)
1187 optional uint64 controller_energy_used = 6;
1188}
1189
1190/**
1191 * Pulls Modem Activity Energy Info
1192 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001193message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001194 // timestamp(wall clock) of record creation
1195 optional uint64 timestamp_ms = 1;
1196 // sleep time in ms.
1197 optional uint64 sleep_time_ms = 2;
1198 // idle time in ms
1199 optional uint64 controller_idle_time_ms = 3;
1200 /**
1201 * Tx power index
1202 * index 0 = tx_power < 0dBm
1203 * index 1 = 0dBm < tx_power < 5dBm
1204 * index 2 = 5dBm < tx_power < 15dBm
1205 * index 3 = 15dBm < tx_power < 20dBm
1206 * index 4 = tx_power > 20dBm
1207 */
1208 // tx time in ms at power level 0
1209 optional uint64 controller_tx_time_pl0_ms = 4;
1210 // tx time in ms at power level 1
1211 optional uint64 controller_tx_time_pl1_ms = 5;
1212 // tx time in ms at power level 2
1213 optional uint64 controller_tx_time_pl2_ms = 6;
1214 // tx time in ms at power level 3
1215 optional uint64 controller_tx_time_pl3_ms = 7;
1216 // tx time in ms at power level 4
1217 optional uint64 controller_tx_time_pl4_ms = 8;
1218 // rx time in ms at power level 5
1219 optional uint64 controller_rx_time_ms = 9;
1220 // product of current(mA), voltage(V) and time(ms)
1221 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001222}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001223
1224/*
1225 * Logs the memory stats for a process
1226 */
Rajeev Kumar27572b92018-01-23 16:12:51 -08001227message ProcessMemoryStat {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001228 // The uid if available. -1 means not available.
1229 optional int32 uid = 1;
1230
Rajeev Kumar27572b92018-01-23 16:12:51 -08001231 // The process name.
1232 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001233
1234 // # of page-faults
1235 optional int64 pgfault = 3;
1236
1237 // # of major page-faults
1238 optional int64 pgmajfault = 4;
1239
1240 // RSS+CACHE(+SWAP)
1241 optional int64 usage_in_bytes = 5;
1242}
1243
1244/*
1245 * Logs the event when LMKD kills a process to reduce memory pressure
1246 * Logged from:
1247 * system/core/lmkd/lmkd.c
1248 */
1249message LmkEventOccurred {
1250 // The uid if available. -1 means not available.
1251 optional int32 uid = 1;
1252
Rajeev Kumar27572b92018-01-23 16:12:51 -08001253 // The process name.
1254 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001255
1256 // oom adj score.
1257 optional int32 oom_score = 3;
1258
Rajeev Kumar27572b92018-01-23 16:12:51 -08001259 // # of page-faults
1260 optional int64 pgfault = 4;
1261
1262 // # of major page-faults
1263 optional int64 pgmajfault = 5;
1264
1265 // RSS+CACHE(+SWAP)
1266 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001267}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001268
1269/*
1270 * Cpu syspend time for cpu power calculation.
1271 */
1272message CpuSuspendTime {
1273 optional uint64 time = 1;
1274}
1275
1276/*
1277 * Cpu idle time for cpu power calculation.
1278 */
1279message CpuIdleTime {
1280 optional uint64 time = 1;
1281}
1282
1283/*
1284 * Reads from /proc/uid_concurrent_active_time which has the format:
1285 * active: X (X is # cores)
1286 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1287 * [uid1]: [time-0] [time-1] [time-2] ... ...
1288 * ...
1289 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1290 * The file contains a monotonically increasing count of time for a single boot.
1291 */
1292message CpuActiveTime {
1293 optional uint64 uid = 1;
1294 optional uint64 idx = 2;
1295 optional uint64 time_ms = 3;
1296}
1297
1298/**
1299 * Reads from /proc/uid_concurrent_policy_time which has the format:
1300 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1301 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1302 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1303 * ...
1304 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1305 * The file contains a monotonically increasing count of time for a single boot.
1306 */
1307message CpuClusterTime {
1308 optional uint64 uid = 1;
1309 optional uint64 idx = 2;
1310 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001311}
1312
1313/*
1314 * Pulls free disk space, for data, system partition and temporary directory.
1315 */
1316message DiskSpace {
1317 // available bytes in data partition
1318 optional uint64 data_available_bytes = 1;
1319 // available bytes in system partition
1320 optional uint64 system_available_bytes = 2;
1321 // available bytes in download cache or temp directories
1322 optional uint64 temp_available_bytes = 3;
1323}
1324
1325/*
1326 * Pulls system up time.
1327 */
1328message SystemUptime {
1329 // Milliseconds since the system was booted.
1330 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1331 // for external input).
1332 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1333 optional uint64 uptime_ms = 1;
Tej Singh4503e102018-01-04 14:35:01 -08001334}