blob: 7a9588d1a2c4ca54f22978318e498181941add72 [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;
Chenjie Yu52cacc62017-12-08 18:11:45 -080088 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Bookatzc1a050a2017-10-10 15:49:28 -070089 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000090 }
David Chenc8a43242017-10-17 16:23:28 -070091
David Chen6e3e6cb2018-01-03 16:14:06 -080092 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070093 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080094 WifiBytesTransfer wifi_bytes_transfer = 10000;
95 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
96 MobileBytesTransfer mobile_bytes_transfer = 10002;
97 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
98 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -080099 SubsystemSleepState subsystem_sleep_state = 10005;
100 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800101 CpuTimePerFreq cpu_time_per_freq = 10008;
102 CpuTimePerUid cpu_time_per_uid = 10009;
103 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
104 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
105 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -0800106 MemoryStat memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800107 CpuSuspendTime cpu_suspend_time = 10014;
108 CpuIdleTime cpu_idle_time = 10015;
109 CpuActiveTime cpu_active_time = 10016;
110 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800111 DiskSpace disk_space = 10018;
112 SystemUptime system_uptime = 10019;
David Chenc8a43242017-10-17 16:23:28 -0700113 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700114}
115
Yao Chend54f9dd2017-10-17 17:37:48 +0000116/**
Yangster-mac20877162017-12-22 17:19:39 -0800117 * This proto represents a node of an attribution chain.
118 * Note: All attribution chains are represented as a repeated field of type
119 * AttributionNode. It is understood that in such arrays, the order is that
120 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000121 */
Yangster-mac20877162017-12-22 17:19:39 -0800122message AttributionNode {
123 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800124 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800125
Yangster-mac20877162017-12-22 17:19:39 -0800126 // The (optional) string tag for an element in the attribution chain. If the
127 // element has no tag, it is encoded as an empty string.
128 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700129}
130
Yao Chend54f9dd2017-10-17 17:37:48 +0000131/*
132 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800133 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000134 *
135 * RULES:
136 * - The field ids for each atom must start at 1, and count upwards by 1.
137 * Skipping field ids is not allowed.
138 * - These form an API, so renaming, renumbering or removing fields is
139 * not allowed between android releases. (This is not currently enforced,
140 * but there will be a tool to enforce this restriction).
141 * - The types must be built-in protocol buffer types, namely, no sub-messages
142 * are allowed (yet). The bytes type is also not allowed.
143 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800144 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000145 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800146 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000147 * - A field that is a uid should be a string field, tagged with the [xxx]
148 * annotation. The generated code on android will be represented by UIDs,
149 * and those UIDs will be translated in xxx to those strings.
150 *
151 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700152 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000153 * - If there is a UID, it goes first. Think in an object-oriented fashion.
154 * *****************************************************************************
155 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700156
Yao Chend54f9dd2017-10-17 17:37:48 +0000157/**
158 * Logs when the screen state changes.
159 *
160 * Logged from:
161 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
162 */
163message ScreenStateChanged {
164 // TODO: Use the real screen state.
165 enum State {
166 STATE_UNKNOWN = 0;
167 STATE_OFF = 1;
168 STATE_ON = 2;
169 STATE_DOZE = 3;
170 STATE_DOZE_SUSPEND = 4;
171 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800172 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 }
174 // New screen state.
175 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700176}
Yao Chend54f9dd2017-10-17 17:37:48 +0000177
178/**
Bookatzc1a050a2017-10-10 15:49:28 -0700179 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 *
181 * Logged from:
182 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
183 */
Bookatzc1a050a2017-10-10 15:49:28 -0700184message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000185 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
186
187 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700188 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800189 optional android.app.ProcessState state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000190}
191
192/**
Bookatzc1a050a2017-10-10 15:49:28 -0700193 * Logs that a process started, finished, crashed, or ANRed.
194 *
195 * Logged from:
196 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
197 */
198message ProcessLifeCycleStateChanged {
199 // TODO: Use the real (mapped) process states.
200 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
201
202 // TODO: What is this?
203 optional string name = 2;
204
Bookatzddccf0a2017-11-28 16:48:14 -0800205 // What lifecycle state the process changed to.
206 // This enum is specific to atoms.proto.
207 enum Event {
208 PROCESS_FINISHED = 0;
209 PROCESS_STARTED = 1;
210 PROCESS_CRASHED = 2;
211 PROCESS_ANRED = 3;
212 }
213 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700214}
215
Bookatzc1a050a2017-10-10 15:49:28 -0700216/**
217 * Logs when the ble scan state changes.
218 *
219 * Logged from:
220 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
221 */
222message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800223 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700224
225 enum State {
226 OFF = 0;
227 ON = 1;
228 }
229 optional State state = 2;
230}
231
232/**
233 * Logs when an unoptimized ble scan state changes.
234 *
235 * Logged from:
236 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
237 */
238// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
239message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800240 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700241
242 enum State {
243 OFF = 0;
244 ON = 1;
245 }
246 optional State state = 2;
247}
248
249/**
250 * Logs reporting of a ble scan finding results.
251 *
252 * Logged from:
253 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
254 */
255// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
256message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800257 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700258
259 // Number of ble scan results returned.
260 optional int32 num_of_results = 2;
261}
262
263/**
264 * Logs when a sensor state changes.
265 *
266 * Logged from:
267 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
268 */
269message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800270 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700271
272 // TODO: Is there a way to get the actual name of the sensor?
273 // The id (int) of the sensor.
274 optional int32 sensor_id = 2;
275
276 enum State {
277 OFF = 0;
278 ON = 1;
279 }
280 optional State state = 3;
281}
282
283
284/**
285 * Logs when GPS state changes.
286 *
287 * Logged from:
288 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
289 */
290message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800291 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700292
293 enum State {
294 OFF = 0;
295 ON = 1;
296 }
297 optional State state = 2;
298}
299
300
301/**
302 * Logs when a sync manager sync state changes.
303 *
304 * Logged from:
305 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
306 */
307message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800308 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700309
310 // Name of the sync (as named in the app)
311 optional string name = 2;
312
313 enum State {
314 OFF = 0;
315 ON = 1;
316 }
317 optional State state = 3;
318}
319
320/**
321 * Logs when a job scheduler job state changes.
322 *
323 * Logged from:
324 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
325 */
326message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800327 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700328
329 // Name of the job (as named in the app)
330 optional string name = 2;
331
332 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800333 FINISHED = 0;
334 STARTED = 1;
335 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700336 }
337 optional State state = 3;
338
339 // TODO: Consider adding the stopReason (int)
340}
341
342/**
343 * Logs when the audio state changes.
344 *
345 * Logged from:
346 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
347 */
348message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800349 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700350
351 enum State {
352 OFF = 0;
353 ON = 1;
354 }
355 optional State state = 2;
356}
357
358/**
359 * Logs when the video codec state changes.
360 *
361 * Logged from:
362 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
363 */
364message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800365 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700366
367 enum State {
368 OFF = 0;
369 ON = 1;
370 }
371 optional State state = 2;
372}
373
374/**
375 * Logs when the flashlight state changes.
376 *
377 * Logged from:
378 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
379 */
380message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800381 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700382
383 enum State {
384 OFF = 0;
385 ON = 1;
386 }
387 optional State state = 2;
388}
389
390/**
391 * Logs when the camera state changes.
392 *
393 * Logged from:
394 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
395 */
396message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800397 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700398
399 enum State {
400 OFF = 0;
401 ON = 1;
402 }
403 optional State state = 2;
404}
405
406/**
407 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000408 *
409 * Logged from:
410 * TODO
411 */
Bookatzd6746242017-10-24 18:39:35 -0700412message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800413 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000414
Bookatzc1a050a2017-10-10 15:49:28 -0700415 // Type of wakelock.
416 enum Type {
417 PARTIAL = 0;
418 FULL = 1;
419 WINDOW = 2;
420 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800421 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
423 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
424 optional string tag = 3;
425
426 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800427 RELEASE = 0;
428 ACQUIRE = 1;
429 CHANGE_RELEASE = 2;
430 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700431 }
432 optional State state = 4;
433}
434
435/**
Bookatzc1a050a2017-10-10 15:49:28 -0700436 * Logs when a partial wakelock is considered 'long' (over 1 min).
437 *
438 * Logged from:
439 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
440 */
441message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800442 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700443
Yao Chend54f9dd2017-10-17 17:37:48 +0000444 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
445 optional string tag = 2;
446
Bookatzc1a050a2017-10-10 15:49:28 -0700447 // TODO: I have no idea what this is.
448 optional string history_tag = 3;
449
450 enum State {
451 OFF = 0;
452 ON = 1;
453 }
454 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000455}
456
Bookatzc1a050a2017-10-10 15:49:28 -0700457/**
458 * Logs Battery Saver state change.
459 *
460 * Logged from:
461 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
462 */
463message BatterySaverModeStateChanged {
464 enum State {
465 OFF = 0;
466 ON = 1;
467 }
468 optional State state = 1;
469}
470
471/**
472 * Logs Doze mode state change.
473 *
474 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800475 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700476 */
477message DeviceIdleModeStateChanged {
478 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800479 enum State {
480 DEVICE_IDLE_MODE_OFF = 0;
481 DEVICE_IDLE_MODE_LIGHT = 1;
482 DEVICE_IDLE_MODE_DEEP = 2;
483 }
484 optional State state = 1;
485}
486
487
488/**
489 * Logs state change of Doze mode including maintenance windows.
490 *
491 * Logged from:
492 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
493 */
494message DeviceIdlingModeStateChanged {
495 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
496 enum State {
497 DEVICE_IDLE_MODE_OFF = 0;
498 DEVICE_IDLE_MODE_LIGHT = 1;
499 DEVICE_IDLE_MODE_DEEP = 2;
500 }
501 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700502}
503
504/**
505 * Logs screen brightness level.
506 *
507 * Logged from:
508 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
509 */
510message ScreenBrightnessChanged {
511 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
512 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700513}
514
515/**
516 * Logs battery level (percent full, from 0 to 100).
517 *
518 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700519 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700520 */
521message BatteryLevelChanged {
522 // Battery level. Should be in [0, 100].
523 optional int32 battery_level = 1;
524}
525
526/**
527 * Logs change in charging status of the device.
528 *
529 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700530 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700531 */
532message ChargingStateChanged {
533 // TODO: Link directly to BatteryManager.java's constants (via a proto).
534 enum State {
535 BATTERY_STATUS_UNKNOWN = 1;
536 BATTERY_STATUS_CHARGING = 2;
537 BATTERY_STATUS_DISCHARGING = 3;
538 BATTERY_STATUS_NOT_CHARGING = 4;
539 BATTERY_STATUS_FULL = 5;
540 }
541 optional State charging_state = 1;
542}
543
544/**
545 * Logs whether the device is plugged in, and what power source it is using.
546 *
547 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700548 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700549 */
550message PluggedStateChanged {
551 // TODO: Link directly to BatteryManager.java's constants (via a proto).
552 enum State {
553 // Note that NONE is not in BatteryManager.java's constants.
554 BATTERY_PLUGGED_NONE = 0;
555 // Power source is an AC charger.
556 BATTERY_PLUGGED_AC = 1;
557 // Power source is a USB port.
558 BATTERY_PLUGGED_USB = 2;
559 // Power source is wireless.
560 BATTERY_PLUGGED_WIRELESS = 4;
561 }
562 optional State plugged_state = 1;
563}
564
565/**
566 * Logs the temperature of the device, in tenths of a degree Celsius.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message DeviceTemperatureReported {
572 // Temperature in tenths of a degree C.
573 optional int32 temperature = 1;
574}
575
576// TODO: Define this more precisely.
577// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
578/**
579 * Logs when the device turns off or on.
580 *
581 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700582 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700583 */
584message DeviceOnStatusChanged {
585 enum State {
586 OFF = 0;
587 ON = 1;
588 }
589 optional State state = 1;
590}
591
592/**
593 * Logs when an app's wakeup alarm fires.
594 *
595 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700596 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700597 */
598message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800599 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800600
601 // Name of the wakeup alarm.
602 optional string tag = 2;
603}
604
605/**
606 * Logs when an an app causes the mobile radio to change state.
607 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
608 *
609 * Logged from:
610 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
611 */
612message MobileRadioPowerStateChanged {
613 // TODO: Add attribution instead of uid?
614 optional int32 uid = 1;
615
616 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
617 enum PowerState {
618 DC_POWER_STATE_LOW = 1;
619 DC_POWER_STATE_MEDIUM = 2;
620 DC_POWER_STATE_HIGH = 3;
621 }
622 optional PowerState power_state = 2;
623}
624
625/**
626 * Logs when an an app causes the wifi radio to change state.
627 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
628 *
629 * Logged from:
630 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
631 */
632message WifiRadioPowerStateChanged {
633 // TODO: Add attribution instead of uid?
634 optional int32 uid = 1;
635
636 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
637 enum PowerState {
638 DC_POWER_STATE_LOW = 1;
639 DC_POWER_STATE_MEDIUM = 2;
640 DC_POWER_STATE_HIGH = 3;
641 }
642 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700643}
644
645/**
646 * Logs kernel wakeup reasons and aborts.
647 *
648 * Logged from:
649 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
650 */
651message KernelWakeupReported {
652 // Name of the kernel wakeup reason (or abort).
653 optional string wakeup_reason_name = 1;
654
655 // Duration (in microseconds) for the wake-up interrupt to be serviced.
656 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700657}
658
659/**
660 * Logs wifi locks held by an app.
661 *
662 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700663 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700664 */
665message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800666 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700667
668 enum State {
669 OFF = 0;
670 ON = 1;
671 }
672 optional State state = 2;
673}
674
675/**
676 * Logs wifi signal strength changes.
677 *
678 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700679 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700680 */
681message WifiSignalStrengthChanged {
682 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
683 enum SignalStrength {
684 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
685 SIGNAL_STRENGTH_POOR = 1;
686 SIGNAL_STRENGTH_MODERATE = 2;
687 SIGNAL_STRENGTH_GOOD = 3;
688 SIGNAL_STRENGTH_GREAT = 4;
689 }
690 optional SignalStrength signal_strength = 1;
691}
692
693/**
694 * Logs wifi scans performed by an app.
695 *
696 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700697 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700698 */
699message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800700 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700701
702 enum State {
703 OFF = 0;
704 ON = 1;
705 }
706 optional State state = 2;
707}
708
709/**
710 * Logs phone signal strength changes.
711 *
712 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700713 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700714 */
715message PhoneSignalStrengthChanged {
716 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
717 enum SignalStrength {
718 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
719 SIGNAL_STRENGTH_POOR = 1;
720 SIGNAL_STRENGTH_MODERATE = 2;
721 SIGNAL_STRENGTH_GOOD = 3;
722 SIGNAL_STRENGTH_GREAT = 4;
723 }
724 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700725}
726
727/**
728 * Logs that a setting was updated.
729 * Logged from:
730 * frameworks/base/core/java/android/provider/Settings.java
731 * The tag and is_default allow resetting of settings to default values based on the specified
732 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
733 */
734message SettingChanged {
735 // The name of the setting.
736 optional string setting = 1;
737
738 // The change being imposed on this setting. May represent a number, eg "3".
739 optional string value = 2;
740
741 // The new value of this setting. For most settings, this is same as value. For some settings,
742 // value is +X or -X where X represents an element in a set. For example, if the previous value
743 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
744 // The +/- feature is currently only used for location_providers_allowed.
745 optional string new_value = 3;
746
747 // The previous value of this setting.
748 optional string prev_value = 4;
749
750 // The tag used with the is_default for resetting sets of settings. This is generally null.
751 optional string tag = 5;
752
753 // 1 indicates that this setting with tag should be resettable.
754 optional int32 is_default = 6;
755
756 // The user ID associated. Defined in android/os/UserHandle.java
757 optional int32 user = 7;
758}
Chenjie Yub3dda412017-10-24 13:41:59 -0700759
Chenjie Yu05013b32017-11-21 10:21:41 -0800760/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700761 * Logs activity going to foreground or background
762 *
763 * Logged from:
764 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
765 */
766message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800767 optional int32 uid = 1;
768 optional string pkg_name = 2;
769 optional string class_name = 3;
770
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700771 enum Activity {
772 MOVE_TO_BACKGROUND = 0;
773 MOVE_TO_FOREGROUND = 1;
774 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700775 optional Activity activity = 4;
776}
David Chenc8a43242017-10-17 16:23:28 -0700777
778/**
David Chen9e3808c2017-11-20 17:25:34 -0800779 * Logs when an error is written to dropbox.
780 * Logged from:
781 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
782 */
783message DropboxErrorChanged {
784 // The uid if available. -1 means not available.
785 optional int32 uid = 1;
786
787 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
788 optional string tag = 2;
789
790 // The name of the process.
791 optional string process_name = 3;
792
793 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800794 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800795
796 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800797 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800798
799 // The activity name if available.
800 optional string activity_name = 6;
801
David Chen6e3e6cb2018-01-03 16:14:06 -0800802 // The package name if available.
803 optional string package_name = 7;
804
David Chen9e3808c2017-11-20 17:25:34 -0800805 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800806 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800807}
808
David Chen0a368b22017-12-06 16:28:16 -0800809/*
810 * Allows other apps to push events into statsd.
811 * Logged from:
812 * frameworks/base/core/java/android/util/StatsLog.java
813 */
814message AppHook {
815 // The uid of the application that sent this custom atom.
816 optional int32 uid = 1;
817
818 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
819 optional int32 label = 2;
820
821 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
822 // predicates for the metrics).
823 enum State {
824 UNKNOWN = 0;
825 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
826 STOP = 2;
827 START = 3;
828 }
829 optional State state = 3;
830}
831
David Chen9e3808c2017-11-20 17:25:34 -0800832/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800833 * Logs when statsd detects an anomaly.
834 *
835 * Logged from:
836 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
837 */
838message AnomalyDetected {
839 // Uid that owns the config whose anomaly detection alert fired.
840 optional int32 config_uid = 1;
841
Yangster-mac94e197c2018-01-02 16:03:03 -0800842 // Id of the config whose anomaly detection alert fired.
843 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800844
Yangster-mac94e197c2018-01-02 16:03:03 -0800845 // Id of the alert (i.e. name of the anomaly that was detected).
846 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800847}
848
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000849message AppStartChanged {
850 // The uid if available. -1 means not available.
851 optional int32 uid = 1;
852
853 // The app package name.
854 optional string pkg_name = 2;
855
856 enum TransitionType {
857 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
858 WARM = 1;
859 HOT = 2;
860 COLD = 3;
861 }
862 // The transition type.
863 optional TransitionType type = 3;
864
865 // The activity name.
866 optional string activity_name = 4;
867
868 // The name of the calling app. Empty if not set.
869 optional string calling_pkg_name = 5;
870
871 // Whether the app is an instant app.
872 optional bool is_instant_app = 6;
873
874 // Device uptime when activity started.
875 optional int64 activity_start_msec = 7;
876
877 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
878 enum TransitionReason {
879 APP_START_TRANSITION_REASON_UNKNOWN = 0;
880 SPLASH_SCREEN = 1;
881 WINDOWS_DRAWN = 2;
882 TIMEOUT = 3;
883 SNAPSHOT = 4;
884 }
885 optional TransitionReason reason = 8;
886
887 optional int32 transition_delay_msec = 9;
888 // -1 if not set.
889 optional int32 starting_window_delay_msec = 10;
890 // -1 if not set.
891 optional int32 bind_application_delay_msec = 11;
892 optional int32 windows_drawn_delay_msec = 12;
893
894 // Empty if not set.
895 optional string launch_token = 13;
896
897}
898
899message AppStartCancelChanged {
900 // The uid if available. -1 means not available.
901 optional int32 uid = 1;
902
903 // The app package name.
904 optional string pkg_name = 2;
905
906 enum TransitionType {
907 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
908 WARM = 1;
909 HOT = 2;
910 COLD = 3;
911 }
912 // The transition type.
913 optional TransitionType type = 3;
914
915 // The activity name.
916 optional string activity_name = 4;
917}
918
919message AppStartFullyDrawnChanged {
920 // The uid if available. -1 means not available.
921 optional int32 uid = 1;
922
923 // The app package name.
924 optional string pkg_name = 2;
925
926 enum TransitionType {
927 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
928 WITH_BUNDLE = 1;
929 WITHOUT_BUNDLE = 2;
930 }
931 // The transition type.
932 optional TransitionType type = 3;
933
934 // The activity name.
935 optional string activity_name = 4;
936
937 optional bool transition_process_running = 5;
938
939 // App startup time (until call to Activity#reportFullyDrawn()).
940 optional int64 app_startup_time_ms = 6;
941}
942
Bookatz8fcd09a2017-12-18 13:01:10 -0800943/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800944 * Logs a picture-in-picture action
945 * Logged from:
946 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
947 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
948 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
949 */
950message PictureInPictureStateChanged {
951 optional int32 uid = 1;
952
953 optional string package_name = 2;
954
955 optional string class_name = 3;
956
957 // Picture-in-Picture action occurred, similar to
958 // frameworks/base/proto/src/metrics_constants.proto
959 enum State {
960 ENTERED = 1;
961 EXPANDED_TO_FULL_SCREEN = 2;
962 MINIMIZED = 3;
963 DISMISSED = 4;
964 }
965 optional State state = 4;
966}
967
968/**
David Chenc8a43242017-10-17 16:23:28 -0700969 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
970 *
971 * Pulled from:
972 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
973 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800974message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700975 optional int32 uid = 1;
976
977 optional int64 rx_bytes = 2;
978
979 optional int64 rx_packets = 3;
980
981 optional int64 tx_bytes = 4;
982
983 optional int64 tx_packets = 5;
984}
985
986/**
987 * Pulls bytes transferred via wifi (separated by foreground and background usage).
988 *
989 * Pulled from:
990 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
991 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800992message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700993 optional int32 uid = 1;
994
995 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
996 optional int32 is_foreground = 2;
997
998 optional int64 rx_bytes = 3;
999
1000 optional int64 rx_packets = 4;
1001
1002 optional int64 tx_bytes = 5;
1003
1004 optional int64 tx_packets = 6;
1005}
1006
1007/**
1008 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1009 *
1010 * Pulled from:
1011 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1012 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001013message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001014 optional int32 uid = 1;
1015
1016 optional int64 rx_bytes = 2;
1017
1018 optional int64 rx_packets = 3;
1019
1020 optional int64 tx_bytes = 4;
1021
1022 optional int64 tx_packets = 5;
1023}
1024
1025/**
1026 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1027 *
1028 * Pulled from:
1029 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1030 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001031message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001032 optional int32 uid = 1;
1033
1034 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1035 optional int32 is_foreground = 2;
1036
1037 optional int64 rx_bytes = 3;
1038
1039 optional int64 rx_packets = 4;
1040
1041 optional int64 tx_bytes = 5;
1042
1043 optional int64 tx_packets = 6;
1044}
1045
1046/**
1047 * Pulls the kernel wakelock durations. This atom is adapted from
1048 * android/internal/os/KernelWakelockStats.java
1049 *
1050 * Pulled from:
1051 * StatsCompanionService using KernelWakelockReader.
1052 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001053message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001054 optional string name = 1;
1055
1056 optional int32 count = 2;
1057
1058 optional int32 version = 3;
1059
1060 optional int64 time = 4;
1061}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001062
Chenjie Yu05013b32017-11-21 10:21:41 -08001063/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001064 * Pulls low power state information. This includes platform and subsystem sleep state information,
1065 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001066 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001067 * hardware/interfaces/power/1.1/types.hal
1068 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001069message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001070 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1071 // YYY is corresponding voter name.
1072 // If there are no voters, the format should just be XXX (with no dot).
1073 // XXX and YYY should not contain a "." in it.
1074 optional string name = 1;
1075 // The number of times it entered, or voted for entering the sleep state
1076 optional uint64 count = 2;
1077 // The length of time spent in, or spent voting for, the sleep state
1078 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001079}
David Chen21582962017-11-01 17:32:46 -07001080
1081/**
1082 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1083 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1084 * attributed back to the parent (host) uid. One example is Chrome.
1085 *
1086 * Logged from:
1087 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1088 */
1089message IsolatedUidChanged {
1090 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1091 optional int32 parent_uid = 1;
1092
1093 optional int32 isolated_uid = 2;
1094
1095 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1096 // be removed before if it's used for another parent uid.
1097 optional int32 is_create = 3;
1098}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001099
Chenjie Yu05013b32017-11-21 10:21:41 -08001100/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001101 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001102 * Pulls the time the cpu spend on the frequency index. Frequency index
1103 * starts from highest to lowest. The value should be monotonically
1104 * increasing since boot. However, if there is a cpu
1105 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001106 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001107message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001108 optional uint32 cluster = 1;
1109 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001110 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001111}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001112
Chenjie Yu05013b32017-11-21 10:21:41 -08001113/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001114 * Pulls Cpu Time Per Uid.
1115 * Note that isolated process uid time should be attributed to host uids.
1116 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001117message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001118 optional uint64 uid = 1;
1119 optional uint64 user_time_ms = 2;
1120 optional uint64 sys_time_ms = 3;
1121}
1122
1123/**
1124 * Pulls Cpu Time Per Uid per frequency.
1125 * Note that isolated process uid time should be attributed to host uids.
1126 * For each uid, we order the time by descending frequencies.
1127 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001128message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001129 optional uint64 uid = 1;
1130 optional uint64 freq_idx = 2;
1131 optional uint64 time_ms = 3;
1132}
Hugo Benichi884970e2017-11-14 22:42:46 +09001133
1134/*
1135 * Logs the reception of an incoming network packet causing the main system to wake up for
1136 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1137 * and processed by WakeupController.cpp.
1138 */
1139message PacketWakeupOccurred {
1140 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1141 // delivered nowhere.
1142 optional int32 uid = 1;
1143 // The interface name on which the packet was received.
1144 optional string iface = 2;
1145 // The ethertype value of the packet.
1146 optional int32 ethertype = 3;
1147 // String representation of the destination MAC address of the packet.
1148 optional string destination_hardware_address = 4;
1149 // String representation of the source address of the packet if this was an IP packet.
1150 optional string source_ip = 5;
1151 // String representation of the destination address of the packet if this was an IP packet.
1152 optional string destination_ip = 6;
1153 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1154 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1155 // families.
1156 optional int32 ip_next_header = 7;
1157 // The source port if this was a TCP or UDP packet.
1158 optional int32 source_port = 8;
1159 // The destination port if this was a TCP or UDP packet.
1160 optional int32 destination_port = 9;
1161}
Chenjie Yu05013b32017-11-21 10:21:41 -08001162
1163/**
1164 * Pulls Wifi Controller Activity Energy Info
1165 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001166message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001167 // timestamp(wall clock) of record creation
1168 optional uint64 timestamp_ms = 1;
1169 // stack reported state
1170 // TODO: replace this with proto enum
1171 optional int32 stack_state = 2;
1172 // tx time in ms
1173 optional uint64 controller_tx_time_ms = 3;
1174 // rx time in ms
1175 optional uint64 controller_rx_time_ms = 4;
1176 // idle time in ms
1177 optional uint64 controller_idle_time_ms = 5;
1178 // product of current(mA), voltage(V) and time(ms)
1179 optional uint64 controller_energy_used = 6;
1180}
1181
1182/**
1183 * Pulls Modem Activity Energy Info
1184 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001185message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001186 // timestamp(wall clock) of record creation
1187 optional uint64 timestamp_ms = 1;
1188 // sleep time in ms.
1189 optional uint64 sleep_time_ms = 2;
1190 // idle time in ms
1191 optional uint64 controller_idle_time_ms = 3;
1192 /**
1193 * Tx power index
1194 * index 0 = tx_power < 0dBm
1195 * index 1 = 0dBm < tx_power < 5dBm
1196 * index 2 = 5dBm < tx_power < 15dBm
1197 * index 3 = 15dBm < tx_power < 20dBm
1198 * index 4 = tx_power > 20dBm
1199 */
1200 // tx time in ms at power level 0
1201 optional uint64 controller_tx_time_pl0_ms = 4;
1202 // tx time in ms at power level 1
1203 optional uint64 controller_tx_time_pl1_ms = 5;
1204 // tx time in ms at power level 2
1205 optional uint64 controller_tx_time_pl2_ms = 6;
1206 // tx time in ms at power level 3
1207 optional uint64 controller_tx_time_pl3_ms = 7;
1208 // tx time in ms at power level 4
1209 optional uint64 controller_tx_time_pl4_ms = 8;
1210 // rx time in ms at power level 5
1211 optional uint64 controller_rx_time_ms = 9;
1212 // product of current(mA), voltage(V) and time(ms)
1213 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001214}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001215
1216/*
1217 * Logs the memory stats for a process
1218 */
1219message MemoryStat {
1220 // The uid if available. -1 means not available.
1221 optional int32 uid = 1;
1222
1223 // The app package name.
1224 optional string pkg_name = 2;
1225
1226 // # of page-faults
1227 optional int64 pgfault = 3;
1228
1229 // # of major page-faults
1230 optional int64 pgmajfault = 4;
1231
1232 // RSS+CACHE(+SWAP)
1233 optional int64 usage_in_bytes = 5;
1234}
1235
1236/*
1237 * Logs the event when LMKD kills a process to reduce memory pressure
1238 * Logged from:
1239 * system/core/lmkd/lmkd.c
1240 */
1241message LmkEventOccurred {
1242 // The uid if available. -1 means not available.
1243 optional int32 uid = 1;
1244
1245 // The app package name.
1246 optional string pkg_name = 2;
1247
1248 // oom adj score.
1249 optional int32 oom_score = 3;
1250
1251 // Used as start/stop boundaries for the event
1252 enum State {
1253 UNKNOWN = 0;
1254 START = 1;
1255 END = 2;
1256 }
1257 optional State state = 4;
1258}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001259
1260/*
1261 * Cpu syspend time for cpu power calculation.
1262 */
1263message CpuSuspendTime {
1264 optional uint64 time = 1;
1265}
1266
1267/*
1268 * Cpu idle time for cpu power calculation.
1269 */
1270message CpuIdleTime {
1271 optional uint64 time = 1;
1272}
1273
1274/*
1275 * Reads from /proc/uid_concurrent_active_time which has the format:
1276 * active: X (X is # cores)
1277 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1278 * [uid1]: [time-0] [time-1] [time-2] ... ...
1279 * ...
1280 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1281 * The file contains a monotonically increasing count of time for a single boot.
1282 */
1283message CpuActiveTime {
1284 optional uint64 uid = 1;
1285 optional uint64 idx = 2;
1286 optional uint64 time_ms = 3;
1287}
1288
1289/**
1290 * Reads from /proc/uid_concurrent_policy_time which has the format:
1291 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1292 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1293 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1294 * ...
1295 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1296 * The file contains a monotonically increasing count of time for a single boot.
1297 */
1298message CpuClusterTime {
1299 optional uint64 uid = 1;
1300 optional uint64 idx = 2;
1301 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001302}
1303
1304/*
1305 * Pulls free disk space, for data, system partition and temporary directory.
1306 */
1307message DiskSpace {
1308 // available bytes in data partition
1309 optional uint64 data_available_bytes = 1;
1310 // available bytes in system partition
1311 optional uint64 system_available_bytes = 2;
1312 // available bytes in download cache or temp directories
1313 optional uint64 temp_available_bytes = 3;
1314}
1315
1316/*
1317 * Pulls system up time.
1318 */
1319message SystemUptime {
1320 // Milliseconds since the system was booted.
1321 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1322 // for external input).
1323 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1324 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001325}