blob: 2dff40ce6cf22ca3d2bc934ed97cbd9baebb4693 [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";
Bookatz8bdae8d2018-01-16 11:24:30 -080026import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/telephony/enums.proto";
28import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080029
Yao Chend54f9dd2017-10-17 17:37:48 +000030/**
Stefan Lafonae2df012017-11-14 09:17:21 -080031 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000032 * raw stats log events from the Android system, also known as "atoms."
33 *
34 * This field contains a single oneof with all of the available messages.
35 * The stats-log-api-gen tool runs as part of the Android build and
36 * generates the android.util.StatsLog class, which contains the constants
37 * and methods that Android uses to log.
38 *
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * Instead, statsd on Android constructs these messages synthetically,
41 * in the format defined here and in stats_log.proto.
42 */
Stefan Lafonae2df012017-11-14 09:17:21 -080043message Atom {
44 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070045 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070046 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
47 BleScanStateChanged ble_scan_state_changed = 2;
48 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
49 BleScanResultReceived ble_scan_result_received = 4;
50 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080051 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070052 SyncStateChanged sync_state_changed = 7;
53 ScheduledJobStateChanged scheduled_job_state_changed = 8;
54 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070055 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080056 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
57 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
58 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
59 // TODO: 14-19 are blank, but need not be
60 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
61 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
62 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070063 AudioStateChanged audio_state_changed = 23;
64 MediaCodecActivityChanged media_codec_activity_changed = 24;
65 CameraStateChanged camera_state_changed = 25;
66 FlashlightStateChanged flashlight_state_changed = 26;
67 UidProcessStateChanged uid_process_state_changed = 27;
68 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
69 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070070 BatteryLevelChanged battery_level_changed = 30;
71 ChargingStateChanged charging_state_changed = 31;
72 PluggedStateChanged plugged_state_changed = 32;
73 DeviceTemperatureReported device_temperature_reported = 33;
74 DeviceOnStatusChanged device_on_status_changed = 34;
75 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
76 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070077 WifiLockStateChanged wifi_lock_state_changed = 37;
78 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
79 WifiScanStateChanged wifi_scan_state_changed = 39;
80 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070081 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070082 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070083 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090084 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080085 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080086 AnomalyDetected anomaly_detected = 46;
87 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000088 AppStartChanged app_start_changed = 48;
89 AppStartCancelChanged app_start_cancel_changed = 49;
90 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080091 LmkEventOccurred lmk_event_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080092 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080093 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Bookatzc1a050a2017-10-10 15:49:28 -070094 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000095 }
David Chenc8a43242017-10-17 16:23:28 -070096
David Chen6e3e6cb2018-01-03 16:14:06 -080097 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070098 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080099 WifiBytesTransfer wifi_bytes_transfer = 10000;
100 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
101 MobileBytesTransfer mobile_bytes_transfer = 10002;
102 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
103 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800104 SubsystemSleepState subsystem_sleep_state = 10005;
105 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800106 CpuTimePerFreq cpu_time_per_freq = 10008;
107 CpuTimePerUid cpu_time_per_uid = 10009;
108 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
109 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
110 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar27572b92018-01-23 16:12:51 -0800111 ProcessMemoryStat process_memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800112 CpuSuspendTime cpu_suspend_time = 10014;
113 CpuIdleTime cpu_idle_time = 10015;
114 CpuActiveTime cpu_active_time = 10016;
115 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800116 DiskSpace disk_space = 10018;
117 SystemUptime system_uptime = 10019;
David Chenc8a43242017-10-17 16:23:28 -0700118 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700119}
120
Yao Chend54f9dd2017-10-17 17:37:48 +0000121/**
Yangster-mac20877162017-12-22 17:19:39 -0800122 * This proto represents a node of an attribution chain.
123 * Note: All attribution chains are represented as a repeated field of type
124 * AttributionNode. It is understood that in such arrays, the order is that
125 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000126 */
Yangster-mac20877162017-12-22 17:19:39 -0800127message AttributionNode {
128 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800129 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800130
Yangster-mac20877162017-12-22 17:19:39 -0800131 // The (optional) string tag for an element in the attribution chain. If the
132 // element has no tag, it is encoded as an empty string.
133 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700134}
135
Yao Chend54f9dd2017-10-17 17:37:48 +0000136/*
137 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800138 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000139 *
140 * RULES:
141 * - The field ids for each atom must start at 1, and count upwards by 1.
142 * Skipping field ids is not allowed.
143 * - These form an API, so renaming, renumbering or removing fields is
144 * not allowed between android releases. (This is not currently enforced,
145 * but there will be a tool to enforce this restriction).
146 * - The types must be built-in protocol buffer types, namely, no sub-messages
147 * are allowed (yet). The bytes type is also not allowed.
148 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800149 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000150 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800151 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000152 * - A field that is a uid should be a string field, tagged with the [xxx]
153 * annotation. The generated code on android will be represented by UIDs,
154 * and those UIDs will be translated in xxx to those strings.
155 *
156 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700157 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000158 * - If there is a UID, it goes first. Think in an object-oriented fashion.
159 * *****************************************************************************
160 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700161
Yao Chend54f9dd2017-10-17 17:37:48 +0000162/**
163 * Logs when the screen state changes.
164 *
165 * Logged from:
166 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
167 */
168message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800169 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
170 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700171}
Yao Chend54f9dd2017-10-17 17:37:48 +0000172
173/**
Bookatzc1a050a2017-10-10 15:49:28 -0700174 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000175 *
176 * Logged from:
177 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
178 */
Bookatzc1a050a2017-10-10 15:49:28 -0700179message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
181
Bookatzdb026a22018-01-10 19:01:56 -0800182 // The state, from frameworks/base/core/proto/android/app/enums.proto.
183 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000184}
185
186/**
Bookatzc1a050a2017-10-10 15:49:28 -0700187 * Logs that a process started, finished, crashed, or ANRed.
188 *
189 * Logged from:
190 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
191 */
192message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700193 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
194
195 // TODO: What is this?
196 optional string name = 2;
197
Bookatzddccf0a2017-11-28 16:48:14 -0800198 // What lifecycle state the process changed to.
199 // This enum is specific to atoms.proto.
200 enum Event {
201 PROCESS_FINISHED = 0;
202 PROCESS_STARTED = 1;
203 PROCESS_CRASHED = 2;
204 PROCESS_ANRED = 3;
205 }
206 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700207}
208
Bookatzc1a050a2017-10-10 15:49:28 -0700209/**
210 * Logs when the ble scan state changes.
211 *
212 * Logged from:
213 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
214 */
215message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800216 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700217
218 enum State {
219 OFF = 0;
220 ON = 1;
221 }
222 optional State state = 2;
223}
224
225/**
226 * Logs when an unoptimized ble scan state changes.
227 *
228 * Logged from:
229 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
230 */
231// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
232message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800233 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700234
235 enum State {
236 OFF = 0;
237 ON = 1;
238 }
239 optional State state = 2;
240}
241
242/**
243 * Logs reporting of a ble scan finding results.
244 *
245 * Logged from:
246 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
247 */
248// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
249message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800250 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700251
252 // Number of ble scan results returned.
253 optional int32 num_of_results = 2;
254}
255
256/**
257 * Logs when a sensor state changes.
258 *
259 * Logged from:
260 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
261 */
262message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800263 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700264
265 // TODO: Is there a way to get the actual name of the sensor?
266 // The id (int) of the sensor.
267 optional int32 sensor_id = 2;
268
269 enum State {
270 OFF = 0;
271 ON = 1;
272 }
273 optional State state = 3;
274}
275
276
277/**
278 * Logs when GPS state changes.
279 *
280 * Logged from:
281 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
282 */
283message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800284 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700285
286 enum State {
287 OFF = 0;
288 ON = 1;
289 }
290 optional State state = 2;
291}
292
293
294/**
295 * Logs when a sync manager sync state changes.
296 *
297 * Logged from:
298 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
299 */
300message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800301 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700302
303 // Name of the sync (as named in the app)
304 optional string name = 2;
305
306 enum State {
307 OFF = 0;
308 ON = 1;
309 }
310 optional State state = 3;
311}
312
313/**
314 * Logs when a job scheduler job state changes.
315 *
316 * Logged from:
317 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
318 */
319message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800320 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700321
322 // Name of the job (as named in the app)
323 optional string name = 2;
324
325 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800326 FINISHED = 0;
327 STARTED = 1;
328 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700329 }
330 optional State state = 3;
331
332 // TODO: Consider adding the stopReason (int)
333}
334
335/**
336 * Logs when the audio state changes.
337 *
338 * Logged from:
339 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
340 */
341message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800342 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700343
344 enum State {
345 OFF = 0;
346 ON = 1;
347 }
348 optional State state = 2;
349}
350
351/**
352 * Logs when the video codec state changes.
353 *
354 * Logged from:
355 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
356 */
357message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800358 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700359
360 enum State {
361 OFF = 0;
362 ON = 1;
363 }
364 optional State state = 2;
365}
366
367/**
368 * Logs when the flashlight state changes.
369 *
370 * Logged from:
371 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
372 */
373message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800374 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700375
376 enum State {
377 OFF = 0;
378 ON = 1;
379 }
380 optional State state = 2;
381}
382
383/**
384 * Logs when the camera state changes.
385 *
386 * Logged from:
387 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
388 */
389message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800390 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700391
392 enum State {
393 OFF = 0;
394 ON = 1;
395 }
396 optional State state = 2;
397}
398
399/**
400 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000401 *
402 * Logged from:
403 * TODO
404 */
Bookatzd6746242017-10-24 18:39:35 -0700405message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800406 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000407
Bookatz1a1b0462018-01-12 11:47:03 -0800408 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
409 // From frameworks/base/core/proto/android/os/enums.proto.
410 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700411
412 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
413 optional string tag = 3;
414
415 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800416 RELEASE = 0;
417 ACQUIRE = 1;
418 CHANGE_RELEASE = 2;
419 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700420 }
421 optional State state = 4;
422}
423
424/**
Bookatzc1a050a2017-10-10 15:49:28 -0700425 * Logs when a partial wakelock is considered 'long' (over 1 min).
426 *
427 * Logged from:
428 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
429 */
430message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800431 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700432
Yao Chend54f9dd2017-10-17 17:37:48 +0000433 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
434 optional string tag = 2;
435
Bookatzc1a050a2017-10-10 15:49:28 -0700436 // TODO: I have no idea what this is.
437 optional string history_tag = 3;
438
439 enum State {
440 OFF = 0;
441 ON = 1;
442 }
443 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000444}
445
Bookatzc1a050a2017-10-10 15:49:28 -0700446/**
447 * Logs Battery Saver state change.
448 *
449 * Logged from:
450 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
451 */
452message BatterySaverModeStateChanged {
453 enum State {
454 OFF = 0;
455 ON = 1;
456 }
457 optional State state = 1;
458}
459
460/**
461 * Logs Doze mode state change.
462 *
463 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800464 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700465 */
466message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800467 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800468}
469
470
471/**
472 * Logs state change of Doze mode including maintenance windows.
473 *
474 * Logged from:
475 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
476 */
477message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800478 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700479}
480
481/**
482 * Logs screen brightness level.
483 *
484 * Logged from:
485 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
486 */
487message ScreenBrightnessChanged {
488 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
489 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700490}
491
492/**
493 * Logs battery level (percent full, from 0 to 100).
494 *
495 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700496 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700497 */
498message BatteryLevelChanged {
499 // Battery level. Should be in [0, 100].
500 optional int32 battery_level = 1;
501}
502
503/**
504 * Logs change in charging status of the device.
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 ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800510 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
511 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700512}
513
514/**
515 * Logs whether the device is plugged in, and what power source it is using.
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 PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800521 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
522 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700523}
524
525/**
526 * Logs the temperature of the device, in tenths of a degree Celsius.
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 DeviceTemperatureReported {
532 // Temperature in tenths of a degree C.
533 optional int32 temperature = 1;
534}
535
536// TODO: Define this more precisely.
537// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
538/**
539 * Logs when the device turns off or on.
540 *
541 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700542 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700543 */
544message DeviceOnStatusChanged {
545 enum State {
546 OFF = 0;
547 ON = 1;
548 }
549 optional State state = 1;
550}
551
552/**
553 * Logs when an app's wakeup alarm fires.
554 *
555 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700556 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700557 */
558message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800559 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800560
561 // Name of the wakeup alarm.
562 optional string tag = 2;
563}
564
565/**
566 * Logs when an an app causes the mobile radio to change state.
567 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
568 *
569 * Logged from:
570 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
571 */
572message MobileRadioPowerStateChanged {
573 // TODO: Add attribution instead of uid?
574 optional int32 uid = 1;
575
Bookatz1a1b0462018-01-12 11:47:03 -0800576 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
577 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800578}
579
580/**
581 * Logs when an an app causes the wifi radio to change state.
582 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
583 *
584 * Logged from:
585 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
586 */
587message WifiRadioPowerStateChanged {
588 // TODO: Add attribution instead of uid?
589 optional int32 uid = 1;
590
Bookatz1a1b0462018-01-12 11:47:03 -0800591 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
592 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700593}
594
595/**
596 * Logs kernel wakeup reasons and aborts.
597 *
598 * Logged from:
599 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
600 */
601message KernelWakeupReported {
602 // Name of the kernel wakeup reason (or abort).
603 optional string wakeup_reason_name = 1;
604
605 // Duration (in microseconds) for the wake-up interrupt to be serviced.
606 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700607}
608
609/**
610 * Logs wifi locks held by an app.
611 *
612 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700613 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700614 */
615message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800616 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700617
618 enum State {
619 OFF = 0;
620 ON = 1;
621 }
622 optional State state = 2;
623}
624
625/**
626 * Logs wifi signal strength changes.
627 *
628 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700629 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700630 */
631message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800632 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
633 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700634}
635
636/**
637 * Logs wifi scans performed by an app.
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 WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800643 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700644
645 enum State {
646 OFF = 0;
647 ON = 1;
648 }
649 optional State state = 2;
650}
651
652/**
Tej Singh4503e102018-01-04 14:35:01 -0800653 * Logs wifi multicast locks held by an app
654 *
655 * Logged from:
656 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
657 */
658message WifiMulticastLockStateChanged {
659 repeated AttributionNode attribution_node = 1;
660
661 enum State {
662 OFF = 0;
663 ON = 1;
664 }
665 optional State state = 2;
666}
667
668/**
Bookatze5885242017-10-24 20:10:31 -0700669 * Logs phone signal strength changes.
670 *
671 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700672 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700673 */
674message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800675 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
676 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700677}
678
679/**
680 * Logs that a setting was updated.
681 * Logged from:
682 * frameworks/base/core/java/android/provider/Settings.java
683 * The tag and is_default allow resetting of settings to default values based on the specified
684 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
685 */
686message SettingChanged {
687 // The name of the setting.
688 optional string setting = 1;
689
690 // The change being imposed on this setting. May represent a number, eg "3".
691 optional string value = 2;
692
693 // The new value of this setting. For most settings, this is same as value. For some settings,
694 // value is +X or -X where X represents an element in a set. For example, if the previous value
695 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
696 // The +/- feature is currently only used for location_providers_allowed.
697 optional string new_value = 3;
698
699 // The previous value of this setting.
700 optional string prev_value = 4;
701
702 // The tag used with the is_default for resetting sets of settings. This is generally null.
703 optional string tag = 5;
704
705 // 1 indicates that this setting with tag should be resettable.
706 optional int32 is_default = 6;
707
708 // The user ID associated. Defined in android/os/UserHandle.java
709 optional int32 user = 7;
710}
Chenjie Yub3dda412017-10-24 13:41:59 -0700711
Chenjie Yu05013b32017-11-21 10:21:41 -0800712/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700713 * Logs activity going to foreground or background
714 *
715 * Logged from:
716 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
717 */
718message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800719 optional int32 uid = 1;
720 optional string pkg_name = 2;
721 optional string class_name = 3;
722
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700723 enum Activity {
724 MOVE_TO_BACKGROUND = 0;
725 MOVE_TO_FOREGROUND = 1;
726 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700727 optional Activity activity = 4;
728}
David Chenc8a43242017-10-17 16:23:28 -0700729
730/**
David Chen9e3808c2017-11-20 17:25:34 -0800731 * Logs when an error is written to dropbox.
732 * Logged from:
733 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
734 */
735message DropboxErrorChanged {
736 // The uid if available. -1 means not available.
737 optional int32 uid = 1;
738
739 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
740 optional string tag = 2;
741
742 // The name of the process.
743 optional string process_name = 3;
744
745 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800746 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800747
748 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800749 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800750
751 // The activity name if available.
752 optional string activity_name = 6;
753
David Chen6e3e6cb2018-01-03 16:14:06 -0800754 // The package name if available.
755 optional string package_name = 7;
756
David Chen9e3808c2017-11-20 17:25:34 -0800757 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800758 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800759}
760
David Chen0a368b22017-12-06 16:28:16 -0800761/*
762 * Allows other apps to push events into statsd.
763 * Logged from:
764 * frameworks/base/core/java/android/util/StatsLog.java
765 */
766message AppHook {
767 // The uid of the application that sent this custom atom.
768 optional int32 uid = 1;
769
770 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
771 optional int32 label = 2;
772
773 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
774 // predicates for the metrics).
775 enum State {
776 UNKNOWN = 0;
777 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
778 STOP = 2;
779 START = 3;
780 }
781 optional State state = 3;
782}
783
David Chen9e3808c2017-11-20 17:25:34 -0800784/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800785 * Logs when statsd detects an anomaly.
786 *
787 * Logged from:
788 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
789 */
790message AnomalyDetected {
791 // Uid that owns the config whose anomaly detection alert fired.
792 optional int32 config_uid = 1;
793
Yangster-mac94e197c2018-01-02 16:03:03 -0800794 // Id of the config whose anomaly detection alert fired.
795 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800796
Yangster-mac94e197c2018-01-02 16:03:03 -0800797 // Id of the alert (i.e. name of the anomaly that was detected).
798 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800799}
800
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000801message AppStartChanged {
802 // The uid if available. -1 means not available.
803 optional int32 uid = 1;
804
805 // The app package name.
806 optional string pkg_name = 2;
807
808 enum TransitionType {
809 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
810 WARM = 1;
811 HOT = 2;
812 COLD = 3;
813 }
814 // The transition type.
815 optional TransitionType type = 3;
816
817 // The activity name.
818 optional string activity_name = 4;
819
820 // The name of the calling app. Empty if not set.
821 optional string calling_pkg_name = 5;
822
823 // Whether the app is an instant app.
824 optional bool is_instant_app = 6;
825
826 // Device uptime when activity started.
827 optional int64 activity_start_msec = 7;
828
829 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
830 enum TransitionReason {
831 APP_START_TRANSITION_REASON_UNKNOWN = 0;
832 SPLASH_SCREEN = 1;
833 WINDOWS_DRAWN = 2;
834 TIMEOUT = 3;
835 SNAPSHOT = 4;
836 }
837 optional TransitionReason reason = 8;
838
839 optional int32 transition_delay_msec = 9;
840 // -1 if not set.
841 optional int32 starting_window_delay_msec = 10;
842 // -1 if not set.
843 optional int32 bind_application_delay_msec = 11;
844 optional int32 windows_drawn_delay_msec = 12;
845
846 // Empty if not set.
847 optional string launch_token = 13;
848
849}
850
851message AppStartCancelChanged {
852 // The uid if available. -1 means not available.
853 optional int32 uid = 1;
854
855 // The app package name.
856 optional string pkg_name = 2;
857
858 enum TransitionType {
859 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
860 WARM = 1;
861 HOT = 2;
862 COLD = 3;
863 }
864 // The transition type.
865 optional TransitionType type = 3;
866
867 // The activity name.
868 optional string activity_name = 4;
869}
870
871message AppStartFullyDrawnChanged {
872 // The uid if available. -1 means not available.
873 optional int32 uid = 1;
874
875 // The app package name.
876 optional string pkg_name = 2;
877
878 enum TransitionType {
879 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
880 WITH_BUNDLE = 1;
881 WITHOUT_BUNDLE = 2;
882 }
883 // The transition type.
884 optional TransitionType type = 3;
885
886 // The activity name.
887 optional string activity_name = 4;
888
889 optional bool transition_process_running = 5;
890
891 // App startup time (until call to Activity#reportFullyDrawn()).
892 optional int64 app_startup_time_ms = 6;
893}
894
Bookatz8fcd09a2017-12-18 13:01:10 -0800895/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800896 * Logs a picture-in-picture action
897 * Logged from:
898 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
899 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
900 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
901 */
902message PictureInPictureStateChanged {
903 optional int32 uid = 1;
904
905 optional string package_name = 2;
906
907 optional string class_name = 3;
908
909 // Picture-in-Picture action occurred, similar to
910 // frameworks/base/proto/src/metrics_constants.proto
911 enum State {
912 ENTERED = 1;
913 EXPANDED_TO_FULL_SCREEN = 2;
914 MINIMIZED = 3;
915 DISMISSED = 4;
916 }
917 optional State state = 4;
918}
919
920/**
David Chenc8a43242017-10-17 16:23:28 -0700921 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
922 *
923 * Pulled from:
924 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
925 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800926message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700927 optional int32 uid = 1;
928
929 optional int64 rx_bytes = 2;
930
931 optional int64 rx_packets = 3;
932
933 optional int64 tx_bytes = 4;
934
935 optional int64 tx_packets = 5;
936}
937
938/**
939 * Pulls bytes transferred via wifi (separated by foreground and background usage).
940 *
941 * Pulled from:
942 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
943 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800944message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700945 optional int32 uid = 1;
946
947 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
948 optional int32 is_foreground = 2;
949
950 optional int64 rx_bytes = 3;
951
952 optional int64 rx_packets = 4;
953
954 optional int64 tx_bytes = 5;
955
956 optional int64 tx_packets = 6;
957}
958
959/**
960 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
961 *
962 * Pulled from:
963 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
964 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800965message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700966 optional int32 uid = 1;
967
968 optional int64 rx_bytes = 2;
969
970 optional int64 rx_packets = 3;
971
972 optional int64 tx_bytes = 4;
973
974 optional int64 tx_packets = 5;
975}
976
977/**
978 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
979 *
980 * Pulled from:
981 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
982 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800983message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700984 optional int32 uid = 1;
985
986 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
987 optional int32 is_foreground = 2;
988
989 optional int64 rx_bytes = 3;
990
991 optional int64 rx_packets = 4;
992
993 optional int64 tx_bytes = 5;
994
995 optional int64 tx_packets = 6;
996}
997
998/**
999 * Pulls the kernel wakelock durations. This atom is adapted from
1000 * android/internal/os/KernelWakelockStats.java
1001 *
1002 * Pulled from:
1003 * StatsCompanionService using KernelWakelockReader.
1004 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001005message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001006 optional string name = 1;
1007
1008 optional int32 count = 2;
1009
1010 optional int32 version = 3;
1011
1012 optional int64 time = 4;
1013}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001014
Chenjie Yu05013b32017-11-21 10:21:41 -08001015/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001016 * Pulls low power state information. This includes platform and subsystem sleep state information,
1017 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001018 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001019 * hardware/interfaces/power/1.1/types.hal
1020 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001021message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001022 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1023 // YYY is corresponding voter name.
1024 // If there are no voters, the format should just be XXX (with no dot).
1025 // XXX and YYY should not contain a "." in it.
1026 optional string name = 1;
1027 // The number of times it entered, or voted for entering the sleep state
1028 optional uint64 count = 2;
1029 // The length of time spent in, or spent voting for, the sleep state
1030 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001031}
David Chen21582962017-11-01 17:32:46 -07001032
1033/**
1034 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1035 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1036 * attributed back to the parent (host) uid. One example is Chrome.
1037 *
1038 * Logged from:
1039 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1040 */
1041message IsolatedUidChanged {
1042 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1043 optional int32 parent_uid = 1;
1044
1045 optional int32 isolated_uid = 2;
1046
1047 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1048 // be removed before if it's used for another parent uid.
1049 optional int32 is_create = 3;
1050}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001051
Chenjie Yu05013b32017-11-21 10:21:41 -08001052/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001053 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001054 * Pulls the time the cpu spend on the frequency index. Frequency index
1055 * starts from highest to lowest. The value should be monotonically
1056 * increasing since boot. However, if there is a cpu
1057 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001058 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001059message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001060 optional uint32 cluster = 1;
1061 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001062 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001063}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001064
Chenjie Yu05013b32017-11-21 10:21:41 -08001065/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001066 * Pulls Cpu Time Per Uid.
1067 * Note that isolated process uid time should be attributed to host uids.
1068 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001069message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001070 optional uint64 uid = 1;
1071 optional uint64 user_time_ms = 2;
1072 optional uint64 sys_time_ms = 3;
1073}
1074
1075/**
1076 * Pulls Cpu Time Per Uid per frequency.
1077 * Note that isolated process uid time should be attributed to host uids.
1078 * For each uid, we order the time by descending frequencies.
1079 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001080message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001081 optional uint64 uid = 1;
1082 optional uint64 freq_idx = 2;
1083 optional uint64 time_ms = 3;
1084}
Hugo Benichi884970e2017-11-14 22:42:46 +09001085
1086/*
1087 * Logs the reception of an incoming network packet causing the main system to wake up for
1088 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1089 * and processed by WakeupController.cpp.
1090 */
1091message PacketWakeupOccurred {
1092 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1093 // delivered nowhere.
1094 optional int32 uid = 1;
1095 // The interface name on which the packet was received.
1096 optional string iface = 2;
1097 // The ethertype value of the packet.
1098 optional int32 ethertype = 3;
1099 // String representation of the destination MAC address of the packet.
1100 optional string destination_hardware_address = 4;
1101 // String representation of the source address of the packet if this was an IP packet.
1102 optional string source_ip = 5;
1103 // String representation of the destination address of the packet if this was an IP packet.
1104 optional string destination_ip = 6;
1105 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1106 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1107 // families.
1108 optional int32 ip_next_header = 7;
1109 // The source port if this was a TCP or UDP packet.
1110 optional int32 source_port = 8;
1111 // The destination port if this was a TCP or UDP packet.
1112 optional int32 destination_port = 9;
1113}
Chenjie Yu05013b32017-11-21 10:21:41 -08001114
1115/**
1116 * Pulls Wifi Controller Activity Energy Info
1117 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001118message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001119 // timestamp(wall clock) of record creation
1120 optional uint64 timestamp_ms = 1;
1121 // stack reported state
1122 // TODO: replace this with proto enum
1123 optional int32 stack_state = 2;
1124 // tx time in ms
1125 optional uint64 controller_tx_time_ms = 3;
1126 // rx time in ms
1127 optional uint64 controller_rx_time_ms = 4;
1128 // idle time in ms
1129 optional uint64 controller_idle_time_ms = 5;
1130 // product of current(mA), voltage(V) and time(ms)
1131 optional uint64 controller_energy_used = 6;
1132}
1133
1134/**
1135 * Pulls Modem Activity Energy Info
1136 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001137message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001138 // timestamp(wall clock) of record creation
1139 optional uint64 timestamp_ms = 1;
1140 // sleep time in ms.
1141 optional uint64 sleep_time_ms = 2;
1142 // idle time in ms
1143 optional uint64 controller_idle_time_ms = 3;
1144 /**
1145 * Tx power index
1146 * index 0 = tx_power < 0dBm
1147 * index 1 = 0dBm < tx_power < 5dBm
1148 * index 2 = 5dBm < tx_power < 15dBm
1149 * index 3 = 15dBm < tx_power < 20dBm
1150 * index 4 = tx_power > 20dBm
1151 */
1152 // tx time in ms at power level 0
1153 optional uint64 controller_tx_time_pl0_ms = 4;
1154 // tx time in ms at power level 1
1155 optional uint64 controller_tx_time_pl1_ms = 5;
1156 // tx time in ms at power level 2
1157 optional uint64 controller_tx_time_pl2_ms = 6;
1158 // tx time in ms at power level 3
1159 optional uint64 controller_tx_time_pl3_ms = 7;
1160 // tx time in ms at power level 4
1161 optional uint64 controller_tx_time_pl4_ms = 8;
1162 // rx time in ms at power level 5
1163 optional uint64 controller_rx_time_ms = 9;
1164 // product of current(mA), voltage(V) and time(ms)
1165 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001166}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001167
1168/*
1169 * Logs the memory stats for a process
1170 */
Rajeev Kumar27572b92018-01-23 16:12:51 -08001171message ProcessMemoryStat {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001172 // The uid if available. -1 means not available.
1173 optional int32 uid = 1;
1174
Rajeev Kumar27572b92018-01-23 16:12:51 -08001175 // The process name.
1176 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001177
1178 // # of page-faults
1179 optional int64 pgfault = 3;
1180
1181 // # of major page-faults
1182 optional int64 pgmajfault = 4;
1183
1184 // RSS+CACHE(+SWAP)
1185 optional int64 usage_in_bytes = 5;
1186}
1187
1188/*
1189 * Logs the event when LMKD kills a process to reduce memory pressure
1190 * Logged from:
1191 * system/core/lmkd/lmkd.c
1192 */
1193message LmkEventOccurred {
1194 // The uid if available. -1 means not available.
1195 optional int32 uid = 1;
1196
Rajeev Kumar27572b92018-01-23 16:12:51 -08001197 // The process name.
1198 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001199
1200 // oom adj score.
1201 optional int32 oom_score = 3;
1202
Rajeev Kumar27572b92018-01-23 16:12:51 -08001203 // # of page-faults
1204 optional int64 pgfault = 4;
1205
1206 // # of major page-faults
1207 optional int64 pgmajfault = 5;
1208
1209 // RSS+CACHE(+SWAP)
1210 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001211}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001212
1213/*
1214 * Cpu syspend time for cpu power calculation.
1215 */
1216message CpuSuspendTime {
1217 optional uint64 time = 1;
1218}
1219
1220/*
1221 * Cpu idle time for cpu power calculation.
1222 */
1223message CpuIdleTime {
1224 optional uint64 time = 1;
1225}
1226
1227/*
1228 * Reads from /proc/uid_concurrent_active_time which has the format:
1229 * active: X (X is # cores)
1230 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1231 * [uid1]: [time-0] [time-1] [time-2] ... ...
1232 * ...
1233 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1234 * The file contains a monotonically increasing count of time for a single boot.
1235 */
1236message CpuActiveTime {
1237 optional uint64 uid = 1;
1238 optional uint64 idx = 2;
1239 optional uint64 time_ms = 3;
1240}
1241
1242/**
1243 * Reads from /proc/uid_concurrent_policy_time which has the format:
1244 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1245 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1246 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1247 * ...
1248 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1249 * The file contains a monotonically increasing count of time for a single boot.
1250 */
1251message CpuClusterTime {
1252 optional uint64 uid = 1;
1253 optional uint64 idx = 2;
1254 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001255}
1256
1257/*
1258 * Pulls free disk space, for data, system partition and temporary directory.
1259 */
1260message DiskSpace {
1261 // available bytes in data partition
1262 optional uint64 data_available_bytes = 1;
1263 // available bytes in system partition
1264 optional uint64 system_available_bytes = 2;
1265 // available bytes in download cache or temp directories
1266 optional uint64 temp_available_bytes = 3;
1267}
1268
1269/*
1270 * Pulls system up time.
1271 */
1272message SystemUptime {
1273 // Milliseconds since the system was booted.
1274 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1275 // for external input).
1276 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1277 optional uint64 uptime_ms = 1;
Tej Singh4503e102018-01-04 14:35:01 -08001278}