blob: 9721cb88176385d1fd50d8ad459191f16976250a [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
Joe Onorato62c220b2017-11-18 20:32:56 -080024import "frameworks/base/core/proto/android/app/activitymanager.proto";
25
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;
47 GpsScanStateChanged gps_scan_state_changed = 6; // TODO: untested
48 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;
Bookatzc1a050a2017-10-10 15:49:28 -070088 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000089 }
David Chenc8a43242017-10-17 16:23:28 -070090
David Chen6e3e6cb2018-01-03 16:14:06 -080091 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070092 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080093 WifiBytesTransfer wifi_bytes_transfer = 10000;
94 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
95 MobileBytesTransfer mobile_bytes_transfer = 10002;
96 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
97 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -080098 SubsystemSleepState subsystem_sleep_state = 10005;
99 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800100 CpuTimePerFreq cpu_time_per_freq = 10008;
101 CpuTimePerUid cpu_time_per_uid = 10009;
102 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
103 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
104 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -0800105 MemoryStat memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800106 CpuSuspendTime cpu_suspend_time = 10014;
107 CpuIdleTime cpu_idle_time = 10015;
108 CpuActiveTime cpu_active_time = 10016;
109 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800110 DiskSpace disk_space = 10018;
111 SystemUptime system_uptime = 10019;
David Chenc8a43242017-10-17 16:23:28 -0700112 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700113}
114
Yao Chend54f9dd2017-10-17 17:37:48 +0000115/**
Yangster-mac20877162017-12-22 17:19:39 -0800116 * This proto represents a node of an attribution chain.
117 * Note: All attribution chains are represented as a repeated field of type
118 * AttributionNode. It is understood that in such arrays, the order is that
119 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000120 */
Yangster-mac20877162017-12-22 17:19:39 -0800121message AttributionNode {
122 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800123 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800124
Yangster-mac20877162017-12-22 17:19:39 -0800125 // The (optional) string tag for an element in the attribution chain. If the
126 // element has no tag, it is encoded as an empty string.
127 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700128}
129
Yao Chend54f9dd2017-10-17 17:37:48 +0000130/*
131 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800132 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000133 *
134 * RULES:
135 * - The field ids for each atom must start at 1, and count upwards by 1.
136 * Skipping field ids is not allowed.
137 * - These form an API, so renaming, renumbering or removing fields is
138 * not allowed between android releases. (This is not currently enforced,
139 * but there will be a tool to enforce this restriction).
140 * - The types must be built-in protocol buffer types, namely, no sub-messages
141 * are allowed (yet). The bytes type is also not allowed.
142 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800143 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000144 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800145 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000146 * - A field that is a uid should be a string field, tagged with the [xxx]
147 * annotation. The generated code on android will be represented by UIDs,
148 * and those UIDs will be translated in xxx to those strings.
149 *
150 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700151 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000152 * - If there is a UID, it goes first. Think in an object-oriented fashion.
153 * *****************************************************************************
154 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700155
Yao Chend54f9dd2017-10-17 17:37:48 +0000156/**
157 * Logs when the screen state changes.
158 *
159 * Logged from:
160 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
161 */
162message ScreenStateChanged {
163 // TODO: Use the real screen state.
164 enum State {
165 STATE_UNKNOWN = 0;
166 STATE_OFF = 1;
167 STATE_ON = 2;
168 STATE_DOZE = 3;
169 STATE_DOZE_SUSPEND = 4;
170 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800171 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 }
173 // New screen state.
174 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700175}
Yao Chend54f9dd2017-10-17 17:37:48 +0000176
177/**
Bookatzc1a050a2017-10-10 15:49:28 -0700178 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 *
180 * Logged from:
181 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
182 */
Bookatzc1a050a2017-10-10 15:49:28 -0700183message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
185
186 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700187 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800188 optional android.app.ProcessState state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000189}
190
191/**
Bookatzc1a050a2017-10-10 15:49:28 -0700192 * Logs that a process started, finished, crashed, or ANRed.
193 *
194 * Logged from:
195 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
196 */
197message ProcessLifeCycleStateChanged {
198 // TODO: Use the real (mapped) process states.
199 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
200
201 // TODO: What is this?
202 optional string name = 2;
203
Bookatzddccf0a2017-11-28 16:48:14 -0800204 // What lifecycle state the process changed to.
205 // This enum is specific to atoms.proto.
206 enum Event {
207 PROCESS_FINISHED = 0;
208 PROCESS_STARTED = 1;
209 PROCESS_CRASHED = 2;
210 PROCESS_ANRED = 3;
211 }
212 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700213}
214
Bookatzc1a050a2017-10-10 15:49:28 -0700215/**
216 * Logs when the ble scan state changes.
217 *
218 * Logged from:
219 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
220 */
221message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800222 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700223
224 enum State {
225 OFF = 0;
226 ON = 1;
227 }
228 optional State state = 2;
229}
230
231/**
232 * Logs when an unoptimized ble scan state changes.
233 *
234 * Logged from:
235 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
236 */
237// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
238message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800239 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700240
241 enum State {
242 OFF = 0;
243 ON = 1;
244 }
245 optional State state = 2;
246}
247
248/**
249 * Logs reporting of a ble scan finding results.
250 *
251 * Logged from:
252 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
253 */
254// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
255message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800256 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700257
258 // Number of ble scan results returned.
259 optional int32 num_of_results = 2;
260}
261
262/**
263 * Logs when a sensor state changes.
264 *
265 * Logged from:
266 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
267 */
268message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800269 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700270
271 // TODO: Is there a way to get the actual name of the sensor?
272 // The id (int) of the sensor.
273 optional int32 sensor_id = 2;
274
275 enum State {
276 OFF = 0;
277 ON = 1;
278 }
279 optional State state = 3;
280}
281
282
283/**
284 * Logs when GPS state changes.
285 *
286 * Logged from:
287 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
288 */
289message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800290 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700291
292 enum State {
293 OFF = 0;
294 ON = 1;
295 }
296 optional State state = 2;
297}
298
299
300/**
301 * Logs when a sync manager sync state changes.
302 *
303 * Logged from:
304 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
305 */
306message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800307 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700308
309 // Name of the sync (as named in the app)
310 optional string name = 2;
311
312 enum State {
313 OFF = 0;
314 ON = 1;
315 }
316 optional State state = 3;
317}
318
319/**
320 * Logs when a job scheduler job state changes.
321 *
322 * Logged from:
323 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
324 */
325message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800326 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700327
328 // Name of the job (as named in the app)
329 optional string name = 2;
330
331 enum State {
332 OFF = 0;
333 ON = 1;
334 }
335 optional State state = 3;
336
337 // TODO: Consider adding the stopReason (int)
338}
339
340/**
341 * Logs when the audio state changes.
342 *
343 * Logged from:
344 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
345 */
346message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800347 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700348
349 enum State {
350 OFF = 0;
351 ON = 1;
352 }
353 optional State state = 2;
354}
355
356/**
357 * Logs when the video codec state changes.
358 *
359 * Logged from:
360 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
361 */
362message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800363 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
365 enum State {
366 OFF = 0;
367 ON = 1;
368 }
369 optional State state = 2;
370}
371
372/**
373 * Logs when the flashlight state changes.
374 *
375 * Logged from:
376 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
377 */
378message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800379 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700380
381 enum State {
382 OFF = 0;
383 ON = 1;
384 }
385 optional State state = 2;
386}
387
388/**
389 * Logs when the camera state changes.
390 *
391 * Logged from:
392 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
393 */
394message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800395 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700396
397 enum State {
398 OFF = 0;
399 ON = 1;
400 }
401 optional State state = 2;
402}
403
404/**
405 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000406 *
407 * Logged from:
408 * TODO
409 */
Bookatzd6746242017-10-24 18:39:35 -0700410message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800411 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000412
Bookatzc1a050a2017-10-10 15:49:28 -0700413 // Type of wakelock.
414 enum Type {
415 PARTIAL = 0;
416 FULL = 1;
417 WINDOW = 2;
418 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800419 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700420
421 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
422 optional string tag = 3;
423
424 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800425 RELEASE = 0;
426 ACQUIRE = 1;
427 CHANGE_RELEASE = 2;
428 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700429 }
430 optional State state = 4;
431}
432
433/**
Bookatzc1a050a2017-10-10 15:49:28 -0700434 * Logs when a partial wakelock is considered 'long' (over 1 min).
435 *
436 * Logged from:
437 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
438 */
439message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800440 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700441
Yao Chend54f9dd2017-10-17 17:37:48 +0000442 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
443 optional string tag = 2;
444
Bookatzc1a050a2017-10-10 15:49:28 -0700445 // TODO: I have no idea what this is.
446 optional string history_tag = 3;
447
448 enum State {
449 OFF = 0;
450 ON = 1;
451 }
452 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000453}
454
Bookatzc1a050a2017-10-10 15:49:28 -0700455/**
456 * Logs Battery Saver state change.
457 *
458 * Logged from:
459 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
460 */
461message BatterySaverModeStateChanged {
462 enum State {
463 OFF = 0;
464 ON = 1;
465 }
466 optional State state = 1;
467}
468
469/**
470 * Logs Doze mode state change.
471 *
472 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800473 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
475message DeviceIdleModeStateChanged {
476 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800477 enum State {
478 DEVICE_IDLE_MODE_OFF = 0;
479 DEVICE_IDLE_MODE_LIGHT = 1;
480 DEVICE_IDLE_MODE_DEEP = 2;
481 }
482 optional State state = 1;
483}
484
485
486/**
487 * Logs state change of Doze mode including maintenance windows.
488 *
489 * Logged from:
490 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
491 */
492message DeviceIdlingModeStateChanged {
493 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
494 enum State {
495 DEVICE_IDLE_MODE_OFF = 0;
496 DEVICE_IDLE_MODE_LIGHT = 1;
497 DEVICE_IDLE_MODE_DEEP = 2;
498 }
499 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700500}
501
502/**
503 * Logs screen brightness level.
504 *
505 * Logged from:
506 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
507 */
508message ScreenBrightnessChanged {
509 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
510 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700511}
512
513/**
514 * Logs battery level (percent full, from 0 to 100).
515 *
516 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700517 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700518 */
519message BatteryLevelChanged {
520 // Battery level. Should be in [0, 100].
521 optional int32 battery_level = 1;
522}
523
524/**
525 * Logs change in charging status of the device.
526 *
527 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700528 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700529 */
530message ChargingStateChanged {
531 // TODO: Link directly to BatteryManager.java's constants (via a proto).
532 enum State {
533 BATTERY_STATUS_UNKNOWN = 1;
534 BATTERY_STATUS_CHARGING = 2;
535 BATTERY_STATUS_DISCHARGING = 3;
536 BATTERY_STATUS_NOT_CHARGING = 4;
537 BATTERY_STATUS_FULL = 5;
538 }
539 optional State charging_state = 1;
540}
541
542/**
543 * Logs whether the device is plugged in, and what power source it is using.
544 *
545 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700546 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700547 */
548message PluggedStateChanged {
549 // TODO: Link directly to BatteryManager.java's constants (via a proto).
550 enum State {
551 // Note that NONE is not in BatteryManager.java's constants.
552 BATTERY_PLUGGED_NONE = 0;
553 // Power source is an AC charger.
554 BATTERY_PLUGGED_AC = 1;
555 // Power source is a USB port.
556 BATTERY_PLUGGED_USB = 2;
557 // Power source is wireless.
558 BATTERY_PLUGGED_WIRELESS = 4;
559 }
560 optional State plugged_state = 1;
561}
562
563/**
564 * Logs the temperature of the device, in tenths of a degree Celsius.
565 *
566 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700567 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700568 */
569message DeviceTemperatureReported {
570 // Temperature in tenths of a degree C.
571 optional int32 temperature = 1;
572}
573
574// TODO: Define this more precisely.
575// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
576/**
577 * Logs when the device turns off or on.
578 *
579 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700580 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700581 */
582message DeviceOnStatusChanged {
583 enum State {
584 OFF = 0;
585 ON = 1;
586 }
587 optional State state = 1;
588}
589
590/**
591 * Logs when an app's wakeup alarm fires.
592 *
593 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700594 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700595 */
596message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800597 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800598
599 // Name of the wakeup alarm.
600 optional string tag = 2;
601}
602
603/**
604 * Logs when an an app causes the mobile radio to change state.
605 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
606 *
607 * Logged from:
608 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
609 */
610message MobileRadioPowerStateChanged {
611 // TODO: Add attribution instead of uid?
612 optional int32 uid = 1;
613
614 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
615 enum PowerState {
616 DC_POWER_STATE_LOW = 1;
617 DC_POWER_STATE_MEDIUM = 2;
618 DC_POWER_STATE_HIGH = 3;
619 }
620 optional PowerState power_state = 2;
621}
622
623/**
624 * Logs when an an app causes the wifi radio to change state.
625 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
626 *
627 * Logged from:
628 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
629 */
630message WifiRadioPowerStateChanged {
631 // TODO: Add attribution instead of uid?
632 optional int32 uid = 1;
633
634 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
635 enum PowerState {
636 DC_POWER_STATE_LOW = 1;
637 DC_POWER_STATE_MEDIUM = 2;
638 DC_POWER_STATE_HIGH = 3;
639 }
640 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700641}
642
643/**
644 * Logs kernel wakeup reasons and aborts.
645 *
646 * Logged from:
647 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
648 */
649message KernelWakeupReported {
650 // Name of the kernel wakeup reason (or abort).
651 optional string wakeup_reason_name = 1;
652
653 // Duration (in microseconds) for the wake-up interrupt to be serviced.
654 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700655}
656
657/**
658 * Logs wifi locks held by an app.
659 *
660 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700661 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700662 */
663message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800664 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700665
666 enum State {
667 OFF = 0;
668 ON = 1;
669 }
670 optional State state = 2;
671}
672
673/**
674 * Logs wifi signal strength changes.
675 *
676 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700677 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700678 */
679message WifiSignalStrengthChanged {
680 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
681 enum SignalStrength {
682 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
683 SIGNAL_STRENGTH_POOR = 1;
684 SIGNAL_STRENGTH_MODERATE = 2;
685 SIGNAL_STRENGTH_GOOD = 3;
686 SIGNAL_STRENGTH_GREAT = 4;
687 }
688 optional SignalStrength signal_strength = 1;
689}
690
691/**
692 * Logs wifi scans performed by an app.
693 *
694 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700695 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700696 */
697message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800698 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700699
700 enum State {
701 OFF = 0;
702 ON = 1;
703 }
704 optional State state = 2;
705}
706
707/**
708 * Logs phone signal strength changes.
709 *
710 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700711 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700712 */
713message PhoneSignalStrengthChanged {
714 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
715 enum SignalStrength {
716 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
717 SIGNAL_STRENGTH_POOR = 1;
718 SIGNAL_STRENGTH_MODERATE = 2;
719 SIGNAL_STRENGTH_GOOD = 3;
720 SIGNAL_STRENGTH_GREAT = 4;
721 }
722 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700723}
724
725/**
726 * Logs that a setting was updated.
727 * Logged from:
728 * frameworks/base/core/java/android/provider/Settings.java
729 * The tag and is_default allow resetting of settings to default values based on the specified
730 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
731 */
732message SettingChanged {
733 // The name of the setting.
734 optional string setting = 1;
735
736 // The change being imposed on this setting. May represent a number, eg "3".
737 optional string value = 2;
738
739 // The new value of this setting. For most settings, this is same as value. For some settings,
740 // value is +X or -X where X represents an element in a set. For example, if the previous value
741 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
742 // The +/- feature is currently only used for location_providers_allowed.
743 optional string new_value = 3;
744
745 // The previous value of this setting.
746 optional string prev_value = 4;
747
748 // The tag used with the is_default for resetting sets of settings. This is generally null.
749 optional string tag = 5;
750
751 // 1 indicates that this setting with tag should be resettable.
752 optional int32 is_default = 6;
753
754 // The user ID associated. Defined in android/os/UserHandle.java
755 optional int32 user = 7;
756}
Chenjie Yub3dda412017-10-24 13:41:59 -0700757
Chenjie Yu05013b32017-11-21 10:21:41 -0800758/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700759 * Logs activity going to foreground or background
760 *
761 * Logged from:
762 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
763 */
764message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800765 optional int32 uid = 1;
766 optional string pkg_name = 2;
767 optional string class_name = 3;
768
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700769 enum Activity {
770 MOVE_TO_BACKGROUND = 0;
771 MOVE_TO_FOREGROUND = 1;
772 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700773 optional Activity activity = 4;
774}
David Chenc8a43242017-10-17 16:23:28 -0700775
776/**
David Chen9e3808c2017-11-20 17:25:34 -0800777 * Logs when an error is written to dropbox.
778 * Logged from:
779 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
780 */
781message DropboxErrorChanged {
782 // The uid if available. -1 means not available.
783 optional int32 uid = 1;
784
785 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
786 optional string tag = 2;
787
788 // The name of the process.
789 optional string process_name = 3;
790
791 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800792 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800793
794 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800795 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800796
797 // The activity name if available.
798 optional string activity_name = 6;
799
David Chen6e3e6cb2018-01-03 16:14:06 -0800800 // The package name if available.
801 optional string package_name = 7;
802
David Chen9e3808c2017-11-20 17:25:34 -0800803 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800804 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800805}
806
David Chen0a368b22017-12-06 16:28:16 -0800807/*
808 * Allows other apps to push events into statsd.
809 * Logged from:
810 * frameworks/base/core/java/android/util/StatsLog.java
811 */
812message AppHook {
813 // The uid of the application that sent this custom atom.
814 optional int32 uid = 1;
815
816 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
817 optional int32 label = 2;
818
819 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
820 // predicates for the metrics).
821 enum State {
822 UNKNOWN = 0;
823 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
824 STOP = 2;
825 START = 3;
826 }
827 optional State state = 3;
828}
829
David Chen9e3808c2017-11-20 17:25:34 -0800830/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800831 * Logs when statsd detects an anomaly.
832 *
833 * Logged from:
834 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
835 */
836message AnomalyDetected {
837 // Uid that owns the config whose anomaly detection alert fired.
838 optional int32 config_uid = 1;
839
Yangster-mac94e197c2018-01-02 16:03:03 -0800840 // Id of the config whose anomaly detection alert fired.
841 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800842
Yangster-mac94e197c2018-01-02 16:03:03 -0800843 // Id of the alert (i.e. name of the anomaly that was detected).
844 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800845}
846
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000847message AppStartChanged {
848 // The uid if available. -1 means not available.
849 optional int32 uid = 1;
850
851 // The app package name.
852 optional string pkg_name = 2;
853
854 enum TransitionType {
855 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
856 WARM = 1;
857 HOT = 2;
858 COLD = 3;
859 }
860 // The transition type.
861 optional TransitionType type = 3;
862
863 // The activity name.
864 optional string activity_name = 4;
865
866 // The name of the calling app. Empty if not set.
867 optional string calling_pkg_name = 5;
868
869 // Whether the app is an instant app.
870 optional bool is_instant_app = 6;
871
872 // Device uptime when activity started.
873 optional int64 activity_start_msec = 7;
874
875 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
876 enum TransitionReason {
877 APP_START_TRANSITION_REASON_UNKNOWN = 0;
878 SPLASH_SCREEN = 1;
879 WINDOWS_DRAWN = 2;
880 TIMEOUT = 3;
881 SNAPSHOT = 4;
882 }
883 optional TransitionReason reason = 8;
884
885 optional int32 transition_delay_msec = 9;
886 // -1 if not set.
887 optional int32 starting_window_delay_msec = 10;
888 // -1 if not set.
889 optional int32 bind_application_delay_msec = 11;
890 optional int32 windows_drawn_delay_msec = 12;
891
892 // Empty if not set.
893 optional string launch_token = 13;
894
895}
896
897message AppStartCancelChanged {
898 // The uid if available. -1 means not available.
899 optional int32 uid = 1;
900
901 // The app package name.
902 optional string pkg_name = 2;
903
904 enum TransitionType {
905 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
906 WARM = 1;
907 HOT = 2;
908 COLD = 3;
909 }
910 // The transition type.
911 optional TransitionType type = 3;
912
913 // The activity name.
914 optional string activity_name = 4;
915}
916
917message AppStartFullyDrawnChanged {
918 // The uid if available. -1 means not available.
919 optional int32 uid = 1;
920
921 // The app package name.
922 optional string pkg_name = 2;
923
924 enum TransitionType {
925 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
926 WITH_BUNDLE = 1;
927 WITHOUT_BUNDLE = 2;
928 }
929 // The transition type.
930 optional TransitionType type = 3;
931
932 // The activity name.
933 optional string activity_name = 4;
934
935 optional bool transition_process_running = 5;
936
937 // App startup time (until call to Activity#reportFullyDrawn()).
938 optional int64 app_startup_time_ms = 6;
939}
940
Bookatz8fcd09a2017-12-18 13:01:10 -0800941/**
David Chenc8a43242017-10-17 16:23:28 -0700942 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
943 *
944 * Pulled from:
945 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
946 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800947message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700948 optional int32 uid = 1;
949
950 optional int64 rx_bytes = 2;
951
952 optional int64 rx_packets = 3;
953
954 optional int64 tx_bytes = 4;
955
956 optional int64 tx_packets = 5;
957}
958
959/**
960 * Pulls bytes transferred via wifi (separated by foreground and background usage).
961 *
962 * Pulled from:
963 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
964 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800965message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700966 optional int32 uid = 1;
967
968 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
969 optional int32 is_foreground = 2;
970
971 optional int64 rx_bytes = 3;
972
973 optional int64 rx_packets = 4;
974
975 optional int64 tx_bytes = 5;
976
977 optional int64 tx_packets = 6;
978}
979
980/**
981 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
982 *
983 * Pulled from:
984 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
985 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800986message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700987 optional int32 uid = 1;
988
989 optional int64 rx_bytes = 2;
990
991 optional int64 rx_packets = 3;
992
993 optional int64 tx_bytes = 4;
994
995 optional int64 tx_packets = 5;
996}
997
998/**
999 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1000 *
1001 * Pulled from:
1002 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1003 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001004message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001005 optional int32 uid = 1;
1006
1007 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1008 optional int32 is_foreground = 2;
1009
1010 optional int64 rx_bytes = 3;
1011
1012 optional int64 rx_packets = 4;
1013
1014 optional int64 tx_bytes = 5;
1015
1016 optional int64 tx_packets = 6;
1017}
1018
1019/**
1020 * Pulls the kernel wakelock durations. This atom is adapted from
1021 * android/internal/os/KernelWakelockStats.java
1022 *
1023 * Pulled from:
1024 * StatsCompanionService using KernelWakelockReader.
1025 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001026message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001027 optional string name = 1;
1028
1029 optional int32 count = 2;
1030
1031 optional int32 version = 3;
1032
1033 optional int64 time = 4;
1034}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001035
Chenjie Yu05013b32017-11-21 10:21:41 -08001036/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001037 * Pulls low power state information. This includes platform and subsystem sleep state information,
1038 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001039 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001040 * hardware/interfaces/power/1.1/types.hal
1041 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001042message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001043 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1044 // YYY is corresponding voter name.
1045 // If there are no voters, the format should just be XXX (with no dot).
1046 // XXX and YYY should not contain a "." in it.
1047 optional string name = 1;
1048 // The number of times it entered, or voted for entering the sleep state
1049 optional uint64 count = 2;
1050 // The length of time spent in, or spent voting for, the sleep state
1051 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001052}
David Chen21582962017-11-01 17:32:46 -07001053
1054/**
1055 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1056 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1057 * attributed back to the parent (host) uid. One example is Chrome.
1058 *
1059 * Logged from:
1060 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1061 */
1062message IsolatedUidChanged {
1063 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1064 optional int32 parent_uid = 1;
1065
1066 optional int32 isolated_uid = 2;
1067
1068 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1069 // be removed before if it's used for another parent uid.
1070 optional int32 is_create = 3;
1071}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001072
Chenjie Yu05013b32017-11-21 10:21:41 -08001073/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001074 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001075 * Pulls the time the cpu spend on the frequency index. Frequency index
1076 * starts from highest to lowest. The value should be monotonically
1077 * increasing since boot. However, if there is a cpu
1078 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001079 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001080message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001081 optional uint32 cluster = 1;
1082 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001083 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001084}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001085
Chenjie Yu05013b32017-11-21 10:21:41 -08001086/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001087 * Pulls Cpu Time Per Uid.
1088 * Note that isolated process uid time should be attributed to host uids.
1089 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001090message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001091 optional uint64 uid = 1;
1092 optional uint64 user_time_ms = 2;
1093 optional uint64 sys_time_ms = 3;
1094}
1095
1096/**
1097 * Pulls Cpu Time Per Uid per frequency.
1098 * Note that isolated process uid time should be attributed to host uids.
1099 * For each uid, we order the time by descending frequencies.
1100 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001101message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001102 optional uint64 uid = 1;
1103 optional uint64 freq_idx = 2;
1104 optional uint64 time_ms = 3;
1105}
Hugo Benichi884970e2017-11-14 22:42:46 +09001106
1107/*
1108 * Logs the reception of an incoming network packet causing the main system to wake up for
1109 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1110 * and processed by WakeupController.cpp.
1111 */
1112message PacketWakeupOccurred {
1113 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1114 // delivered nowhere.
1115 optional int32 uid = 1;
1116 // The interface name on which the packet was received.
1117 optional string iface = 2;
1118 // The ethertype value of the packet.
1119 optional int32 ethertype = 3;
1120 // String representation of the destination MAC address of the packet.
1121 optional string destination_hardware_address = 4;
1122 // String representation of the source address of the packet if this was an IP packet.
1123 optional string source_ip = 5;
1124 // String representation of the destination address of the packet if this was an IP packet.
1125 optional string destination_ip = 6;
1126 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1127 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1128 // families.
1129 optional int32 ip_next_header = 7;
1130 // The source port if this was a TCP or UDP packet.
1131 optional int32 source_port = 8;
1132 // The destination port if this was a TCP or UDP packet.
1133 optional int32 destination_port = 9;
1134}
Chenjie Yu05013b32017-11-21 10:21:41 -08001135
1136/**
1137 * Pulls Wifi Controller Activity Energy Info
1138 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001139message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001140 // timestamp(wall clock) of record creation
1141 optional uint64 timestamp_ms = 1;
1142 // stack reported state
1143 // TODO: replace this with proto enum
1144 optional int32 stack_state = 2;
1145 // tx time in ms
1146 optional uint64 controller_tx_time_ms = 3;
1147 // rx time in ms
1148 optional uint64 controller_rx_time_ms = 4;
1149 // idle time in ms
1150 optional uint64 controller_idle_time_ms = 5;
1151 // product of current(mA), voltage(V) and time(ms)
1152 optional uint64 controller_energy_used = 6;
1153}
1154
1155/**
1156 * Pulls Modem Activity Energy Info
1157 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001158message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001159 // timestamp(wall clock) of record creation
1160 optional uint64 timestamp_ms = 1;
1161 // sleep time in ms.
1162 optional uint64 sleep_time_ms = 2;
1163 // idle time in ms
1164 optional uint64 controller_idle_time_ms = 3;
1165 /**
1166 * Tx power index
1167 * index 0 = tx_power < 0dBm
1168 * index 1 = 0dBm < tx_power < 5dBm
1169 * index 2 = 5dBm < tx_power < 15dBm
1170 * index 3 = 15dBm < tx_power < 20dBm
1171 * index 4 = tx_power > 20dBm
1172 */
1173 // tx time in ms at power level 0
1174 optional uint64 controller_tx_time_pl0_ms = 4;
1175 // tx time in ms at power level 1
1176 optional uint64 controller_tx_time_pl1_ms = 5;
1177 // tx time in ms at power level 2
1178 optional uint64 controller_tx_time_pl2_ms = 6;
1179 // tx time in ms at power level 3
1180 optional uint64 controller_tx_time_pl3_ms = 7;
1181 // tx time in ms at power level 4
1182 optional uint64 controller_tx_time_pl4_ms = 8;
1183 // rx time in ms at power level 5
1184 optional uint64 controller_rx_time_ms = 9;
1185 // product of current(mA), voltage(V) and time(ms)
1186 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001187}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001188
1189/*
1190 * Logs the memory stats for a process
1191 */
1192message MemoryStat {
1193 // The uid if available. -1 means not available.
1194 optional int32 uid = 1;
1195
1196 // The app package name.
1197 optional string pkg_name = 2;
1198
1199 // # of page-faults
1200 optional int64 pgfault = 3;
1201
1202 // # of major page-faults
1203 optional int64 pgmajfault = 4;
1204
1205 // RSS+CACHE(+SWAP)
1206 optional int64 usage_in_bytes = 5;
1207}
1208
1209/*
1210 * Logs the event when LMKD kills a process to reduce memory pressure
1211 * Logged from:
1212 * system/core/lmkd/lmkd.c
1213 */
1214message LmkEventOccurred {
1215 // The uid if available. -1 means not available.
1216 optional int32 uid = 1;
1217
1218 // The app package name.
1219 optional string pkg_name = 2;
1220
1221 // oom adj score.
1222 optional int32 oom_score = 3;
1223
1224 // Used as start/stop boundaries for the event
1225 enum State {
1226 UNKNOWN = 0;
1227 START = 1;
1228 END = 2;
1229 }
1230 optional State state = 4;
1231}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001232
1233/*
1234 * Cpu syspend time for cpu power calculation.
1235 */
1236message CpuSuspendTime {
1237 optional uint64 time = 1;
1238}
1239
1240/*
1241 * Cpu idle time for cpu power calculation.
1242 */
1243message CpuIdleTime {
1244 optional uint64 time = 1;
1245}
1246
1247/*
1248 * Reads from /proc/uid_concurrent_active_time which has the format:
1249 * active: X (X is # cores)
1250 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1251 * [uid1]: [time-0] [time-1] [time-2] ... ...
1252 * ...
1253 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1254 * The file contains a monotonically increasing count of time for a single boot.
1255 */
1256message CpuActiveTime {
1257 optional uint64 uid = 1;
1258 optional uint64 idx = 2;
1259 optional uint64 time_ms = 3;
1260}
1261
1262/**
1263 * Reads from /proc/uid_concurrent_policy_time which has the format:
1264 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1265 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1266 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1267 * ...
1268 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1269 * The file contains a monotonically increasing count of time for a single boot.
1270 */
1271message CpuClusterTime {
1272 optional uint64 uid = 1;
1273 optional uint64 idx = 2;
1274 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001275}
1276
1277/*
1278 * Pulls free disk space, for data, system partition and temporary directory.
1279 */
1280message DiskSpace {
1281 // available bytes in data partition
1282 optional uint64 data_available_bytes = 1;
1283 // available bytes in system partition
1284 optional uint64 system_available_bytes = 2;
1285 // available bytes in download cache or temp directories
1286 optional uint64 temp_available_bytes = 3;
1287}
1288
1289/*
1290 * Pulls system up time.
1291 */
1292message SystemUptime {
1293 // Milliseconds since the system was booted.
1294 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1295 // for external input).
1296 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1297 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001298}