blob: 8f0a44a68a4b8a4dda7e53f91fb71408d5b2754f [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080025import "frameworks/base/core/proto/android/os/enums.proto";
26import "frameworks/base/core/proto/android/telephony/enums.proto";
27import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080028
Yao Chend54f9dd2017-10-17 17:37:48 +000029/**
Stefan Lafonae2df012017-11-14 09:17:21 -080030 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000031 * raw stats log events from the Android system, also known as "atoms."
32 *
33 * This field contains a single oneof with all of the available messages.
34 * The stats-log-api-gen tool runs as part of the Android build and
35 * generates the android.util.StatsLog class, which contains the constants
36 * and methods that Android uses to log.
37 *
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * Instead, statsd on Android constructs these messages synthetically,
40 * in the format defined here and in stats_log.proto.
41 */
Stefan Lafonae2df012017-11-14 09:17:21 -080042message Atom {
43 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070044 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070045 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
46 BleScanStateChanged ble_scan_state_changed = 2;
47 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
48 BleScanResultReceived ble_scan_result_received = 4;
49 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080050 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070051 SyncStateChanged sync_state_changed = 7;
52 ScheduledJobStateChanged scheduled_job_state_changed = 8;
53 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070054 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080055 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
56 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
57 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
58 // TODO: 14-19 are blank, but need not be
59 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
60 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
61 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070062 AudioStateChanged audio_state_changed = 23;
63 MediaCodecActivityChanged media_codec_activity_changed = 24;
64 CameraStateChanged camera_state_changed = 25;
65 FlashlightStateChanged flashlight_state_changed = 26;
66 UidProcessStateChanged uid_process_state_changed = 27;
67 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
68 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070069 BatteryLevelChanged battery_level_changed = 30;
70 ChargingStateChanged charging_state_changed = 31;
71 PluggedStateChanged plugged_state_changed = 32;
72 DeviceTemperatureReported device_temperature_reported = 33;
73 DeviceOnStatusChanged device_on_status_changed = 34;
74 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
75 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070076 WifiLockStateChanged wifi_lock_state_changed = 37;
77 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
78 WifiScanStateChanged wifi_scan_state_changed = 39;
79 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070080 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070081 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070082 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090083 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080084 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080085 AnomalyDetected anomaly_detected = 46;
86 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000087 AppStartChanged app_start_changed = 48;
88 AppStartCancelChanged app_start_cancel_changed = 49;
89 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080090 LmkEventOccurred lmk_event_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080091 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080092 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Bookatzc1a050a2017-10-10 15:49:28 -070093 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000094 }
David Chenc8a43242017-10-17 16:23:28 -070095
David Chen6e3e6cb2018-01-03 16:14:06 -080096 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070097 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080098 WifiBytesTransfer wifi_bytes_transfer = 10000;
99 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
100 MobileBytesTransfer mobile_bytes_transfer = 10002;
101 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
102 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800103 SubsystemSleepState subsystem_sleep_state = 10005;
104 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800105 CpuTimePerFreq cpu_time_per_freq = 10008;
106 CpuTimePerUid cpu_time_per_uid = 10009;
107 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
108 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
109 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar27572b92018-01-23 16:12:51 -0800110 ProcessMemoryStat process_memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800111 CpuSuspendTime cpu_suspend_time = 10014;
112 CpuIdleTime cpu_idle_time = 10015;
113 CpuActiveTime cpu_active_time = 10016;
114 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800115 DiskSpace disk_space = 10018;
116 SystemUptime system_uptime = 10019;
David Chenc8a43242017-10-17 16:23:28 -0700117 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700118}
119
Yao Chend54f9dd2017-10-17 17:37:48 +0000120/**
Yangster-mac20877162017-12-22 17:19:39 -0800121 * This proto represents a node of an attribution chain.
122 * Note: All attribution chains are represented as a repeated field of type
123 * AttributionNode. It is understood that in such arrays, the order is that
124 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000125 */
Yangster-mac20877162017-12-22 17:19:39 -0800126message AttributionNode {
127 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800128 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800129
Yangster-mac20877162017-12-22 17:19:39 -0800130 // The (optional) string tag for an element in the attribution chain. If the
131 // element has no tag, it is encoded as an empty string.
132 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700133}
134
Yao Chend54f9dd2017-10-17 17:37:48 +0000135/*
136 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800137 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000138 *
139 * RULES:
140 * - The field ids for each atom must start at 1, and count upwards by 1.
141 * Skipping field ids is not allowed.
142 * - These form an API, so renaming, renumbering or removing fields is
143 * not allowed between android releases. (This is not currently enforced,
144 * but there will be a tool to enforce this restriction).
145 * - The types must be built-in protocol buffer types, namely, no sub-messages
146 * are allowed (yet). The bytes type is also not allowed.
147 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800148 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000149 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800150 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000151 * - A field that is a uid should be a string field, tagged with the [xxx]
152 * annotation. The generated code on android will be represented by UIDs,
153 * and those UIDs will be translated in xxx to those strings.
154 *
155 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700156 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000157 * - If there is a UID, it goes first. Think in an object-oriented fashion.
158 * *****************************************************************************
159 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700160
Yao Chend54f9dd2017-10-17 17:37:48 +0000161/**
162 * Logs when the screen state changes.
163 *
164 * Logged from:
165 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
166 */
167message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800168 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
169 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700170}
Yao Chend54f9dd2017-10-17 17:37:48 +0000171
172/**
Bookatzc1a050a2017-10-10 15:49:28 -0700173 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000174 *
175 * Logged from:
176 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
177 */
Bookatzc1a050a2017-10-10 15:49:28 -0700178message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
180
Bookatzdb026a22018-01-10 19:01:56 -0800181 // The state, from frameworks/base/core/proto/android/app/enums.proto.
182 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000183}
184
185/**
Bookatzc1a050a2017-10-10 15:49:28 -0700186 * Logs that a process started, finished, crashed, or ANRed.
187 *
188 * Logged from:
189 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
190 */
191message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700192 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
193
194 // TODO: What is this?
195 optional string name = 2;
196
Bookatzddccf0a2017-11-28 16:48:14 -0800197 // What lifecycle state the process changed to.
198 // This enum is specific to atoms.proto.
199 enum Event {
200 PROCESS_FINISHED = 0;
201 PROCESS_STARTED = 1;
202 PROCESS_CRASHED = 2;
203 PROCESS_ANRED = 3;
204 }
205 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700206}
207
Bookatzc1a050a2017-10-10 15:49:28 -0700208/**
209 * Logs when the ble scan state changes.
210 *
211 * Logged from:
212 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
213 */
214message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800215 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700216
217 enum State {
218 OFF = 0;
219 ON = 1;
220 }
221 optional State state = 2;
222}
223
224/**
225 * Logs when an unoptimized ble scan state changes.
226 *
227 * Logged from:
228 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
229 */
230// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
231message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800232 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700233
234 enum State {
235 OFF = 0;
236 ON = 1;
237 }
238 optional State state = 2;
239}
240
241/**
242 * Logs reporting of a ble scan finding results.
243 *
244 * Logged from:
245 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
246 */
247// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
248message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800249 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700250
251 // Number of ble scan results returned.
252 optional int32 num_of_results = 2;
253}
254
255/**
256 * Logs when a sensor state changes.
257 *
258 * Logged from:
259 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
260 */
261message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800262 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700263
264 // TODO: Is there a way to get the actual name of the sensor?
265 // The id (int) of the sensor.
266 optional int32 sensor_id = 2;
267
268 enum State {
269 OFF = 0;
270 ON = 1;
271 }
272 optional State state = 3;
273}
274
275
276/**
277 * Logs when GPS state changes.
278 *
279 * Logged from:
280 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
281 */
282message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800283 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700284
285 enum State {
286 OFF = 0;
287 ON = 1;
288 }
289 optional State state = 2;
290}
291
292
293/**
294 * Logs when a sync manager sync state changes.
295 *
296 * Logged from:
297 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
298 */
299message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800300 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700301
302 // Name of the sync (as named in the app)
303 optional string name = 2;
304
305 enum State {
306 OFF = 0;
307 ON = 1;
308 }
309 optional State state = 3;
310}
311
312/**
313 * Logs when a job scheduler job state changes.
314 *
315 * Logged from:
316 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
317 */
318message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800319 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700320
321 // Name of the job (as named in the app)
322 optional string name = 2;
323
324 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800325 FINISHED = 0;
326 STARTED = 1;
327 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700328 }
329 optional State state = 3;
330
331 // TODO: Consider adding the stopReason (int)
332}
333
334/**
335 * Logs when the audio state changes.
336 *
337 * Logged from:
338 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
339 */
340message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800341 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700342
343 enum State {
344 OFF = 0;
345 ON = 1;
346 }
347 optional State state = 2;
348}
349
350/**
351 * Logs when the video codec state changes.
352 *
353 * Logged from:
354 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
355 */
356message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800357 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700358
359 enum State {
360 OFF = 0;
361 ON = 1;
362 }
363 optional State state = 2;
364}
365
366/**
367 * Logs when the flashlight state changes.
368 *
369 * Logged from:
370 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
371 */
372message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800373 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700374
375 enum State {
376 OFF = 0;
377 ON = 1;
378 }
379 optional State state = 2;
380}
381
382/**
383 * Logs when the camera state changes.
384 *
385 * Logged from:
386 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
387 */
388message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800389 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700390
391 enum State {
392 OFF = 0;
393 ON = 1;
394 }
395 optional State state = 2;
396}
397
398/**
399 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000400 *
401 * Logged from:
402 * TODO
403 */
Bookatzd6746242017-10-24 18:39:35 -0700404message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800405 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000406
Bookatz1a1b0462018-01-12 11:47:03 -0800407 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
408 // From frameworks/base/core/proto/android/os/enums.proto.
409 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700410
411 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
412 optional string tag = 3;
413
414 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800415 RELEASE = 0;
416 ACQUIRE = 1;
417 CHANGE_RELEASE = 2;
418 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700419 }
420 optional State state = 4;
421}
422
423/**
Bookatzc1a050a2017-10-10 15:49:28 -0700424 * Logs when a partial wakelock is considered 'long' (over 1 min).
425 *
426 * Logged from:
427 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
428 */
429message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800430 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700431
Yao Chend54f9dd2017-10-17 17:37:48 +0000432 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
433 optional string tag = 2;
434
Bookatzc1a050a2017-10-10 15:49:28 -0700435 // TODO: I have no idea what this is.
436 optional string history_tag = 3;
437
438 enum State {
439 OFF = 0;
440 ON = 1;
441 }
442 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000443}
444
Bookatzc1a050a2017-10-10 15:49:28 -0700445/**
446 * Logs Battery Saver state change.
447 *
448 * Logged from:
449 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
450 */
451message BatterySaverModeStateChanged {
452 enum State {
453 OFF = 0;
454 ON = 1;
455 }
456 optional State state = 1;
457}
458
459/**
460 * Logs Doze mode state change.
461 *
462 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800463 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700464 */
465message DeviceIdleModeStateChanged {
466 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800467 enum State {
468 DEVICE_IDLE_MODE_OFF = 0;
469 DEVICE_IDLE_MODE_LIGHT = 1;
470 DEVICE_IDLE_MODE_DEEP = 2;
471 }
472 optional State state = 1;
473}
474
475
476/**
477 * Logs state change of Doze mode including maintenance windows.
478 *
479 * Logged from:
480 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
481 */
482message DeviceIdlingModeStateChanged {
483 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
484 enum State {
485 DEVICE_IDLE_MODE_OFF = 0;
486 DEVICE_IDLE_MODE_LIGHT = 1;
487 DEVICE_IDLE_MODE_DEEP = 2;
488 }
489 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700490}
491
492/**
493 * Logs screen brightness level.
494 *
495 * Logged from:
496 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
497 */
498message ScreenBrightnessChanged {
499 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
500 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700501}
502
503/**
504 * Logs battery level (percent full, from 0 to 100).
505 *
506 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700507 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700508 */
509message BatteryLevelChanged {
510 // Battery level. Should be in [0, 100].
511 optional int32 battery_level = 1;
512}
513
514/**
515 * Logs change in charging status of the device.
516 *
517 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700518 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700519 */
520message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800521 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
522 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700523}
524
525/**
526 * Logs whether the device is plugged in, and what power source it is using.
527 *
528 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700529 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700530 */
531message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800532 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
533 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700534}
535
536/**
537 * Logs the temperature of the device, in tenths of a degree Celsius.
538 *
539 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700540 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700541 */
542message DeviceTemperatureReported {
543 // Temperature in tenths of a degree C.
544 optional int32 temperature = 1;
545}
546
547// TODO: Define this more precisely.
548// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
549/**
550 * Logs when the device turns off or on.
551 *
552 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700553 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700554 */
555message DeviceOnStatusChanged {
556 enum State {
557 OFF = 0;
558 ON = 1;
559 }
560 optional State state = 1;
561}
562
563/**
564 * Logs when an app's wakeup alarm fires.
565 *
566 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700567 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700568 */
569message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800570 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800571
572 // Name of the wakeup alarm.
573 optional string tag = 2;
574}
575
576/**
577 * Logs when an an app causes the mobile radio to change state.
578 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
579 *
580 * Logged from:
581 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
582 */
583message MobileRadioPowerStateChanged {
584 // TODO: Add attribution instead of uid?
585 optional int32 uid = 1;
586
Bookatz1a1b0462018-01-12 11:47:03 -0800587 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
588 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800589}
590
591/**
592 * Logs when an an app causes the wifi radio to change state.
593 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
594 *
595 * Logged from:
596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
597 */
598message WifiRadioPowerStateChanged {
599 // TODO: Add attribution instead of uid?
600 optional int32 uid = 1;
601
Bookatz1a1b0462018-01-12 11:47:03 -0800602 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
603 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700604}
605
606/**
607 * Logs kernel wakeup reasons and aborts.
608 *
609 * Logged from:
610 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
611 */
612message KernelWakeupReported {
613 // Name of the kernel wakeup reason (or abort).
614 optional string wakeup_reason_name = 1;
615
616 // Duration (in microseconds) for the wake-up interrupt to be serviced.
617 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700618}
619
620/**
621 * Logs wifi locks held by an app.
622 *
623 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700624 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700625 */
626message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800627 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700628
629 enum State {
630 OFF = 0;
631 ON = 1;
632 }
633 optional State state = 2;
634}
635
636/**
637 * Logs wifi signal strength changes.
638 *
639 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700640 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700641 */
642message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800643 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
644 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700645}
646
647/**
648 * Logs wifi scans performed by an app.
649 *
650 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700652 */
653message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800654 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700655
656 enum State {
657 OFF = 0;
658 ON = 1;
659 }
660 optional State state = 2;
661}
662
663/**
Tej Singh4503e102018-01-04 14:35:01 -0800664 * Logs wifi multicast locks held by an app
665 *
666 * Logged from:
667 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
668 */
669message WifiMulticastLockStateChanged {
670 repeated AttributionNode attribution_node = 1;
671
672 enum State {
673 OFF = 0;
674 ON = 1;
675 }
676 optional State state = 2;
677}
678
679/**
Bookatze5885242017-10-24 20:10:31 -0700680 * Logs phone signal strength changes.
681 *
682 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700683 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700684 */
685message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800686 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
687 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700688}
689
690/**
691 * Logs that a setting was updated.
692 * Logged from:
693 * frameworks/base/core/java/android/provider/Settings.java
694 * The tag and is_default allow resetting of settings to default values based on the specified
695 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
696 */
697message SettingChanged {
698 // The name of the setting.
699 optional string setting = 1;
700
701 // The change being imposed on this setting. May represent a number, eg "3".
702 optional string value = 2;
703
704 // The new value of this setting. For most settings, this is same as value. For some settings,
705 // value is +X or -X where X represents an element in a set. For example, if the previous value
706 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
707 // The +/- feature is currently only used for location_providers_allowed.
708 optional string new_value = 3;
709
710 // The previous value of this setting.
711 optional string prev_value = 4;
712
713 // The tag used with the is_default for resetting sets of settings. This is generally null.
714 optional string tag = 5;
715
716 // 1 indicates that this setting with tag should be resettable.
717 optional int32 is_default = 6;
718
719 // The user ID associated. Defined in android/os/UserHandle.java
720 optional int32 user = 7;
721}
Chenjie Yub3dda412017-10-24 13:41:59 -0700722
Chenjie Yu05013b32017-11-21 10:21:41 -0800723/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700724 * Logs activity going to foreground or background
725 *
726 * Logged from:
727 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
728 */
729message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800730 optional int32 uid = 1;
731 optional string pkg_name = 2;
732 optional string class_name = 3;
733
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700734 enum Activity {
735 MOVE_TO_BACKGROUND = 0;
736 MOVE_TO_FOREGROUND = 1;
737 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700738 optional Activity activity = 4;
739}
David Chenc8a43242017-10-17 16:23:28 -0700740
741/**
David Chen9e3808c2017-11-20 17:25:34 -0800742 * Logs when an error is written to dropbox.
743 * Logged from:
744 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
745 */
746message DropboxErrorChanged {
747 // The uid if available. -1 means not available.
748 optional int32 uid = 1;
749
750 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
751 optional string tag = 2;
752
753 // The name of the process.
754 optional string process_name = 3;
755
756 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800757 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800758
759 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800760 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800761
762 // The activity name if available.
763 optional string activity_name = 6;
764
David Chen6e3e6cb2018-01-03 16:14:06 -0800765 // The package name if available.
766 optional string package_name = 7;
767
David Chen9e3808c2017-11-20 17:25:34 -0800768 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800769 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800770}
771
David Chen0a368b22017-12-06 16:28:16 -0800772/*
773 * Allows other apps to push events into statsd.
774 * Logged from:
775 * frameworks/base/core/java/android/util/StatsLog.java
776 */
777message AppHook {
778 // The uid of the application that sent this custom atom.
779 optional int32 uid = 1;
780
781 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
782 optional int32 label = 2;
783
784 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
785 // predicates for the metrics).
786 enum State {
787 UNKNOWN = 0;
788 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
789 STOP = 2;
790 START = 3;
791 }
792 optional State state = 3;
793}
794
David Chen9e3808c2017-11-20 17:25:34 -0800795/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800796 * Logs when statsd detects an anomaly.
797 *
798 * Logged from:
799 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
800 */
801message AnomalyDetected {
802 // Uid that owns the config whose anomaly detection alert fired.
803 optional int32 config_uid = 1;
804
Yangster-mac94e197c2018-01-02 16:03:03 -0800805 // Id of the config whose anomaly detection alert fired.
806 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800807
Yangster-mac94e197c2018-01-02 16:03:03 -0800808 // Id of the alert (i.e. name of the anomaly that was detected).
809 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800810}
811
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000812message AppStartChanged {
813 // The uid if available. -1 means not available.
814 optional int32 uid = 1;
815
816 // The app package name.
817 optional string pkg_name = 2;
818
819 enum TransitionType {
820 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
821 WARM = 1;
822 HOT = 2;
823 COLD = 3;
824 }
825 // The transition type.
826 optional TransitionType type = 3;
827
828 // The activity name.
829 optional string activity_name = 4;
830
831 // The name of the calling app. Empty if not set.
832 optional string calling_pkg_name = 5;
833
834 // Whether the app is an instant app.
835 optional bool is_instant_app = 6;
836
837 // Device uptime when activity started.
838 optional int64 activity_start_msec = 7;
839
840 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
841 enum TransitionReason {
842 APP_START_TRANSITION_REASON_UNKNOWN = 0;
843 SPLASH_SCREEN = 1;
844 WINDOWS_DRAWN = 2;
845 TIMEOUT = 3;
846 SNAPSHOT = 4;
847 }
848 optional TransitionReason reason = 8;
849
850 optional int32 transition_delay_msec = 9;
851 // -1 if not set.
852 optional int32 starting_window_delay_msec = 10;
853 // -1 if not set.
854 optional int32 bind_application_delay_msec = 11;
855 optional int32 windows_drawn_delay_msec = 12;
856
857 // Empty if not set.
858 optional string launch_token = 13;
859
860}
861
862message AppStartCancelChanged {
863 // The uid if available. -1 means not available.
864 optional int32 uid = 1;
865
866 // The app package name.
867 optional string pkg_name = 2;
868
869 enum TransitionType {
870 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
871 WARM = 1;
872 HOT = 2;
873 COLD = 3;
874 }
875 // The transition type.
876 optional TransitionType type = 3;
877
878 // The activity name.
879 optional string activity_name = 4;
880}
881
882message AppStartFullyDrawnChanged {
883 // The uid if available. -1 means not available.
884 optional int32 uid = 1;
885
886 // The app package name.
887 optional string pkg_name = 2;
888
889 enum TransitionType {
890 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
891 WITH_BUNDLE = 1;
892 WITHOUT_BUNDLE = 2;
893 }
894 // The transition type.
895 optional TransitionType type = 3;
896
897 // The activity name.
898 optional string activity_name = 4;
899
900 optional bool transition_process_running = 5;
901
902 // App startup time (until call to Activity#reportFullyDrawn()).
903 optional int64 app_startup_time_ms = 6;
904}
905
Bookatz8fcd09a2017-12-18 13:01:10 -0800906/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800907 * Logs a picture-in-picture action
908 * Logged from:
909 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
910 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
911 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
912 */
913message PictureInPictureStateChanged {
914 optional int32 uid = 1;
915
916 optional string package_name = 2;
917
918 optional string class_name = 3;
919
920 // Picture-in-Picture action occurred, similar to
921 // frameworks/base/proto/src/metrics_constants.proto
922 enum State {
923 ENTERED = 1;
924 EXPANDED_TO_FULL_SCREEN = 2;
925 MINIMIZED = 3;
926 DISMISSED = 4;
927 }
928 optional State state = 4;
929}
930
931/**
David Chenc8a43242017-10-17 16:23:28 -0700932 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
933 *
934 * Pulled from:
935 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
936 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800937message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700938 optional int32 uid = 1;
939
940 optional int64 rx_bytes = 2;
941
942 optional int64 rx_packets = 3;
943
944 optional int64 tx_bytes = 4;
945
946 optional int64 tx_packets = 5;
947}
948
949/**
950 * Pulls bytes transferred via wifi (separated by foreground and background usage).
951 *
952 * Pulled from:
953 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
954 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800955message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700956 optional int32 uid = 1;
957
958 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
959 optional int32 is_foreground = 2;
960
961 optional int64 rx_bytes = 3;
962
963 optional int64 rx_packets = 4;
964
965 optional int64 tx_bytes = 5;
966
967 optional int64 tx_packets = 6;
968}
969
970/**
971 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
972 *
973 * Pulled from:
974 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
975 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800976message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700977 optional int32 uid = 1;
978
979 optional int64 rx_bytes = 2;
980
981 optional int64 rx_packets = 3;
982
983 optional int64 tx_bytes = 4;
984
985 optional int64 tx_packets = 5;
986}
987
988/**
989 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
990 *
991 * Pulled from:
992 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
993 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800994message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700995 optional int32 uid = 1;
996
997 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
998 optional int32 is_foreground = 2;
999
1000 optional int64 rx_bytes = 3;
1001
1002 optional int64 rx_packets = 4;
1003
1004 optional int64 tx_bytes = 5;
1005
1006 optional int64 tx_packets = 6;
1007}
1008
1009/**
1010 * Pulls the kernel wakelock durations. This atom is adapted from
1011 * android/internal/os/KernelWakelockStats.java
1012 *
1013 * Pulled from:
1014 * StatsCompanionService using KernelWakelockReader.
1015 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001016message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001017 optional string name = 1;
1018
1019 optional int32 count = 2;
1020
1021 optional int32 version = 3;
1022
1023 optional int64 time = 4;
1024}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001025
Chenjie Yu05013b32017-11-21 10:21:41 -08001026/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001027 * Pulls low power state information. This includes platform and subsystem sleep state information,
1028 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001029 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001030 * hardware/interfaces/power/1.1/types.hal
1031 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001032message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001033 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1034 // YYY is corresponding voter name.
1035 // If there are no voters, the format should just be XXX (with no dot).
1036 // XXX and YYY should not contain a "." in it.
1037 optional string name = 1;
1038 // The number of times it entered, or voted for entering the sleep state
1039 optional uint64 count = 2;
1040 // The length of time spent in, or spent voting for, the sleep state
1041 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001042}
David Chen21582962017-11-01 17:32:46 -07001043
1044/**
1045 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1046 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1047 * attributed back to the parent (host) uid. One example is Chrome.
1048 *
1049 * Logged from:
1050 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1051 */
1052message IsolatedUidChanged {
1053 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1054 optional int32 parent_uid = 1;
1055
1056 optional int32 isolated_uid = 2;
1057
1058 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1059 // be removed before if it's used for another parent uid.
1060 optional int32 is_create = 3;
1061}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001062
Chenjie Yu05013b32017-11-21 10:21:41 -08001063/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001064 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001065 * Pulls the time the cpu spend on the frequency index. Frequency index
1066 * starts from highest to lowest. The value should be monotonically
1067 * increasing since boot. However, if there is a cpu
1068 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001069 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001070message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001071 optional uint32 cluster = 1;
1072 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001073 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001074}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001075
Chenjie Yu05013b32017-11-21 10:21:41 -08001076/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001077 * Pulls Cpu Time Per Uid.
1078 * Note that isolated process uid time should be attributed to host uids.
1079 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001080message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001081 optional uint64 uid = 1;
1082 optional uint64 user_time_ms = 2;
1083 optional uint64 sys_time_ms = 3;
1084}
1085
1086/**
1087 * Pulls Cpu Time Per Uid per frequency.
1088 * Note that isolated process uid time should be attributed to host uids.
1089 * For each uid, we order the time by descending frequencies.
1090 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001091message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001092 optional uint64 uid = 1;
1093 optional uint64 freq_idx = 2;
1094 optional uint64 time_ms = 3;
1095}
Hugo Benichi884970e2017-11-14 22:42:46 +09001096
1097/*
1098 * Logs the reception of an incoming network packet causing the main system to wake up for
1099 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1100 * and processed by WakeupController.cpp.
1101 */
1102message PacketWakeupOccurred {
1103 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1104 // delivered nowhere.
1105 optional int32 uid = 1;
1106 // The interface name on which the packet was received.
1107 optional string iface = 2;
1108 // The ethertype value of the packet.
1109 optional int32 ethertype = 3;
1110 // String representation of the destination MAC address of the packet.
1111 optional string destination_hardware_address = 4;
1112 // String representation of the source address of the packet if this was an IP packet.
1113 optional string source_ip = 5;
1114 // String representation of the destination address of the packet if this was an IP packet.
1115 optional string destination_ip = 6;
1116 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1117 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1118 // families.
1119 optional int32 ip_next_header = 7;
1120 // The source port if this was a TCP or UDP packet.
1121 optional int32 source_port = 8;
1122 // The destination port if this was a TCP or UDP packet.
1123 optional int32 destination_port = 9;
1124}
Chenjie Yu05013b32017-11-21 10:21:41 -08001125
1126/**
1127 * Pulls Wifi Controller Activity Energy Info
1128 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001129message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001130 // timestamp(wall clock) of record creation
1131 optional uint64 timestamp_ms = 1;
1132 // stack reported state
1133 // TODO: replace this with proto enum
1134 optional int32 stack_state = 2;
1135 // tx time in ms
1136 optional uint64 controller_tx_time_ms = 3;
1137 // rx time in ms
1138 optional uint64 controller_rx_time_ms = 4;
1139 // idle time in ms
1140 optional uint64 controller_idle_time_ms = 5;
1141 // product of current(mA), voltage(V) and time(ms)
1142 optional uint64 controller_energy_used = 6;
1143}
1144
1145/**
1146 * Pulls Modem Activity Energy Info
1147 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001148message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001149 // timestamp(wall clock) of record creation
1150 optional uint64 timestamp_ms = 1;
1151 // sleep time in ms.
1152 optional uint64 sleep_time_ms = 2;
1153 // idle time in ms
1154 optional uint64 controller_idle_time_ms = 3;
1155 /**
1156 * Tx power index
1157 * index 0 = tx_power < 0dBm
1158 * index 1 = 0dBm < tx_power < 5dBm
1159 * index 2 = 5dBm < tx_power < 15dBm
1160 * index 3 = 15dBm < tx_power < 20dBm
1161 * index 4 = tx_power > 20dBm
1162 */
1163 // tx time in ms at power level 0
1164 optional uint64 controller_tx_time_pl0_ms = 4;
1165 // tx time in ms at power level 1
1166 optional uint64 controller_tx_time_pl1_ms = 5;
1167 // tx time in ms at power level 2
1168 optional uint64 controller_tx_time_pl2_ms = 6;
1169 // tx time in ms at power level 3
1170 optional uint64 controller_tx_time_pl3_ms = 7;
1171 // tx time in ms at power level 4
1172 optional uint64 controller_tx_time_pl4_ms = 8;
1173 // rx time in ms at power level 5
1174 optional uint64 controller_rx_time_ms = 9;
1175 // product of current(mA), voltage(V) and time(ms)
1176 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001177}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001178
1179/*
1180 * Logs the memory stats for a process
1181 */
Rajeev Kumar27572b92018-01-23 16:12:51 -08001182message ProcessMemoryStat {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001183 // The uid if available. -1 means not available.
1184 optional int32 uid = 1;
1185
Rajeev Kumar27572b92018-01-23 16:12:51 -08001186 // The process name.
1187 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001188
1189 // # of page-faults
1190 optional int64 pgfault = 3;
1191
1192 // # of major page-faults
1193 optional int64 pgmajfault = 4;
1194
1195 // RSS+CACHE(+SWAP)
1196 optional int64 usage_in_bytes = 5;
1197}
1198
1199/*
1200 * Logs the event when LMKD kills a process to reduce memory pressure
1201 * Logged from:
1202 * system/core/lmkd/lmkd.c
1203 */
1204message LmkEventOccurred {
1205 // The uid if available. -1 means not available.
1206 optional int32 uid = 1;
1207
Rajeev Kumar27572b92018-01-23 16:12:51 -08001208 // The process name.
1209 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001210
1211 // oom adj score.
1212 optional int32 oom_score = 3;
1213
Rajeev Kumar27572b92018-01-23 16:12:51 -08001214 // # of page-faults
1215 optional int64 pgfault = 4;
1216
1217 // # of major page-faults
1218 optional int64 pgmajfault = 5;
1219
1220 // RSS+CACHE(+SWAP)
1221 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001222}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001223
1224/*
1225 * Cpu syspend time for cpu power calculation.
1226 */
1227message CpuSuspendTime {
1228 optional uint64 time = 1;
1229}
1230
1231/*
1232 * Cpu idle time for cpu power calculation.
1233 */
1234message CpuIdleTime {
1235 optional uint64 time = 1;
1236}
1237
1238/*
1239 * Reads from /proc/uid_concurrent_active_time which has the format:
1240 * active: X (X is # cores)
1241 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1242 * [uid1]: [time-0] [time-1] [time-2] ... ...
1243 * ...
1244 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1245 * The file contains a monotonically increasing count of time for a single boot.
1246 */
1247message CpuActiveTime {
1248 optional uint64 uid = 1;
1249 optional uint64 idx = 2;
1250 optional uint64 time_ms = 3;
1251}
1252
1253/**
1254 * Reads from /proc/uid_concurrent_policy_time which has the format:
1255 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1256 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1257 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1258 * ...
1259 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1260 * The file contains a monotonically increasing count of time for a single boot.
1261 */
1262message CpuClusterTime {
1263 optional uint64 uid = 1;
1264 optional uint64 idx = 2;
1265 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001266}
1267
1268/*
1269 * Pulls free disk space, for data, system partition and temporary directory.
1270 */
1271message DiskSpace {
1272 // available bytes in data partition
1273 optional uint64 data_available_bytes = 1;
1274 // available bytes in system partition
1275 optional uint64 system_available_bytes = 2;
1276 // available bytes in download cache or temp directories
1277 optional uint64 temp_available_bytes = 3;
1278}
1279
1280/*
1281 * Pulls system up time.
1282 */
1283message SystemUptime {
1284 // Milliseconds since the system was booted.
1285 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1286 // for external input).
1287 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1288 optional uint64 uptime_ms = 1;
Tej Singh4503e102018-01-04 14:35:01 -08001289}