blob: 7d513cd01694de473d7c24e9be52ed4bf9b7770e [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;
Bookatzc1a050a2017-10-10 15:49:28 -070087 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000088 }
David Chenc8a43242017-10-17 16:23:28 -070089
David Chen6e3e6cb2018-01-03 16:14:06 -080090 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070091 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080092 WifiBytesTransfer wifi_bytes_transfer = 10000;
93 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
94 MobileBytesTransfer mobile_bytes_transfer = 10002;
95 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
96 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -080097 SubsystemSleepState subsystem_sleep_state = 10005;
98 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -080099 CpuTimePerFreq cpu_time_per_freq = 10008;
100 CpuTimePerUid cpu_time_per_uid = 10009;
101 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
102 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
103 ModemActivityInfo modem_activity_info = 10012;
David Chenc8a43242017-10-17 16:23:28 -0700104 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700105}
106
Yao Chend54f9dd2017-10-17 17:37:48 +0000107/**
Yangster-mac20877162017-12-22 17:19:39 -0800108 * This proto represents a node of an attribution chain.
109 * Note: All attribution chains are represented as a repeated field of type
110 * AttributionNode. It is understood that in such arrays, the order is that
111 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000112 */
Yangster-mac20877162017-12-22 17:19:39 -0800113message AttributionNode {
114 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800115 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800116
Yangster-mac20877162017-12-22 17:19:39 -0800117 // The (optional) string tag for an element in the attribution chain. If the
118 // element has no tag, it is encoded as an empty string.
119 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700120}
121
Yao Chend54f9dd2017-10-17 17:37:48 +0000122/*
123 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800124 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000125 *
126 * RULES:
127 * - The field ids for each atom must start at 1, and count upwards by 1.
128 * Skipping field ids is not allowed.
129 * - These form an API, so renaming, renumbering or removing fields is
130 * not allowed between android releases. (This is not currently enforced,
131 * but there will be a tool to enforce this restriction).
132 * - The types must be built-in protocol buffer types, namely, no sub-messages
133 * are allowed (yet). The bytes type is also not allowed.
134 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800135 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000136 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800137 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000138 * - A field that is a uid should be a string field, tagged with the [xxx]
139 * annotation. The generated code on android will be represented by UIDs,
140 * and those UIDs will be translated in xxx to those strings.
141 *
142 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700143 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000144 * - If there is a UID, it goes first. Think in an object-oriented fashion.
145 * *****************************************************************************
146 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700147
Yao Chend54f9dd2017-10-17 17:37:48 +0000148/**
149 * Logs when the screen state changes.
150 *
151 * Logged from:
152 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
153 */
154message ScreenStateChanged {
155 // TODO: Use the real screen state.
156 enum State {
157 STATE_UNKNOWN = 0;
158 STATE_OFF = 1;
159 STATE_ON = 2;
160 STATE_DOZE = 3;
161 STATE_DOZE_SUSPEND = 4;
162 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800163 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000164 }
165 // New screen state.
166 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700167}
Yao Chend54f9dd2017-10-17 17:37:48 +0000168
169/**
Bookatzc1a050a2017-10-10 15:49:28 -0700170 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 *
172 * Logged from:
173 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
174 */
Bookatzc1a050a2017-10-10 15:49:28 -0700175message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
177
178 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700179 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800180 optional android.app.ProcessState state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000181}
182
183/**
Bookatzc1a050a2017-10-10 15:49:28 -0700184 * Logs that a process started, finished, crashed, or ANRed.
185 *
186 * Logged from:
187 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
188 */
189message ProcessLifeCycleStateChanged {
190 // TODO: Use the real (mapped) process states.
191 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
192
193 // TODO: What is this?
194 optional string name = 2;
195
Bookatzddccf0a2017-11-28 16:48:14 -0800196 // What lifecycle state the process changed to.
197 // This enum is specific to atoms.proto.
198 enum Event {
199 PROCESS_FINISHED = 0;
200 PROCESS_STARTED = 1;
201 PROCESS_CRASHED = 2;
202 PROCESS_ANRED = 3;
203 }
204 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700205}
206
Bookatzc1a050a2017-10-10 15:49:28 -0700207/**
208 * Logs when the ble scan state changes.
209 *
210 * Logged from:
211 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
212 */
213message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800214 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700215
216 enum State {
217 OFF = 0;
218 ON = 1;
219 }
220 optional State state = 2;
221}
222
223/**
224 * Logs when an unoptimized ble scan state changes.
225 *
226 * Logged from:
227 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
228 */
229// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
230message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800231 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700232
233 enum State {
234 OFF = 0;
235 ON = 1;
236 }
237 optional State state = 2;
238}
239
240/**
241 * Logs reporting of a ble scan finding results.
242 *
243 * Logged from:
244 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
245 */
246// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
247message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800248 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700249
250 // Number of ble scan results returned.
251 optional int32 num_of_results = 2;
252}
253
254/**
255 * Logs when a sensor state changes.
256 *
257 * Logged from:
258 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
259 */
260message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800261 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700262
263 // TODO: Is there a way to get the actual name of the sensor?
264 // The id (int) of the sensor.
265 optional int32 sensor_id = 2;
266
267 enum State {
268 OFF = 0;
269 ON = 1;
270 }
271 optional State state = 3;
272}
273
274
275/**
276 * Logs when GPS state changes.
277 *
278 * Logged from:
279 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
280 */
281message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800282 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700283
284 enum State {
285 OFF = 0;
286 ON = 1;
287 }
288 optional State state = 2;
289}
290
291
292/**
293 * Logs when a sync manager sync state changes.
294 *
295 * Logged from:
296 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
297 */
298message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800299 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700300
301 // Name of the sync (as named in the app)
302 optional string name = 2;
303
304 enum State {
305 OFF = 0;
306 ON = 1;
307 }
308 optional State state = 3;
309}
310
311/**
312 * Logs when a job scheduler job state changes.
313 *
314 * Logged from:
315 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
316 */
317message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800318 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700319
320 // Name of the job (as named in the app)
321 optional string name = 2;
322
323 enum State {
324 OFF = 0;
325 ON = 1;
326 }
327 optional State state = 3;
328
329 // TODO: Consider adding the stopReason (int)
330}
331
332/**
333 * Logs when the audio state changes.
334 *
335 * Logged from:
336 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
337 */
338message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800339 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700340
341 enum State {
342 OFF = 0;
343 ON = 1;
344 }
345 optional State state = 2;
346}
347
348/**
349 * Logs when the video codec state changes.
350 *
351 * Logged from:
352 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
353 */
354message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800355 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700356
357 enum State {
358 OFF = 0;
359 ON = 1;
360 }
361 optional State state = 2;
362}
363
364/**
365 * Logs when the flashlight state changes.
366 *
367 * Logged from:
368 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
369 */
370message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800371 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700372
373 enum State {
374 OFF = 0;
375 ON = 1;
376 }
377 optional State state = 2;
378}
379
380/**
381 * Logs when the camera state changes.
382 *
383 * Logged from:
384 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
385 */
386message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800387 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700388
389 enum State {
390 OFF = 0;
391 ON = 1;
392 }
393 optional State state = 2;
394}
395
396/**
397 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000398 *
399 * Logged from:
400 * TODO
401 */
Bookatzd6746242017-10-24 18:39:35 -0700402message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800403 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000404
Bookatzc1a050a2017-10-10 15:49:28 -0700405 // Type of wakelock.
406 enum Type {
407 PARTIAL = 0;
408 FULL = 1;
409 WINDOW = 2;
410 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800411 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700412
413 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
414 optional string tag = 3;
415
416 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800417 RELEASE = 0;
418 ACQUIRE = 1;
419 CHANGE_RELEASE = 2;
420 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700421 }
422 optional State state = 4;
423}
424
425/**
Bookatzc1a050a2017-10-10 15:49:28 -0700426 * Logs when a partial wakelock is considered 'long' (over 1 min).
427 *
428 * Logged from:
429 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
430 */
431message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800432 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700433
Yao Chend54f9dd2017-10-17 17:37:48 +0000434 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
435 optional string tag = 2;
436
Bookatzc1a050a2017-10-10 15:49:28 -0700437 // TODO: I have no idea what this is.
438 optional string history_tag = 3;
439
440 enum State {
441 OFF = 0;
442 ON = 1;
443 }
444 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000445}
446
Bookatzc1a050a2017-10-10 15:49:28 -0700447/**
448 * Logs Battery Saver state change.
449 *
450 * Logged from:
451 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
452 */
453message BatterySaverModeStateChanged {
454 enum State {
455 OFF = 0;
456 ON = 1;
457 }
458 optional State state = 1;
459}
460
461/**
462 * Logs Doze mode state change.
463 *
464 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800465 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700466 */
467message DeviceIdleModeStateChanged {
468 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800469 enum State {
470 DEVICE_IDLE_MODE_OFF = 0;
471 DEVICE_IDLE_MODE_LIGHT = 1;
472 DEVICE_IDLE_MODE_DEEP = 2;
473 }
474 optional State state = 1;
475}
476
477
478/**
479 * Logs state change of Doze mode including maintenance windows.
480 *
481 * Logged from:
482 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
483 */
484message DeviceIdlingModeStateChanged {
485 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
486 enum State {
487 DEVICE_IDLE_MODE_OFF = 0;
488 DEVICE_IDLE_MODE_LIGHT = 1;
489 DEVICE_IDLE_MODE_DEEP = 2;
490 }
491 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700492}
493
494/**
495 * Logs screen brightness level.
496 *
497 * Logged from:
498 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
499 */
500message ScreenBrightnessChanged {
501 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
502 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700503}
504
505/**
506 * Logs battery level (percent full, from 0 to 100).
507 *
508 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700509 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700510 */
511message BatteryLevelChanged {
512 // Battery level. Should be in [0, 100].
513 optional int32 battery_level = 1;
514}
515
516/**
517 * Logs change in charging status of the device.
518 *
519 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700520 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700521 */
522message ChargingStateChanged {
523 // TODO: Link directly to BatteryManager.java's constants (via a proto).
524 enum State {
525 BATTERY_STATUS_UNKNOWN = 1;
526 BATTERY_STATUS_CHARGING = 2;
527 BATTERY_STATUS_DISCHARGING = 3;
528 BATTERY_STATUS_NOT_CHARGING = 4;
529 BATTERY_STATUS_FULL = 5;
530 }
531 optional State charging_state = 1;
532}
533
534/**
535 * Logs whether the device is plugged in, and what power source it is using.
536 *
537 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700538 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700539 */
540message PluggedStateChanged {
541 // TODO: Link directly to BatteryManager.java's constants (via a proto).
542 enum State {
543 // Note that NONE is not in BatteryManager.java's constants.
544 BATTERY_PLUGGED_NONE = 0;
545 // Power source is an AC charger.
546 BATTERY_PLUGGED_AC = 1;
547 // Power source is a USB port.
548 BATTERY_PLUGGED_USB = 2;
549 // Power source is wireless.
550 BATTERY_PLUGGED_WIRELESS = 4;
551 }
552 optional State plugged_state = 1;
553}
554
555/**
556 * Logs the temperature of the device, in tenths of a degree Celsius.
557 *
558 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700559 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700560 */
561message DeviceTemperatureReported {
562 // Temperature in tenths of a degree C.
563 optional int32 temperature = 1;
564}
565
566// TODO: Define this more precisely.
567// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
568/**
569 * Logs when the device turns off or on.
570 *
571 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700572 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700573 */
574message DeviceOnStatusChanged {
575 enum State {
576 OFF = 0;
577 ON = 1;
578 }
579 optional State state = 1;
580}
581
582/**
583 * Logs when an app's wakeup alarm fires.
584 *
585 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700586 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700587 */
588message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800589 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800590
591 // Name of the wakeup alarm.
592 optional string tag = 2;
593}
594
595/**
596 * Logs when an an app causes the mobile radio to change state.
597 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
598 *
599 * Logged from:
600 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
601 */
602message MobileRadioPowerStateChanged {
603 // TODO: Add attribution instead of uid?
604 optional int32 uid = 1;
605
606 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
607 enum PowerState {
608 DC_POWER_STATE_LOW = 1;
609 DC_POWER_STATE_MEDIUM = 2;
610 DC_POWER_STATE_HIGH = 3;
611 }
612 optional PowerState power_state = 2;
613}
614
615/**
616 * Logs when an an app causes the wifi radio to change state.
617 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
618 *
619 * Logged from:
620 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
621 */
622message WifiRadioPowerStateChanged {
623 // TODO: Add attribution instead of uid?
624 optional int32 uid = 1;
625
626 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
627 enum PowerState {
628 DC_POWER_STATE_LOW = 1;
629 DC_POWER_STATE_MEDIUM = 2;
630 DC_POWER_STATE_HIGH = 3;
631 }
632 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700633}
634
635/**
636 * Logs kernel wakeup reasons and aborts.
637 *
638 * Logged from:
639 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
640 */
641message KernelWakeupReported {
642 // Name of the kernel wakeup reason (or abort).
643 optional string wakeup_reason_name = 1;
644
645 // Duration (in microseconds) for the wake-up interrupt to be serviced.
646 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700647}
648
649/**
650 * Logs wifi locks held by an app.
651 *
652 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700653 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700654 */
655message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800656 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700657
658 enum State {
659 OFF = 0;
660 ON = 1;
661 }
662 optional State state = 2;
663}
664
665/**
666 * Logs wifi signal strength changes.
667 *
668 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700669 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700670 */
671message WifiSignalStrengthChanged {
672 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
673 enum SignalStrength {
674 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
675 SIGNAL_STRENGTH_POOR = 1;
676 SIGNAL_STRENGTH_MODERATE = 2;
677 SIGNAL_STRENGTH_GOOD = 3;
678 SIGNAL_STRENGTH_GREAT = 4;
679 }
680 optional SignalStrength signal_strength = 1;
681}
682
683/**
684 * Logs wifi scans performed by an app.
685 *
686 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700687 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700688 */
689message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800690 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700691
692 enum State {
693 OFF = 0;
694 ON = 1;
695 }
696 optional State state = 2;
697}
698
699/**
700 * Logs phone signal strength changes.
701 *
702 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700703 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700704 */
705message PhoneSignalStrengthChanged {
706 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
707 enum SignalStrength {
708 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
709 SIGNAL_STRENGTH_POOR = 1;
710 SIGNAL_STRENGTH_MODERATE = 2;
711 SIGNAL_STRENGTH_GOOD = 3;
712 SIGNAL_STRENGTH_GREAT = 4;
713 }
714 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700715}
716
717/**
718 * Logs that a setting was updated.
719 * Logged from:
720 * frameworks/base/core/java/android/provider/Settings.java
721 * The tag and is_default allow resetting of settings to default values based on the specified
722 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
723 */
724message SettingChanged {
725 // The name of the setting.
726 optional string setting = 1;
727
728 // The change being imposed on this setting. May represent a number, eg "3".
729 optional string value = 2;
730
731 // The new value of this setting. For most settings, this is same as value. For some settings,
732 // value is +X or -X where X represents an element in a set. For example, if the previous value
733 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
734 // The +/- feature is currently only used for location_providers_allowed.
735 optional string new_value = 3;
736
737 // The previous value of this setting.
738 optional string prev_value = 4;
739
740 // The tag used with the is_default for resetting sets of settings. This is generally null.
741 optional string tag = 5;
742
743 // 1 indicates that this setting with tag should be resettable.
744 optional int32 is_default = 6;
745
746 // The user ID associated. Defined in android/os/UserHandle.java
747 optional int32 user = 7;
748}
Chenjie Yub3dda412017-10-24 13:41:59 -0700749
Chenjie Yu05013b32017-11-21 10:21:41 -0800750/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700751 * Logs activity going to foreground or background
752 *
753 * Logged from:
754 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
755 */
756message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800757 optional int32 uid = 1;
758 optional string pkg_name = 2;
759 optional string class_name = 3;
760
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700761 enum Activity {
762 MOVE_TO_BACKGROUND = 0;
763 MOVE_TO_FOREGROUND = 1;
764 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700765 optional Activity activity = 4;
766}
David Chenc8a43242017-10-17 16:23:28 -0700767
768/**
David Chen9e3808c2017-11-20 17:25:34 -0800769 * Logs when an error is written to dropbox.
770 * Logged from:
771 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
772 */
773message DropboxErrorChanged {
774 // The uid if available. -1 means not available.
775 optional int32 uid = 1;
776
777 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
778 optional string tag = 2;
779
780 // The name of the process.
781 optional string process_name = 3;
782
783 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800784 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800785
786 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800787 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800788
789 // The activity name if available.
790 optional string activity_name = 6;
791
David Chen6e3e6cb2018-01-03 16:14:06 -0800792 // The package name if available.
793 optional string package_name = 7;
794
David Chen9e3808c2017-11-20 17:25:34 -0800795 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800796 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800797}
798
David Chen0a368b22017-12-06 16:28:16 -0800799/*
800 * Allows other apps to push events into statsd.
801 * Logged from:
802 * frameworks/base/core/java/android/util/StatsLog.java
803 */
804message AppHook {
805 // The uid of the application that sent this custom atom.
806 optional int32 uid = 1;
807
808 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
809 optional int32 label = 2;
810
811 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
812 // predicates for the metrics).
813 enum State {
814 UNKNOWN = 0;
815 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
816 STOP = 2;
817 START = 3;
818 }
819 optional State state = 3;
820}
821
David Chen9e3808c2017-11-20 17:25:34 -0800822/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800823 * Logs when statsd detects an anomaly.
824 *
825 * Logged from:
826 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
827 */
828message AnomalyDetected {
829 // Uid that owns the config whose anomaly detection alert fired.
830 optional int32 config_uid = 1;
831
Yangster-mac94e197c2018-01-02 16:03:03 -0800832 // Id of the config whose anomaly detection alert fired.
833 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800834
Yangster-mac94e197c2018-01-02 16:03:03 -0800835 // Id of the alert (i.e. name of the anomaly that was detected).
836 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800837}
838
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000839message AppStartChanged {
840 // The uid if available. -1 means not available.
841 optional int32 uid = 1;
842
843 // The app package name.
844 optional string pkg_name = 2;
845
846 enum TransitionType {
847 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
848 WARM = 1;
849 HOT = 2;
850 COLD = 3;
851 }
852 // The transition type.
853 optional TransitionType type = 3;
854
855 // The activity name.
856 optional string activity_name = 4;
857
858 // The name of the calling app. Empty if not set.
859 optional string calling_pkg_name = 5;
860
861 // Whether the app is an instant app.
862 optional bool is_instant_app = 6;
863
864 // Device uptime when activity started.
865 optional int64 activity_start_msec = 7;
866
867 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
868 enum TransitionReason {
869 APP_START_TRANSITION_REASON_UNKNOWN = 0;
870 SPLASH_SCREEN = 1;
871 WINDOWS_DRAWN = 2;
872 TIMEOUT = 3;
873 SNAPSHOT = 4;
874 }
875 optional TransitionReason reason = 8;
876
877 optional int32 transition_delay_msec = 9;
878 // -1 if not set.
879 optional int32 starting_window_delay_msec = 10;
880 // -1 if not set.
881 optional int32 bind_application_delay_msec = 11;
882 optional int32 windows_drawn_delay_msec = 12;
883
884 // Empty if not set.
885 optional string launch_token = 13;
886
887}
888
889message AppStartCancelChanged {
890 // The uid if available. -1 means not available.
891 optional int32 uid = 1;
892
893 // The app package name.
894 optional string pkg_name = 2;
895
896 enum TransitionType {
897 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
898 WARM = 1;
899 HOT = 2;
900 COLD = 3;
901 }
902 // The transition type.
903 optional TransitionType type = 3;
904
905 // The activity name.
906 optional string activity_name = 4;
907}
908
909message AppStartFullyDrawnChanged {
910 // The uid if available. -1 means not available.
911 optional int32 uid = 1;
912
913 // The app package name.
914 optional string pkg_name = 2;
915
916 enum TransitionType {
917 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
918 WITH_BUNDLE = 1;
919 WITHOUT_BUNDLE = 2;
920 }
921 // The transition type.
922 optional TransitionType type = 3;
923
924 // The activity name.
925 optional string activity_name = 4;
926
927 optional bool transition_process_running = 5;
928
929 // App startup time (until call to Activity#reportFullyDrawn()).
930 optional int64 app_startup_time_ms = 6;
931}
932
Bookatz8fcd09a2017-12-18 13:01:10 -0800933/**
David Chenc8a43242017-10-17 16:23:28 -0700934 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
935 *
936 * Pulled from:
937 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
938 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800939message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700940 optional int32 uid = 1;
941
942 optional int64 rx_bytes = 2;
943
944 optional int64 rx_packets = 3;
945
946 optional int64 tx_bytes = 4;
947
948 optional int64 tx_packets = 5;
949}
950
951/**
952 * Pulls bytes transferred via wifi (separated by foreground and background usage).
953 *
954 * Pulled from:
955 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
956 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800957message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700958 optional int32 uid = 1;
959
960 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
961 optional int32 is_foreground = 2;
962
963 optional int64 rx_bytes = 3;
964
965 optional int64 rx_packets = 4;
966
967 optional int64 tx_bytes = 5;
968
969 optional int64 tx_packets = 6;
970}
971
972/**
973 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
974 *
975 * Pulled from:
976 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
977 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800978message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700979 optional int32 uid = 1;
980
981 optional int64 rx_bytes = 2;
982
983 optional int64 rx_packets = 3;
984
985 optional int64 tx_bytes = 4;
986
987 optional int64 tx_packets = 5;
988}
989
990/**
991 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
992 *
993 * Pulled from:
994 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
995 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800996message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700997 optional int32 uid = 1;
998
999 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1000 optional int32 is_foreground = 2;
1001
1002 optional int64 rx_bytes = 3;
1003
1004 optional int64 rx_packets = 4;
1005
1006 optional int64 tx_bytes = 5;
1007
1008 optional int64 tx_packets = 6;
1009}
1010
1011/**
1012 * Pulls the kernel wakelock durations. This atom is adapted from
1013 * android/internal/os/KernelWakelockStats.java
1014 *
1015 * Pulled from:
1016 * StatsCompanionService using KernelWakelockReader.
1017 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001018message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001019 optional string name = 1;
1020
1021 optional int32 count = 2;
1022
1023 optional int32 version = 3;
1024
1025 optional int64 time = 4;
1026}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001027
Chenjie Yu05013b32017-11-21 10:21:41 -08001028/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001029 * Pulls low power state information. This includes platform and subsystem sleep state information,
1030 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001031 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001032 * hardware/interfaces/power/1.1/types.hal
1033 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001034message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001035 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1036 // YYY is corresponding voter name.
1037 // If there are no voters, the format should just be XXX (with no dot).
1038 // XXX and YYY should not contain a "." in it.
1039 optional string name = 1;
1040 // The number of times it entered, or voted for entering the sleep state
1041 optional uint64 count = 2;
1042 // The length of time spent in, or spent voting for, the sleep state
1043 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001044}
David Chen21582962017-11-01 17:32:46 -07001045
1046/**
1047 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1048 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1049 * attributed back to the parent (host) uid. One example is Chrome.
1050 *
1051 * Logged from:
1052 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1053 */
1054message IsolatedUidChanged {
1055 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1056 optional int32 parent_uid = 1;
1057
1058 optional int32 isolated_uid = 2;
1059
1060 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1061 // be removed before if it's used for another parent uid.
1062 optional int32 is_create = 3;
1063}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001064
Chenjie Yu05013b32017-11-21 10:21:41 -08001065/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001066 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001067 * Pulls the time the cpu spend on the frequency index. Frequency index
1068 * starts from highest to lowest. The value should be monotonically
1069 * increasing since boot. However, if there is a cpu
1070 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001071 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001072message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001073 optional uint32 cluster = 1;
1074 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001075 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001076}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001077
Chenjie Yu05013b32017-11-21 10:21:41 -08001078/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001079 * Pulls Cpu Time Per Uid.
1080 * Note that isolated process uid time should be attributed to host uids.
1081 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001082message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001083 optional uint64 uid = 1;
1084 optional uint64 user_time_ms = 2;
1085 optional uint64 sys_time_ms = 3;
1086}
1087
1088/**
1089 * Pulls Cpu Time Per Uid per frequency.
1090 * Note that isolated process uid time should be attributed to host uids.
1091 * For each uid, we order the time by descending frequencies.
1092 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001093message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001094 optional uint64 uid = 1;
1095 optional uint64 freq_idx = 2;
1096 optional uint64 time_ms = 3;
1097}
Hugo Benichi884970e2017-11-14 22:42:46 +09001098
1099/*
1100 * Logs the reception of an incoming network packet causing the main system to wake up for
1101 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1102 * and processed by WakeupController.cpp.
1103 */
1104message PacketWakeupOccurred {
1105 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1106 // delivered nowhere.
1107 optional int32 uid = 1;
1108 // The interface name on which the packet was received.
1109 optional string iface = 2;
1110 // The ethertype value of the packet.
1111 optional int32 ethertype = 3;
1112 // String representation of the destination MAC address of the packet.
1113 optional string destination_hardware_address = 4;
1114 // String representation of the source address of the packet if this was an IP packet.
1115 optional string source_ip = 5;
1116 // String representation of the destination address of the packet if this was an IP packet.
1117 optional string destination_ip = 6;
1118 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1119 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1120 // families.
1121 optional int32 ip_next_header = 7;
1122 // The source port if this was a TCP or UDP packet.
1123 optional int32 source_port = 8;
1124 // The destination port if this was a TCP or UDP packet.
1125 optional int32 destination_port = 9;
1126}
Chenjie Yu05013b32017-11-21 10:21:41 -08001127
1128/**
1129 * Pulls Wifi Controller Activity Energy Info
1130 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001131message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001132 // timestamp(wall clock) of record creation
1133 optional uint64 timestamp_ms = 1;
1134 // stack reported state
1135 // TODO: replace this with proto enum
1136 optional int32 stack_state = 2;
1137 // tx time in ms
1138 optional uint64 controller_tx_time_ms = 3;
1139 // rx time in ms
1140 optional uint64 controller_rx_time_ms = 4;
1141 // idle time in ms
1142 optional uint64 controller_idle_time_ms = 5;
1143 // product of current(mA), voltage(V) and time(ms)
1144 optional uint64 controller_energy_used = 6;
1145}
1146
1147/**
1148 * Pulls Modem Activity Energy Info
1149 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001150message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001151 // timestamp(wall clock) of record creation
1152 optional uint64 timestamp_ms = 1;
1153 // sleep time in ms.
1154 optional uint64 sleep_time_ms = 2;
1155 // idle time in ms
1156 optional uint64 controller_idle_time_ms = 3;
1157 /**
1158 * Tx power index
1159 * index 0 = tx_power < 0dBm
1160 * index 1 = 0dBm < tx_power < 5dBm
1161 * index 2 = 5dBm < tx_power < 15dBm
1162 * index 3 = 15dBm < tx_power < 20dBm
1163 * index 4 = tx_power > 20dBm
1164 */
1165 // tx time in ms at power level 0
1166 optional uint64 controller_tx_time_pl0_ms = 4;
1167 // tx time in ms at power level 1
1168 optional uint64 controller_tx_time_pl1_ms = 5;
1169 // tx time in ms at power level 2
1170 optional uint64 controller_tx_time_pl2_ms = 6;
1171 // tx time in ms at power level 3
1172 optional uint64 controller_tx_time_pl3_ms = 7;
1173 // tx time in ms at power level 4
1174 optional uint64 controller_tx_time_pl4_ms = 8;
1175 // rx time in ms at power level 5
1176 optional uint64 controller_rx_time_ms = 9;
1177 // product of current(mA), voltage(V) and time(ms)
1178 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001179}