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