blob: 27fa67212af84d7b84f5e50463e73c4f7faa2649 [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 Kumar8a9fa052018-01-25 19:03:09 -080091 LmkKillOccurred lmk_kill_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;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080094 LmkStateChanged lmk_state_changed = 54;
95 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Bookatzc1a050a2017-10-10 15:49:28 -070096 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000097 }
David Chenc8a43242017-10-17 16:23:28 -070098
David Chen6e3e6cb2018-01-03 16:14:06 -080099 // Pulled events will start at field 10000.
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800100 // Next: 10019
David Chenc8a43242017-10-17 16:23:28 -0700101 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800102 WifiBytesTransfer wifi_bytes_transfer = 10000;
103 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
104 MobileBytesTransfer mobile_bytes_transfer = 10002;
105 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800106 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800107 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800108 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800109 CpuTimePerFreq cpu_time_per_freq = 10008;
110 CpuTimePerUid cpu_time_per_uid = 10009;
111 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
112 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
113 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800114 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800115 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800116 SystemElapsedRealtime system_elapsed_realtime = 10014;
117 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800118 CpuActiveTime cpu_active_time = 10016;
119 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800120 DiskSpace disk_space = 10018;
David Chenc8a43242017-10-17 16:23:28 -0700121 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700122}
123
Yao Chend54f9dd2017-10-17 17:37:48 +0000124/**
Yangster-mac20877162017-12-22 17:19:39 -0800125 * This proto represents a node of an attribution chain.
126 * Note: All attribution chains are represented as a repeated field of type
127 * AttributionNode. It is understood that in such arrays, the order is that
128 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000129 */
Yangster-mac20877162017-12-22 17:19:39 -0800130message AttributionNode {
131 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800132 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800133
Yangster-mac20877162017-12-22 17:19:39 -0800134 // The (optional) string tag for an element in the attribution chain. If the
135 // element has no tag, it is encoded as an empty string.
136 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700137}
138
Yao Chend54f9dd2017-10-17 17:37:48 +0000139/*
140 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800141 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000142 *
143 * RULES:
144 * - The field ids for each atom must start at 1, and count upwards by 1.
145 * Skipping field ids is not allowed.
146 * - These form an API, so renaming, renumbering or removing fields is
147 * not allowed between android releases. (This is not currently enforced,
148 * but there will be a tool to enforce this restriction).
149 * - The types must be built-in protocol buffer types, namely, no sub-messages
150 * are allowed (yet). The bytes type is also not allowed.
151 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800152 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000153 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800154 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000155 * - A field that is a uid should be a string field, tagged with the [xxx]
156 * annotation. The generated code on android will be represented by UIDs,
157 * and those UIDs will be translated in xxx to those strings.
158 *
159 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700160 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000161 * - If there is a UID, it goes first. Think in an object-oriented fashion.
162 * *****************************************************************************
163 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700164
Yao Chend54f9dd2017-10-17 17:37:48 +0000165/**
166 * Logs when the screen state changes.
167 *
168 * Logged from:
169 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
170 */
171message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800172 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
173 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700174}
Yao Chend54f9dd2017-10-17 17:37:48 +0000175
176/**
Bookatzc1a050a2017-10-10 15:49:28 -0700177 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 *
179 * Logged from:
180 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
181 */
Bookatzc1a050a2017-10-10 15:49:28 -0700182message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
184
Bookatzdb026a22018-01-10 19:01:56 -0800185 // The state, from frameworks/base/core/proto/android/app/enums.proto.
186 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000187}
188
189/**
Bookatzc1a050a2017-10-10 15:49:28 -0700190 * Logs that a process started, finished, crashed, or ANRed.
191 *
192 * Logged from:
193 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
194 */
195message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700196 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
197
198 // TODO: What is this?
199 optional string name = 2;
200
Bookatzddccf0a2017-11-28 16:48:14 -0800201 // What lifecycle state the process changed to.
202 // This enum is specific to atoms.proto.
203 enum Event {
204 PROCESS_FINISHED = 0;
205 PROCESS_STARTED = 1;
206 PROCESS_CRASHED = 2;
207 PROCESS_ANRED = 3;
208 }
209 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700210}
211
Bookatzc1a050a2017-10-10 15:49:28 -0700212/**
213 * Logs when the ble scan state changes.
214 *
215 * Logged from:
216 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
217 */
218message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800219 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700220
221 enum State {
222 OFF = 0;
223 ON = 1;
224 }
225 optional State state = 2;
226}
227
228/**
229 * Logs when an unoptimized ble scan state changes.
230 *
231 * Logged from:
232 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
233 */
234// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
235message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800236 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700237
238 enum State {
239 OFF = 0;
240 ON = 1;
241 }
242 optional State state = 2;
243}
244
245/**
246 * Logs reporting of a ble scan finding results.
247 *
248 * Logged from:
249 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
250 */
251// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
252message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800253 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700254
255 // Number of ble scan results returned.
256 optional int32 num_of_results = 2;
257}
258
259/**
260 * Logs when a sensor state changes.
261 *
262 * Logged from:
263 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
264 */
265message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800266 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700267
268 // TODO: Is there a way to get the actual name of the sensor?
269 // The id (int) of the sensor.
270 optional int32 sensor_id = 2;
271
272 enum State {
273 OFF = 0;
274 ON = 1;
275 }
276 optional State state = 3;
277}
278
279
280/**
281 * Logs when GPS state changes.
282 *
283 * Logged from:
284 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
285 */
286message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800287 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700288
289 enum State {
290 OFF = 0;
291 ON = 1;
292 }
293 optional State state = 2;
294}
295
296
297/**
298 * Logs when a sync manager sync state changes.
299 *
300 * Logged from:
301 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
302 */
303message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800304 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700305
306 // Name of the sync (as named in the app)
307 optional string name = 2;
308
309 enum State {
310 OFF = 0;
311 ON = 1;
312 }
313 optional State state = 3;
314}
315
316/**
317 * Logs when a job scheduler job state changes.
318 *
319 * Logged from:
320 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
321 */
322message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800323 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700324
325 // Name of the job (as named in the app)
326 optional string name = 2;
327
328 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800329 FINISHED = 0;
330 STARTED = 1;
331 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700332 }
333 optional State state = 3;
334
335 // TODO: Consider adding the stopReason (int)
336}
337
338/**
339 * Logs when the audio state changes.
340 *
341 * Logged from:
342 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
343 */
344message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800345 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700346
347 enum State {
348 OFF = 0;
349 ON = 1;
350 }
351 optional State state = 2;
352}
353
354/**
355 * Logs when the video codec state changes.
356 *
357 * Logged from:
358 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
359 */
360message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800361 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700362
363 enum State {
364 OFF = 0;
365 ON = 1;
366 }
367 optional State state = 2;
368}
369
370/**
371 * Logs when the flashlight state changes.
372 *
373 * Logged from:
374 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
375 */
376message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800377 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700378
379 enum State {
380 OFF = 0;
381 ON = 1;
382 }
383 optional State state = 2;
384}
385
386/**
387 * Logs when the camera state changes.
388 *
389 * Logged from:
390 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
391 */
392message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800393 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700394
395 enum State {
396 OFF = 0;
397 ON = 1;
398 }
399 optional State state = 2;
400}
401
402/**
403 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000404 *
405 * Logged from:
406 * TODO
407 */
Bookatzd6746242017-10-24 18:39:35 -0700408message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800409 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000410
Bookatz1a1b0462018-01-12 11:47:03 -0800411 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
412 // From frameworks/base/core/proto/android/os/enums.proto.
413 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700414
415 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
416 optional string tag = 3;
417
418 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800419 RELEASE = 0;
420 ACQUIRE = 1;
421 CHANGE_RELEASE = 2;
422 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700423 }
424 optional State state = 4;
425}
426
427/**
Bookatzc1a050a2017-10-10 15:49:28 -0700428 * Logs when a partial wakelock is considered 'long' (over 1 min).
429 *
430 * Logged from:
431 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
432 */
433message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800434 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700435
Yao Chend54f9dd2017-10-17 17:37:48 +0000436 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
437 optional string tag = 2;
438
Bookatzc1a050a2017-10-10 15:49:28 -0700439 // TODO: I have no idea what this is.
440 optional string history_tag = 3;
441
442 enum State {
443 OFF = 0;
444 ON = 1;
445 }
446 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000447}
448
Bookatzc1a050a2017-10-10 15:49:28 -0700449/**
450 * Logs Battery Saver state change.
451 *
452 * Logged from:
453 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
454 */
455message BatterySaverModeStateChanged {
456 enum State {
457 OFF = 0;
458 ON = 1;
459 }
460 optional State state = 1;
461}
462
463/**
464 * Logs Doze mode state change.
465 *
466 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800467 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700468 */
469message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800470 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800471}
472
473
474/**
475 * Logs state change of Doze mode including maintenance windows.
476 *
477 * Logged from:
478 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
479 */
480message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800481 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700482}
483
484/**
485 * Logs screen brightness level.
486 *
487 * Logged from:
488 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
489 */
490message ScreenBrightnessChanged {
491 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
492 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700493}
494
495/**
496 * Logs battery level (percent full, from 0 to 100).
497 *
498 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700499 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700500 */
501message BatteryLevelChanged {
502 // Battery level. Should be in [0, 100].
503 optional int32 battery_level = 1;
504}
505
506/**
507 * Logs change in charging status of the device.
508 *
509 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700510 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700511 */
512message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800513 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
514 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700515}
516
517/**
518 * Logs whether the device is plugged in, and what power source it is using.
519 *
520 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700521 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700522 */
523message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800524 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
525 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700526}
527
528/**
529 * Logs the temperature of the device, in tenths of a degree Celsius.
530 *
531 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700532 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700533 */
534message DeviceTemperatureReported {
535 // Temperature in tenths of a degree C.
536 optional int32 temperature = 1;
537}
538
539// TODO: Define this more precisely.
540// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
541/**
542 * Logs when the device turns off or on.
543 *
544 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700545 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700546 */
547message DeviceOnStatusChanged {
548 enum State {
549 OFF = 0;
550 ON = 1;
551 }
552 optional State state = 1;
553}
554
555/**
556 * Logs when an app's wakeup alarm fires.
557 *
558 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700559 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700560 */
561message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800562 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800563
564 // Name of the wakeup alarm.
565 optional string tag = 2;
566}
567
568/**
569 * Logs when an an app causes the mobile radio to change state.
570 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
571 *
572 * Logged from:
573 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
574 */
575message MobileRadioPowerStateChanged {
576 // TODO: Add attribution instead of uid?
577 optional int32 uid = 1;
578
Bookatz1a1b0462018-01-12 11:47:03 -0800579 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
580 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800581}
582
583/**
584 * Logs when an an app causes the wifi radio to change state.
585 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
586 *
587 * Logged from:
588 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
589 */
590message WifiRadioPowerStateChanged {
591 // TODO: Add attribution instead of uid?
592 optional int32 uid = 1;
593
Bookatz1a1b0462018-01-12 11:47:03 -0800594 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
595 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700596}
597
598/**
599 * Logs kernel wakeup reasons and aborts.
600 *
601 * Logged from:
602 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
603 */
604message KernelWakeupReported {
605 // Name of the kernel wakeup reason (or abort).
606 optional string wakeup_reason_name = 1;
607
608 // Duration (in microseconds) for the wake-up interrupt to be serviced.
609 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700610}
611
612/**
613 * Logs wifi locks held by an app.
614 *
615 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700616 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700617 */
618message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800619 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700620
621 enum State {
622 OFF = 0;
623 ON = 1;
624 }
625 optional State state = 2;
626}
627
628/**
629 * Logs wifi signal strength changes.
630 *
631 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700632 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700633 */
634message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800635 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
636 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700637}
638
639/**
640 * Logs wifi scans performed by an app.
641 *
642 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700643 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700644 */
645message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800646 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700647
648 enum State {
649 OFF = 0;
650 ON = 1;
651 }
652 optional State state = 2;
653}
654
655/**
Tej Singh4503e102018-01-04 14:35:01 -0800656 * Logs wifi multicast locks held by an app
657 *
658 * Logged from:
659 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
660 */
661message WifiMulticastLockStateChanged {
662 repeated AttributionNode attribution_node = 1;
663
664 enum State {
665 OFF = 0;
666 ON = 1;
667 }
668 optional State state = 2;
669}
670
671/**
Bookatze5885242017-10-24 20:10:31 -0700672 * Logs phone signal strength changes.
673 *
674 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700675 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700676 */
677message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800678 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
679 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700680}
681
682/**
683 * Logs that a setting was updated.
684 * Logged from:
685 * frameworks/base/core/java/android/provider/Settings.java
686 * The tag and is_default allow resetting of settings to default values based on the specified
687 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
688 */
689message SettingChanged {
690 // The name of the setting.
691 optional string setting = 1;
692
693 // The change being imposed on this setting. May represent a number, eg "3".
694 optional string value = 2;
695
696 // The new value of this setting. For most settings, this is same as value. For some settings,
697 // value is +X or -X where X represents an element in a set. For example, if the previous value
698 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
699 // The +/- feature is currently only used for location_providers_allowed.
700 optional string new_value = 3;
701
702 // The previous value of this setting.
703 optional string prev_value = 4;
704
705 // The tag used with the is_default for resetting sets of settings. This is generally null.
706 optional string tag = 5;
707
708 // 1 indicates that this setting with tag should be resettable.
709 optional int32 is_default = 6;
710
711 // The user ID associated. Defined in android/os/UserHandle.java
712 optional int32 user = 7;
713}
Chenjie Yub3dda412017-10-24 13:41:59 -0700714
Chenjie Yu05013b32017-11-21 10:21:41 -0800715/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700716 * Logs activity going to foreground or background
717 *
718 * Logged from:
719 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
720 */
721message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800722 optional int32 uid = 1;
723 optional string pkg_name = 2;
724 optional string class_name = 3;
725
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700726 enum Activity {
727 MOVE_TO_BACKGROUND = 0;
728 MOVE_TO_FOREGROUND = 1;
729 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700730 optional Activity activity = 4;
731}
David Chenc8a43242017-10-17 16:23:28 -0700732
733/**
David Chen9e3808c2017-11-20 17:25:34 -0800734 * Logs when an error is written to dropbox.
735 * Logged from:
736 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
737 */
738message DropboxErrorChanged {
739 // The uid if available. -1 means not available.
740 optional int32 uid = 1;
741
742 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
743 optional string tag = 2;
744
745 // The name of the process.
746 optional string process_name = 3;
747
748 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800749 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800750
751 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800752 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800753
754 // The activity name if available.
755 optional string activity_name = 6;
756
David Chen6e3e6cb2018-01-03 16:14:06 -0800757 // The package name if available.
758 optional string package_name = 7;
759
David Chen9e3808c2017-11-20 17:25:34 -0800760 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800761 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800762}
763
David Chen0a368b22017-12-06 16:28:16 -0800764/*
765 * Allows other apps to push events into statsd.
766 * Logged from:
767 * frameworks/base/core/java/android/util/StatsLog.java
768 */
769message AppHook {
770 // The uid of the application that sent this custom atom.
771 optional int32 uid = 1;
772
773 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
774 optional int32 label = 2;
775
776 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
777 // predicates for the metrics).
778 enum State {
779 UNKNOWN = 0;
780 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
781 STOP = 2;
782 START = 3;
783 }
784 optional State state = 3;
785}
786
David Chen9e3808c2017-11-20 17:25:34 -0800787/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800788 * Logs when statsd detects an anomaly.
789 *
790 * Logged from:
791 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
792 */
793message AnomalyDetected {
794 // Uid that owns the config whose anomaly detection alert fired.
795 optional int32 config_uid = 1;
796
Yangster-mac94e197c2018-01-02 16:03:03 -0800797 // Id of the config whose anomaly detection alert fired.
798 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800799
Yangster-mac94e197c2018-01-02 16:03:03 -0800800 // Id of the alert (i.e. name of the anomaly that was detected).
801 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800802}
803
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000804message AppStartChanged {
805 // The uid if available. -1 means not available.
806 optional int32 uid = 1;
807
808 // The app package name.
809 optional string pkg_name = 2;
810
811 enum TransitionType {
812 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
813 WARM = 1;
814 HOT = 2;
815 COLD = 3;
816 }
817 // The transition type.
818 optional TransitionType type = 3;
819
820 // The activity name.
821 optional string activity_name = 4;
822
823 // The name of the calling app. Empty if not set.
824 optional string calling_pkg_name = 5;
825
826 // Whether the app is an instant app.
827 optional bool is_instant_app = 6;
828
829 // Device uptime when activity started.
830 optional int64 activity_start_msec = 7;
831
Bookatz80d11a02018-01-16 10:46:35 -0800832 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000833
834 optional int32 transition_delay_msec = 9;
835 // -1 if not set.
836 optional int32 starting_window_delay_msec = 10;
837 // -1 if not set.
838 optional int32 bind_application_delay_msec = 11;
839 optional int32 windows_drawn_delay_msec = 12;
840
841 // Empty if not set.
842 optional string launch_token = 13;
843
844}
845
846message AppStartCancelChanged {
847 // The uid if available. -1 means not available.
848 optional int32 uid = 1;
849
850 // The app package name.
851 optional string pkg_name = 2;
852
853 enum TransitionType {
854 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
855 WARM = 1;
856 HOT = 2;
857 COLD = 3;
858 }
859 // The transition type.
860 optional TransitionType type = 3;
861
862 // The activity name.
863 optional string activity_name = 4;
864}
865
866message AppStartFullyDrawnChanged {
867 // The uid if available. -1 means not available.
868 optional int32 uid = 1;
869
870 // The app package name.
871 optional string pkg_name = 2;
872
873 enum TransitionType {
874 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
875 WITH_BUNDLE = 1;
876 WITHOUT_BUNDLE = 2;
877 }
878 // The transition type.
879 optional TransitionType type = 3;
880
881 // The activity name.
882 optional string activity_name = 4;
883
884 optional bool transition_process_running = 5;
885
886 // App startup time (until call to Activity#reportFullyDrawn()).
887 optional int64 app_startup_time_ms = 6;
888}
889
Bookatz8fcd09a2017-12-18 13:01:10 -0800890/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800891 * Logs a picture-in-picture action
892 * Logged from:
893 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
894 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
895 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
896 */
897message PictureInPictureStateChanged {
898 optional int32 uid = 1;
899
900 optional string package_name = 2;
901
902 optional string class_name = 3;
903
904 // Picture-in-Picture action occurred, similar to
905 // frameworks/base/proto/src/metrics_constants.proto
906 enum State {
907 ENTERED = 1;
908 EXPANDED_TO_FULL_SCREEN = 2;
909 MINIMIZED = 3;
910 DISMISSED = 4;
911 }
912 optional State state = 4;
913}
914
915/**
David Chenc8a43242017-10-17 16:23:28 -0700916 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
917 *
918 * Pulled from:
919 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
920 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800921message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700922 optional int32 uid = 1;
923
924 optional int64 rx_bytes = 2;
925
926 optional int64 rx_packets = 3;
927
928 optional int64 tx_bytes = 4;
929
930 optional int64 tx_packets = 5;
931}
932
933/**
934 * Pulls bytes transferred via wifi (separated by foreground and background usage).
935 *
936 * Pulled from:
937 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
938 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800939message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700940 optional int32 uid = 1;
941
942 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
943 optional int32 is_foreground = 2;
944
945 optional int64 rx_bytes = 3;
946
947 optional int64 rx_packets = 4;
948
949 optional int64 tx_bytes = 5;
950
951 optional int64 tx_packets = 6;
952}
953
954/**
955 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
956 *
957 * Pulled from:
958 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
959 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800960message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700961 optional int32 uid = 1;
962
963 optional int64 rx_bytes = 2;
964
965 optional int64 rx_packets = 3;
966
967 optional int64 tx_bytes = 4;
968
969 optional int64 tx_packets = 5;
970}
971
972/**
973 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
974 *
975 * Pulled from:
976 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
977 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800978message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700979 optional int32 uid = 1;
980
981 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
982 optional int32 is_foreground = 2;
983
984 optional int64 rx_bytes = 3;
985
986 optional int64 rx_packets = 4;
987
988 optional int64 tx_bytes = 5;
989
990 optional int64 tx_packets = 6;
991}
992
993/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800994 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
995 *
996 * Pulled from:
997 * StatsCompanionService
998 */
999message BluetoothBytesTransfer {
1000 optional int32 uid = 1;
1001
1002 optional int64 rx_bytes = 2;
1003
1004 optional int64 tx_bytes = 3;
1005}
1006
1007/**
David Chenc8a43242017-10-17 16:23:28 -07001008 * Pulls the kernel wakelock durations. This atom is adapted from
1009 * android/internal/os/KernelWakelockStats.java
1010 *
1011 * Pulled from:
1012 * StatsCompanionService using KernelWakelockReader.
1013 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001014message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001015 optional string name = 1;
1016
1017 optional int32 count = 2;
1018
1019 optional int32 version = 3;
1020
1021 optional int64 time = 4;
1022}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001023
Chenjie Yu05013b32017-11-21 10:21:41 -08001024/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001025 * Pulls low power state information. This includes platform and subsystem sleep state information,
1026 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001027 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001028 * hardware/interfaces/power/1.1/types.hal
1029 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001030message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001031 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1032 // YYY is corresponding voter name.
1033 // If there are no voters, the format should just be XXX (with no dot).
1034 // XXX and YYY should not contain a "." in it.
1035 optional string name = 1;
1036 // The number of times it entered, or voted for entering the sleep state
1037 optional uint64 count = 2;
1038 // The length of time spent in, or spent voting for, the sleep state
1039 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001040}
David Chen21582962017-11-01 17:32:46 -07001041
1042/**
1043 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1044 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1045 * attributed back to the parent (host) uid. One example is Chrome.
1046 *
1047 * Logged from:
1048 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1049 */
1050message IsolatedUidChanged {
1051 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1052 optional int32 parent_uid = 1;
1053
1054 optional int32 isolated_uid = 2;
1055
1056 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1057 // be removed before if it's used for another parent uid.
1058 optional int32 is_create = 3;
1059}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001060
Chenjie Yu05013b32017-11-21 10:21:41 -08001061/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001062 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001063 * Pulls the time the cpu spend on the frequency index. Frequency index
1064 * starts from highest to lowest. The value should be monotonically
1065 * increasing since boot. However, if there is a cpu
1066 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001067 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001068message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001069 optional uint32 cluster = 1;
1070 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001071 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001072}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001073
Chenjie Yu05013b32017-11-21 10:21:41 -08001074/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001075 * Pulls Cpu Time Per Uid.
1076 * Note that isolated process uid time should be attributed to host uids.
1077 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001078message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001079 optional uint64 uid = 1;
1080 optional uint64 user_time_ms = 2;
1081 optional uint64 sys_time_ms = 3;
1082}
1083
1084/**
1085 * Pulls Cpu Time Per Uid per frequency.
1086 * Note that isolated process uid time should be attributed to host uids.
1087 * For each uid, we order the time by descending frequencies.
1088 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001089message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001090 optional uint64 uid = 1;
1091 optional uint64 freq_idx = 2;
1092 optional uint64 time_ms = 3;
1093}
Hugo Benichi884970e2017-11-14 22:42:46 +09001094
1095/*
1096 * Logs the reception of an incoming network packet causing the main system to wake up for
1097 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1098 * and processed by WakeupController.cpp.
1099 */
1100message PacketWakeupOccurred {
1101 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1102 // delivered nowhere.
1103 optional int32 uid = 1;
1104 // The interface name on which the packet was received.
1105 optional string iface = 2;
1106 // The ethertype value of the packet.
1107 optional int32 ethertype = 3;
1108 // String representation of the destination MAC address of the packet.
1109 optional string destination_hardware_address = 4;
1110 // String representation of the source address of the packet if this was an IP packet.
1111 optional string source_ip = 5;
1112 // String representation of the destination address of the packet if this was an IP packet.
1113 optional string destination_ip = 6;
1114 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1115 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1116 // families.
1117 optional int32 ip_next_header = 7;
1118 // The source port if this was a TCP or UDP packet.
1119 optional int32 source_port = 8;
1120 // The destination port if this was a TCP or UDP packet.
1121 optional int32 destination_port = 9;
1122}
Chenjie Yu05013b32017-11-21 10:21:41 -08001123
1124/**
1125 * Pulls Wifi Controller Activity Energy Info
1126 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001127message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001128 // timestamp(wall clock) of record creation
1129 optional uint64 timestamp_ms = 1;
1130 // stack reported state
1131 // TODO: replace this with proto enum
1132 optional int32 stack_state = 2;
1133 // tx time in ms
1134 optional uint64 controller_tx_time_ms = 3;
1135 // rx time in ms
1136 optional uint64 controller_rx_time_ms = 4;
1137 // idle time in ms
1138 optional uint64 controller_idle_time_ms = 5;
1139 // product of current(mA), voltage(V) and time(ms)
1140 optional uint64 controller_energy_used = 6;
1141}
1142
1143/**
1144 * Pulls Modem Activity Energy Info
1145 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001146message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001147 // timestamp(wall clock) of record creation
1148 optional uint64 timestamp_ms = 1;
1149 // sleep time in ms.
1150 optional uint64 sleep_time_ms = 2;
1151 // idle time in ms
1152 optional uint64 controller_idle_time_ms = 3;
1153 /**
1154 * Tx power index
1155 * index 0 = tx_power < 0dBm
1156 * index 1 = 0dBm < tx_power < 5dBm
1157 * index 2 = 5dBm < tx_power < 15dBm
1158 * index 3 = 15dBm < tx_power < 20dBm
1159 * index 4 = tx_power > 20dBm
1160 */
1161 // tx time in ms at power level 0
1162 optional uint64 controller_tx_time_pl0_ms = 4;
1163 // tx time in ms at power level 1
1164 optional uint64 controller_tx_time_pl1_ms = 5;
1165 // tx time in ms at power level 2
1166 optional uint64 controller_tx_time_pl2_ms = 6;
1167 // tx time in ms at power level 3
1168 optional uint64 controller_tx_time_pl3_ms = 7;
1169 // tx time in ms at power level 4
1170 optional uint64 controller_tx_time_pl4_ms = 8;
1171 // rx time in ms at power level 5
1172 optional uint64 controller_rx_time_ms = 9;
1173 // product of current(mA), voltage(V) and time(ms)
1174 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001175}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001176
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001177/**
1178 * Pulls Bluetooth Activity Energy Info
1179 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1180 */
1181message BluetoothActivityInfo {
1182 // timestamp(wall clock) of record creation
1183 optional uint64 timestamp_ms = 1;
1184 // bluetooth stack state
1185 optional int32 bluetooth_stack_state = 2;
1186 // tx time in ms
1187 optional uint64 controller_tx_time_ms = 3;
1188 // rx time in ms
1189 optional uint64 controller_rx_time_ms = 4;
1190 // idle time in ms
1191 optional uint64 controller_idle_time_ms = 5;
1192 // product of current(mA), voltage(V) and time(ms)
1193 optional uint64 energy_used = 6;
1194}
1195
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001196/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001197 * Logs the memory stats for an app on startup.
1198 * Logged from:
1199 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001200 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001201message AppStartMemoryStateCaptured {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001202 // The uid if available. -1 means not available.
1203 optional int32 uid = 1;
1204
Rajeev Kumar27572b92018-01-23 16:12:51 -08001205 // The process name.
1206 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001207
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001208 // The activity name.
1209 optional string activity_name = 3;
1210
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001211 // # of page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001212 optional int64 pgfault = 4;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001213
1214 // # of major page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001215 optional int64 pgmajfault = 5;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001216
1217 // RSS+CACHE(+SWAP)
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001218 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001219}
1220
1221/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001222 * Logs the memory stats for a process.
1223 */
1224message ProcessMemoryState {
1225 // The uid if available. -1 means not available.
1226 optional int32 uid = 1;
1227
1228 // The process name.
1229 optional string process_name = 2;
1230
1231 // oom adj score.
1232 optional int32 oom_score = 3;
1233
1234 // # of page-faults
1235 optional int64 pgfault = 4;
1236
1237 // # of major page-faults
1238 optional int64 pgmajfault = 5;
1239
1240 // RSS+CACHE(+SWAP)
1241 optional int64 usage_in_bytes = 6;
1242}
1243
1244/*
1245 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1246 * for LMK event.
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001247 * Logged from:
1248 * system/core/lmkd/lmkd.c
1249 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001250message LmkStateChanged {
1251 enum State {
1252 UNKNOWN = 0;
1253 START = 1;
1254 STOP = 2;
1255 }
1256 optional State state = 1;
1257}
1258
1259/*
1260 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1261 * Logged from:
1262 * system/core/lmkd/lmkd.c
1263 */
1264message LmkKillOccurred {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001265 // The uid if available. -1 means not available.
1266 optional int32 uid = 1;
1267
Rajeev Kumar27572b92018-01-23 16:12:51 -08001268 // The process name.
1269 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001270
1271 // oom adj score.
1272 optional int32 oom_score = 3;
1273
Rajeev Kumar27572b92018-01-23 16:12:51 -08001274 // # of page-faults
1275 optional int64 pgfault = 4;
1276
1277 // # of major page-faults
1278 optional int64 pgmajfault = 5;
1279
1280 // RSS+CACHE(+SWAP)
1281 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001282}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001283
1284/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001285 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001286 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001287message SystemElapsedRealtime {
1288 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001289}
1290
1291/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001292 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001293 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001294message SystemUptime {
1295 // Milliseconds since the system was booted.
1296 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1297 // for external input).
1298 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1299 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001300}
1301
1302/*
1303 * Reads from /proc/uid_concurrent_active_time which has the format:
1304 * active: X (X is # cores)
1305 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1306 * [uid1]: [time-0] [time-1] [time-2] ... ...
1307 * ...
1308 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1309 * The file contains a monotonically increasing count of time for a single boot.
1310 */
1311message CpuActiveTime {
1312 optional uint64 uid = 1;
1313 optional uint64 idx = 2;
1314 optional uint64 time_ms = 3;
1315}
1316
1317/**
1318 * Reads from /proc/uid_concurrent_policy_time which has the format:
1319 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1320 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1321 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1322 * ...
1323 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1324 * The file contains a monotonically increasing count of time for a single boot.
1325 */
1326message CpuClusterTime {
1327 optional uint64 uid = 1;
1328 optional uint64 idx = 2;
1329 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001330}
1331
1332/*
1333 * Pulls free disk space, for data, system partition and temporary directory.
1334 */
1335message DiskSpace {
1336 // available bytes in data partition
1337 optional uint64 data_available_bytes = 1;
1338 // available bytes in system partition
1339 optional uint64 system_available_bytes = 2;
1340 // available bytes in download cache or temp directories
1341 optional uint64 temp_available_bytes = 3;
1342}