blob: ef99c9f4d7e33e824375bf43cbabe034de843269 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Joe Onorato62c220b2017-11-18 20:32:56 -080024import "frameworks/base/core/proto/android/app/activitymanager.proto";
25
Yao Chend54f9dd2017-10-17 17:37:48 +000026/**
Stefan Lafonae2df012017-11-14 09:17:21 -080027 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000028 * raw stats log events from the Android system, also known as "atoms."
29 *
30 * This field contains a single oneof with all of the available messages.
31 * The stats-log-api-gen tool runs as part of the Android build and
32 * generates the android.util.StatsLog class, which contains the constants
33 * and methods that Android uses to log.
34 *
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * Instead, statsd on Android constructs these messages synthetically,
37 * in the format defined here and in stats_log.proto.
38 */
Stefan Lafonae2df012017-11-14 09:17:21 -080039message Atom {
40 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070041 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070042 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
43 BleScanStateChanged ble_scan_state_changed = 2;
44 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
45 BleScanResultReceived ble_scan_result_received = 4;
46 SensorStateChanged sensor_state_changed = 5;
47 GpsScanStateChanged gps_scan_state_changed = 6; // TODO: untested
48 SyncStateChanged sync_state_changed = 7;
49 ScheduledJobStateChanged scheduled_job_state_changed = 8;
50 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070051 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080052 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
53 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
54 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
55 // TODO: 14-19 are blank, but need not be
56 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
57 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
58 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070059 AudioStateChanged audio_state_changed = 23;
60 MediaCodecActivityChanged media_codec_activity_changed = 24;
61 CameraStateChanged camera_state_changed = 25;
62 FlashlightStateChanged flashlight_state_changed = 26;
63 UidProcessStateChanged uid_process_state_changed = 27;
64 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
65 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070066 BatteryLevelChanged battery_level_changed = 30;
67 ChargingStateChanged charging_state_changed = 31;
68 PluggedStateChanged plugged_state_changed = 32;
69 DeviceTemperatureReported device_temperature_reported = 33;
70 DeviceOnStatusChanged device_on_status_changed = 34;
71 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
72 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070073 WifiLockStateChanged wifi_lock_state_changed = 37;
74 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
75 WifiScanStateChanged wifi_scan_state_changed = 39;
76 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070077 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070078 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070079 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090080 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080081 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080082 AnomalyDetected anomaly_detected = 46;
83 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000084 AppStartChanged app_start_changed = 48;
85 AppStartCancelChanged app_start_cancel_changed = 49;
86 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080087 LmkEventOccurred lmk_event_occurred = 51;
Bookatzc1a050a2017-10-10 15:49:28 -070088 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000089 }
David Chenc8a43242017-10-17 16:23:28 -070090
David Chen6e3e6cb2018-01-03 16:14:06 -080091 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070092 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080093 WifiBytesTransfer wifi_bytes_transfer = 10000;
94 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
95 MobileBytesTransfer mobile_bytes_transfer = 10002;
96 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
97 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -080098 SubsystemSleepState subsystem_sleep_state = 10005;
99 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800100 CpuTimePerFreq cpu_time_per_freq = 10008;
101 CpuTimePerUid cpu_time_per_uid = 10009;
102 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
103 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
104 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -0800105 MemoryStat memory_stat = 10013;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800106 CpuSuspendTime cpu_suspend_time = 10014;
107 CpuIdleTime cpu_idle_time = 10015;
108 CpuActiveTime cpu_active_time = 10016;
109 CpuClusterTime cpu_cluster_time = 10017;
David Chenc8a43242017-10-17 16:23:28 -0700110 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700111}
112
Yao Chend54f9dd2017-10-17 17:37:48 +0000113/**
Yangster-mac20877162017-12-22 17:19:39 -0800114 * This proto represents a node of an attribution chain.
115 * Note: All attribution chains are represented as a repeated field of type
116 * AttributionNode. It is understood that in such arrays, the order is that
117 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000118 */
Yangster-mac20877162017-12-22 17:19:39 -0800119message AttributionNode {
120 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800121 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800122
Yangster-mac20877162017-12-22 17:19:39 -0800123 // The (optional) string tag for an element in the attribution chain. If the
124 // element has no tag, it is encoded as an empty string.
125 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700126}
127
Yao Chend54f9dd2017-10-17 17:37:48 +0000128/*
129 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800130 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000131 *
132 * RULES:
133 * - The field ids for each atom must start at 1, and count upwards by 1.
134 * Skipping field ids is not allowed.
135 * - These form an API, so renaming, renumbering or removing fields is
136 * not allowed between android releases. (This is not currently enforced,
137 * but there will be a tool to enforce this restriction).
138 * - The types must be built-in protocol buffer types, namely, no sub-messages
139 * are allowed (yet). The bytes type is also not allowed.
140 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800141 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000142 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800143 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000144 * - A field that is a uid should be a string field, tagged with the [xxx]
145 * annotation. The generated code on android will be represented by UIDs,
146 * and those UIDs will be translated in xxx to those strings.
147 *
148 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700149 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000150 * - If there is a UID, it goes first. Think in an object-oriented fashion.
151 * *****************************************************************************
152 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700153
Yao Chend54f9dd2017-10-17 17:37:48 +0000154/**
155 * Logs when the screen state changes.
156 *
157 * Logged from:
158 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
159 */
160message ScreenStateChanged {
161 // TODO: Use the real screen state.
162 enum State {
163 STATE_UNKNOWN = 0;
164 STATE_OFF = 1;
165 STATE_ON = 2;
166 STATE_DOZE = 3;
167 STATE_DOZE_SUSPEND = 4;
168 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800169 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 }
171 // New screen state.
172 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700173}
Yao Chend54f9dd2017-10-17 17:37:48 +0000174
175/**
Bookatzc1a050a2017-10-10 15:49:28 -0700176 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000177 *
178 * Logged from:
179 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
180 */
Bookatzc1a050a2017-10-10 15:49:28 -0700181message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
183
184 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700185 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800186 optional android.app.ProcessState 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 {
196 // TODO: Use the real (mapped) process states.
197 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
198
199 // TODO: What is this?
200 optional string name = 2;
201
Bookatzddccf0a2017-11-28 16:48:14 -0800202 // What lifecycle state the process changed to.
203 // This enum is specific to atoms.proto.
204 enum Event {
205 PROCESS_FINISHED = 0;
206 PROCESS_STARTED = 1;
207 PROCESS_CRASHED = 2;
208 PROCESS_ANRED = 3;
209 }
210 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700211}
212
Bookatzc1a050a2017-10-10 15:49:28 -0700213/**
214 * Logs when the ble scan state changes.
215 *
216 * Logged from:
217 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
218 */
219message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800220 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700221
222 enum State {
223 OFF = 0;
224 ON = 1;
225 }
226 optional State state = 2;
227}
228
229/**
230 * Logs when an unoptimized ble scan state changes.
231 *
232 * Logged from:
233 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
234 */
235// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
236message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800237 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700238
239 enum State {
240 OFF = 0;
241 ON = 1;
242 }
243 optional State state = 2;
244}
245
246/**
247 * Logs reporting of a ble scan finding results.
248 *
249 * Logged from:
250 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
251 */
252// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
253message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800254 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700255
256 // Number of ble scan results returned.
257 optional int32 num_of_results = 2;
258}
259
260/**
261 * Logs when a sensor state changes.
262 *
263 * Logged from:
264 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
265 */
266message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800267 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700268
269 // TODO: Is there a way to get the actual name of the sensor?
270 // The id (int) of the sensor.
271 optional int32 sensor_id = 2;
272
273 enum State {
274 OFF = 0;
275 ON = 1;
276 }
277 optional State state = 3;
278}
279
280
281/**
282 * Logs when GPS state changes.
283 *
284 * Logged from:
285 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
286 */
287message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800288 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700289
290 enum State {
291 OFF = 0;
292 ON = 1;
293 }
294 optional State state = 2;
295}
296
297
298/**
299 * Logs when a sync manager sync state changes.
300 *
301 * Logged from:
302 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
303 */
304message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800305 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700306
307 // Name of the sync (as named in the app)
308 optional string name = 2;
309
310 enum State {
311 OFF = 0;
312 ON = 1;
313 }
314 optional State state = 3;
315}
316
317/**
318 * Logs when a job scheduler job state changes.
319 *
320 * Logged from:
321 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
322 */
323message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800324 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700325
326 // Name of the job (as named in the app)
327 optional string name = 2;
328
329 enum State {
330 OFF = 0;
331 ON = 1;
332 }
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
Bookatzc1a050a2017-10-10 15:49:28 -0700411 // Type of wakelock.
412 enum Type {
413 PARTIAL = 0;
414 FULL = 1;
415 WINDOW = 2;
416 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800417 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700418
419 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
420 optional string tag = 3;
421
422 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800423 RELEASE = 0;
424 ACQUIRE = 1;
425 CHANGE_RELEASE = 2;
426 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700427 }
428 optional State state = 4;
429}
430
431/**
Bookatzc1a050a2017-10-10 15:49:28 -0700432 * Logs when a partial wakelock is considered 'long' (over 1 min).
433 *
434 * Logged from:
435 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
436 */
437message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800438 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700439
Yao Chend54f9dd2017-10-17 17:37:48 +0000440 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
441 optional string tag = 2;
442
Bookatzc1a050a2017-10-10 15:49:28 -0700443 // TODO: I have no idea what this is.
444 optional string history_tag = 3;
445
446 enum State {
447 OFF = 0;
448 ON = 1;
449 }
450 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000451}
452
Bookatzc1a050a2017-10-10 15:49:28 -0700453/**
454 * Logs Battery Saver state change.
455 *
456 * Logged from:
457 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
458 */
459message BatterySaverModeStateChanged {
460 enum State {
461 OFF = 0;
462 ON = 1;
463 }
464 optional State state = 1;
465}
466
467/**
468 * Logs Doze mode state change.
469 *
470 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800471 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700472 */
473message DeviceIdleModeStateChanged {
474 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800475 enum State {
476 DEVICE_IDLE_MODE_OFF = 0;
477 DEVICE_IDLE_MODE_LIGHT = 1;
478 DEVICE_IDLE_MODE_DEEP = 2;
479 }
480 optional State state = 1;
481}
482
483
484/**
485 * Logs state change of Doze mode including maintenance windows.
486 *
487 * Logged from:
488 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
489 */
490message DeviceIdlingModeStateChanged {
491 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
492 enum State {
493 DEVICE_IDLE_MODE_OFF = 0;
494 DEVICE_IDLE_MODE_LIGHT = 1;
495 DEVICE_IDLE_MODE_DEEP = 2;
496 }
497 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700498}
499
500/**
501 * Logs screen brightness level.
502 *
503 * Logged from:
504 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
505 */
506message ScreenBrightnessChanged {
507 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
508 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700509}
510
511/**
512 * Logs battery level (percent full, from 0 to 100).
513 *
514 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700515 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700516 */
517message BatteryLevelChanged {
518 // Battery level. Should be in [0, 100].
519 optional int32 battery_level = 1;
520}
521
522/**
523 * Logs change in charging status of the device.
524 *
525 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700526 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700527 */
528message ChargingStateChanged {
529 // TODO: Link directly to BatteryManager.java's constants (via a proto).
530 enum State {
531 BATTERY_STATUS_UNKNOWN = 1;
532 BATTERY_STATUS_CHARGING = 2;
533 BATTERY_STATUS_DISCHARGING = 3;
534 BATTERY_STATUS_NOT_CHARGING = 4;
535 BATTERY_STATUS_FULL = 5;
536 }
537 optional State charging_state = 1;
538}
539
540/**
541 * Logs whether the device is plugged in, and what power source it is using.
542 *
543 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700544 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700545 */
546message PluggedStateChanged {
547 // TODO: Link directly to BatteryManager.java's constants (via a proto).
548 enum State {
549 // Note that NONE is not in BatteryManager.java's constants.
550 BATTERY_PLUGGED_NONE = 0;
551 // Power source is an AC charger.
552 BATTERY_PLUGGED_AC = 1;
553 // Power source is a USB port.
554 BATTERY_PLUGGED_USB = 2;
555 // Power source is wireless.
556 BATTERY_PLUGGED_WIRELESS = 4;
557 }
558 optional State plugged_state = 1;
559}
560
561/**
562 * Logs the temperature of the device, in tenths of a degree Celsius.
563 *
564 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700565 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700566 */
567message DeviceTemperatureReported {
568 // Temperature in tenths of a degree C.
569 optional int32 temperature = 1;
570}
571
572// TODO: Define this more precisely.
573// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
574/**
575 * Logs when the device turns off or on.
576 *
577 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700578 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700579 */
580message DeviceOnStatusChanged {
581 enum State {
582 OFF = 0;
583 ON = 1;
584 }
585 optional State state = 1;
586}
587
588/**
589 * Logs when an app's wakeup alarm fires.
590 *
591 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700592 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700593 */
594message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800595 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800596
597 // Name of the wakeup alarm.
598 optional string tag = 2;
599}
600
601/**
602 * Logs when an an app causes the mobile radio to change state.
603 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
604 *
605 * Logged from:
606 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
607 */
608message MobileRadioPowerStateChanged {
609 // TODO: Add attribution instead of uid?
610 optional int32 uid = 1;
611
612 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
613 enum PowerState {
614 DC_POWER_STATE_LOW = 1;
615 DC_POWER_STATE_MEDIUM = 2;
616 DC_POWER_STATE_HIGH = 3;
617 }
618 optional PowerState power_state = 2;
619}
620
621/**
622 * Logs when an an app causes the wifi radio to change state.
623 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
624 *
625 * Logged from:
626 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
627 */
628message WifiRadioPowerStateChanged {
629 // TODO: Add attribution instead of uid?
630 optional int32 uid = 1;
631
632 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
633 enum PowerState {
634 DC_POWER_STATE_LOW = 1;
635 DC_POWER_STATE_MEDIUM = 2;
636 DC_POWER_STATE_HIGH = 3;
637 }
638 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700639}
640
641/**
642 * Logs kernel wakeup reasons and aborts.
643 *
644 * Logged from:
645 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
646 */
647message KernelWakeupReported {
648 // Name of the kernel wakeup reason (or abort).
649 optional string wakeup_reason_name = 1;
650
651 // Duration (in microseconds) for the wake-up interrupt to be serviced.
652 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700653}
654
655/**
656 * Logs wifi locks held by an app.
657 *
658 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700659 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700660 */
661message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800662 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700663
664 enum State {
665 OFF = 0;
666 ON = 1;
667 }
668 optional State state = 2;
669}
670
671/**
672 * Logs wifi 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 WifiSignalStrengthChanged {
678 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
679 enum SignalStrength {
680 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
681 SIGNAL_STRENGTH_POOR = 1;
682 SIGNAL_STRENGTH_MODERATE = 2;
683 SIGNAL_STRENGTH_GOOD = 3;
684 SIGNAL_STRENGTH_GREAT = 4;
685 }
686 optional SignalStrength signal_strength = 1;
687}
688
689/**
690 * Logs wifi scans performed by an app.
691 *
692 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700693 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700694 */
695message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800696 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700697
698 enum State {
699 OFF = 0;
700 ON = 1;
701 }
702 optional State state = 2;
703}
704
705/**
706 * Logs phone signal strength changes.
707 *
708 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700709 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700710 */
711message PhoneSignalStrengthChanged {
712 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
713 enum SignalStrength {
714 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
715 SIGNAL_STRENGTH_POOR = 1;
716 SIGNAL_STRENGTH_MODERATE = 2;
717 SIGNAL_STRENGTH_GOOD = 3;
718 SIGNAL_STRENGTH_GREAT = 4;
719 }
720 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700721}
722
723/**
724 * Logs that a setting was updated.
725 * Logged from:
726 * frameworks/base/core/java/android/provider/Settings.java
727 * The tag and is_default allow resetting of settings to default values based on the specified
728 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
729 */
730message SettingChanged {
731 // The name of the setting.
732 optional string setting = 1;
733
734 // The change being imposed on this setting. May represent a number, eg "3".
735 optional string value = 2;
736
737 // The new value of this setting. For most settings, this is same as value. For some settings,
738 // value is +X or -X where X represents an element in a set. For example, if the previous value
739 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
740 // The +/- feature is currently only used for location_providers_allowed.
741 optional string new_value = 3;
742
743 // The previous value of this setting.
744 optional string prev_value = 4;
745
746 // The tag used with the is_default for resetting sets of settings. This is generally null.
747 optional string tag = 5;
748
749 // 1 indicates that this setting with tag should be resettable.
750 optional int32 is_default = 6;
751
752 // The user ID associated. Defined in android/os/UserHandle.java
753 optional int32 user = 7;
754}
Chenjie Yub3dda412017-10-24 13:41:59 -0700755
Chenjie Yu05013b32017-11-21 10:21:41 -0800756/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700757 * Logs activity going to foreground or background
758 *
759 * Logged from:
760 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
761 */
762message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800763 optional int32 uid = 1;
764 optional string pkg_name = 2;
765 optional string class_name = 3;
766
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700767 enum Activity {
768 MOVE_TO_BACKGROUND = 0;
769 MOVE_TO_FOREGROUND = 1;
770 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700771 optional Activity activity = 4;
772}
David Chenc8a43242017-10-17 16:23:28 -0700773
774/**
David Chen9e3808c2017-11-20 17:25:34 -0800775 * Logs when an error is written to dropbox.
776 * Logged from:
777 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
778 */
779message DropboxErrorChanged {
780 // The uid if available. -1 means not available.
781 optional int32 uid = 1;
782
783 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
784 optional string tag = 2;
785
786 // The name of the process.
787 optional string process_name = 3;
788
789 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800790 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800791
792 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800793 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800794
795 // The activity name if available.
796 optional string activity_name = 6;
797
David Chen6e3e6cb2018-01-03 16:14:06 -0800798 // The package name if available.
799 optional string package_name = 7;
800
David Chen9e3808c2017-11-20 17:25:34 -0800801 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800802 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800803}
804
David Chen0a368b22017-12-06 16:28:16 -0800805/*
806 * Allows other apps to push events into statsd.
807 * Logged from:
808 * frameworks/base/core/java/android/util/StatsLog.java
809 */
810message AppHook {
811 // The uid of the application that sent this custom atom.
812 optional int32 uid = 1;
813
814 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
815 optional int32 label = 2;
816
817 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
818 // predicates for the metrics).
819 enum State {
820 UNKNOWN = 0;
821 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
822 STOP = 2;
823 START = 3;
824 }
825 optional State state = 3;
826}
827
David Chen9e3808c2017-11-20 17:25:34 -0800828/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800829 * Logs when statsd detects an anomaly.
830 *
831 * Logged from:
832 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
833 */
834message AnomalyDetected {
835 // Uid that owns the config whose anomaly detection alert fired.
836 optional int32 config_uid = 1;
837
Yangster-mac94e197c2018-01-02 16:03:03 -0800838 // Id of the config whose anomaly detection alert fired.
839 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800840
Yangster-mac94e197c2018-01-02 16:03:03 -0800841 // Id of the alert (i.e. name of the anomaly that was detected).
842 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800843}
844
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000845message AppStartChanged {
846 // The uid if available. -1 means not available.
847 optional int32 uid = 1;
848
849 // The app package name.
850 optional string pkg_name = 2;
851
852 enum TransitionType {
853 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
854 WARM = 1;
855 HOT = 2;
856 COLD = 3;
857 }
858 // The transition type.
859 optional TransitionType type = 3;
860
861 // The activity name.
862 optional string activity_name = 4;
863
864 // The name of the calling app. Empty if not set.
865 optional string calling_pkg_name = 5;
866
867 // Whether the app is an instant app.
868 optional bool is_instant_app = 6;
869
870 // Device uptime when activity started.
871 optional int64 activity_start_msec = 7;
872
873 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
874 enum TransitionReason {
875 APP_START_TRANSITION_REASON_UNKNOWN = 0;
876 SPLASH_SCREEN = 1;
877 WINDOWS_DRAWN = 2;
878 TIMEOUT = 3;
879 SNAPSHOT = 4;
880 }
881 optional TransitionReason reason = 8;
882
883 optional int32 transition_delay_msec = 9;
884 // -1 if not set.
885 optional int32 starting_window_delay_msec = 10;
886 // -1 if not set.
887 optional int32 bind_application_delay_msec = 11;
888 optional int32 windows_drawn_delay_msec = 12;
889
890 // Empty if not set.
891 optional string launch_token = 13;
892
893}
894
895message AppStartCancelChanged {
896 // The uid if available. -1 means not available.
897 optional int32 uid = 1;
898
899 // The app package name.
900 optional string pkg_name = 2;
901
902 enum TransitionType {
903 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
904 WARM = 1;
905 HOT = 2;
906 COLD = 3;
907 }
908 // The transition type.
909 optional TransitionType type = 3;
910
911 // The activity name.
912 optional string activity_name = 4;
913}
914
915message AppStartFullyDrawnChanged {
916 // The uid if available. -1 means not available.
917 optional int32 uid = 1;
918
919 // The app package name.
920 optional string pkg_name = 2;
921
922 enum TransitionType {
923 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
924 WITH_BUNDLE = 1;
925 WITHOUT_BUNDLE = 2;
926 }
927 // The transition type.
928 optional TransitionType type = 3;
929
930 // The activity name.
931 optional string activity_name = 4;
932
933 optional bool transition_process_running = 5;
934
935 // App startup time (until call to Activity#reportFullyDrawn()).
936 optional int64 app_startup_time_ms = 6;
937}
938
Bookatz8fcd09a2017-12-18 13:01:10 -0800939/**
David Chenc8a43242017-10-17 16:23:28 -0700940 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
941 *
942 * Pulled from:
943 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
944 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800945message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700946 optional int32 uid = 1;
947
948 optional int64 rx_bytes = 2;
949
950 optional int64 rx_packets = 3;
951
952 optional int64 tx_bytes = 4;
953
954 optional int64 tx_packets = 5;
955}
956
957/**
958 * Pulls bytes transferred via wifi (separated by foreground and background usage).
959 *
960 * Pulled from:
961 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
962 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800963message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700964 optional int32 uid = 1;
965
966 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
967 optional int32 is_foreground = 2;
968
969 optional int64 rx_bytes = 3;
970
971 optional int64 rx_packets = 4;
972
973 optional int64 tx_bytes = 5;
974
975 optional int64 tx_packets = 6;
976}
977
978/**
979 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
980 *
981 * Pulled from:
982 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
983 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800984message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700985 optional int32 uid = 1;
986
987 optional int64 rx_bytes = 2;
988
989 optional int64 rx_packets = 3;
990
991 optional int64 tx_bytes = 4;
992
993 optional int64 tx_packets = 5;
994}
995
996/**
997 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
998 *
999 * Pulled from:
1000 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1001 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001002message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001003 optional int32 uid = 1;
1004
1005 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1006 optional int32 is_foreground = 2;
1007
1008 optional int64 rx_bytes = 3;
1009
1010 optional int64 rx_packets = 4;
1011
1012 optional int64 tx_bytes = 5;
1013
1014 optional int64 tx_packets = 6;
1015}
1016
1017/**
1018 * Pulls the kernel wakelock durations. This atom is adapted from
1019 * android/internal/os/KernelWakelockStats.java
1020 *
1021 * Pulled from:
1022 * StatsCompanionService using KernelWakelockReader.
1023 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001024message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001025 optional string name = 1;
1026
1027 optional int32 count = 2;
1028
1029 optional int32 version = 3;
1030
1031 optional int64 time = 4;
1032}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001033
Chenjie Yu05013b32017-11-21 10:21:41 -08001034/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001035 * Pulls low power state information. This includes platform and subsystem sleep state information,
1036 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001037 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001038 * hardware/interfaces/power/1.1/types.hal
1039 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001040message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001041 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1042 // YYY is corresponding voter name.
1043 // If there are no voters, the format should just be XXX (with no dot).
1044 // XXX and YYY should not contain a "." in it.
1045 optional string name = 1;
1046 // The number of times it entered, or voted for entering the sleep state
1047 optional uint64 count = 2;
1048 // The length of time spent in, or spent voting for, the sleep state
1049 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001050}
David Chen21582962017-11-01 17:32:46 -07001051
1052/**
1053 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1054 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1055 * attributed back to the parent (host) uid. One example is Chrome.
1056 *
1057 * Logged from:
1058 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1059 */
1060message IsolatedUidChanged {
1061 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1062 optional int32 parent_uid = 1;
1063
1064 optional int32 isolated_uid = 2;
1065
1066 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1067 // be removed before if it's used for another parent uid.
1068 optional int32 is_create = 3;
1069}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001070
Chenjie Yu05013b32017-11-21 10:21:41 -08001071/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001072 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001073 * Pulls the time the cpu spend on the frequency index. Frequency index
1074 * starts from highest to lowest. The value should be monotonically
1075 * increasing since boot. However, if there is a cpu
1076 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001077 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001078message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001079 optional uint32 cluster = 1;
1080 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001081 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001082}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001083
Chenjie Yu05013b32017-11-21 10:21:41 -08001084/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001085 * Pulls Cpu Time Per Uid.
1086 * Note that isolated process uid time should be attributed to host uids.
1087 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001088message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001089 optional uint64 uid = 1;
1090 optional uint64 user_time_ms = 2;
1091 optional uint64 sys_time_ms = 3;
1092}
1093
1094/**
1095 * Pulls Cpu Time Per Uid per frequency.
1096 * Note that isolated process uid time should be attributed to host uids.
1097 * For each uid, we order the time by descending frequencies.
1098 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001099message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001100 optional uint64 uid = 1;
1101 optional uint64 freq_idx = 2;
1102 optional uint64 time_ms = 3;
1103}
Hugo Benichi884970e2017-11-14 22:42:46 +09001104
1105/*
1106 * Logs the reception of an incoming network packet causing the main system to wake up for
1107 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1108 * and processed by WakeupController.cpp.
1109 */
1110message PacketWakeupOccurred {
1111 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1112 // delivered nowhere.
1113 optional int32 uid = 1;
1114 // The interface name on which the packet was received.
1115 optional string iface = 2;
1116 // The ethertype value of the packet.
1117 optional int32 ethertype = 3;
1118 // String representation of the destination MAC address of the packet.
1119 optional string destination_hardware_address = 4;
1120 // String representation of the source address of the packet if this was an IP packet.
1121 optional string source_ip = 5;
1122 // String representation of the destination address of the packet if this was an IP packet.
1123 optional string destination_ip = 6;
1124 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1125 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1126 // families.
1127 optional int32 ip_next_header = 7;
1128 // The source port if this was a TCP or UDP packet.
1129 optional int32 source_port = 8;
1130 // The destination port if this was a TCP or UDP packet.
1131 optional int32 destination_port = 9;
1132}
Chenjie Yu05013b32017-11-21 10:21:41 -08001133
1134/**
1135 * Pulls Wifi Controller Activity Energy Info
1136 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001137message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001138 // timestamp(wall clock) of record creation
1139 optional uint64 timestamp_ms = 1;
1140 // stack reported state
1141 // TODO: replace this with proto enum
1142 optional int32 stack_state = 2;
1143 // tx time in ms
1144 optional uint64 controller_tx_time_ms = 3;
1145 // rx time in ms
1146 optional uint64 controller_rx_time_ms = 4;
1147 // idle time in ms
1148 optional uint64 controller_idle_time_ms = 5;
1149 // product of current(mA), voltage(V) and time(ms)
1150 optional uint64 controller_energy_used = 6;
1151}
1152
1153/**
1154 * Pulls Modem Activity Energy Info
1155 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001156message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001157 // timestamp(wall clock) of record creation
1158 optional uint64 timestamp_ms = 1;
1159 // sleep time in ms.
1160 optional uint64 sleep_time_ms = 2;
1161 // idle time in ms
1162 optional uint64 controller_idle_time_ms = 3;
1163 /**
1164 * Tx power index
1165 * index 0 = tx_power < 0dBm
1166 * index 1 = 0dBm < tx_power < 5dBm
1167 * index 2 = 5dBm < tx_power < 15dBm
1168 * index 3 = 15dBm < tx_power < 20dBm
1169 * index 4 = tx_power > 20dBm
1170 */
1171 // tx time in ms at power level 0
1172 optional uint64 controller_tx_time_pl0_ms = 4;
1173 // tx time in ms at power level 1
1174 optional uint64 controller_tx_time_pl1_ms = 5;
1175 // tx time in ms at power level 2
1176 optional uint64 controller_tx_time_pl2_ms = 6;
1177 // tx time in ms at power level 3
1178 optional uint64 controller_tx_time_pl3_ms = 7;
1179 // tx time in ms at power level 4
1180 optional uint64 controller_tx_time_pl4_ms = 8;
1181 // rx time in ms at power level 5
1182 optional uint64 controller_rx_time_ms = 9;
1183 // product of current(mA), voltage(V) and time(ms)
1184 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001185}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001186
1187/*
1188 * Logs the memory stats for a process
1189 */
1190message MemoryStat {
1191 // The uid if available. -1 means not available.
1192 optional int32 uid = 1;
1193
1194 // The app package name.
1195 optional string pkg_name = 2;
1196
1197 // # of page-faults
1198 optional int64 pgfault = 3;
1199
1200 // # of major page-faults
1201 optional int64 pgmajfault = 4;
1202
1203 // RSS+CACHE(+SWAP)
1204 optional int64 usage_in_bytes = 5;
1205}
1206
1207/*
1208 * Logs the event when LMKD kills a process to reduce memory pressure
1209 * Logged from:
1210 * system/core/lmkd/lmkd.c
1211 */
1212message LmkEventOccurred {
1213 // The uid if available. -1 means not available.
1214 optional int32 uid = 1;
1215
1216 // The app package name.
1217 optional string pkg_name = 2;
1218
1219 // oom adj score.
1220 optional int32 oom_score = 3;
1221
1222 // Used as start/stop boundaries for the event
1223 enum State {
1224 UNKNOWN = 0;
1225 START = 1;
1226 END = 2;
1227 }
1228 optional State state = 4;
1229}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001230
1231/*
1232 * Cpu syspend time for cpu power calculation.
1233 */
1234message CpuSuspendTime {
1235 optional uint64 time = 1;
1236}
1237
1238/*
1239 * Cpu idle time for cpu power calculation.
1240 */
1241message CpuIdleTime {
1242 optional uint64 time = 1;
1243}
1244
1245/*
1246 * Reads from /proc/uid_concurrent_active_time which has the format:
1247 * active: X (X is # cores)
1248 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1249 * [uid1]: [time-0] [time-1] [time-2] ... ...
1250 * ...
1251 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1252 * The file contains a monotonically increasing count of time for a single boot.
1253 */
1254message CpuActiveTime {
1255 optional uint64 uid = 1;
1256 optional uint64 idx = 2;
1257 optional uint64 time_ms = 3;
1258}
1259
1260/**
1261 * Reads from /proc/uid_concurrent_policy_time which has the format:
1262 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1263 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1264 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1265 * ...
1266 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1267 * The file contains a monotonically increasing count of time for a single boot.
1268 */
1269message CpuClusterTime {
1270 optional uint64 uid = 1;
1271 optional uint64 idx = 2;
1272 optional uint64 time_ms = 3;
1273}