Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
Chenjie Yu | 80f9112 | 2018-01-31 20:24:50 -0800 | [diff] [blame] | 17 | #define DEBUG false |
Joe Onorato | 9fc9edf | 2017-10-15 20:08:52 -0700 | [diff] [blame] | 18 | #include "Log.h" |
Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 19 | |
Alec Mouri | 1dc5f1e | 2019-09-18 21:13:01 -0700 | [diff] [blame] | 20 | #include "StatsPullerManager.h" |
| 21 | |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 22 | #include <android/os/IPullAtomCallback.h> |
Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 23 | #include <android/os/IStatsCompanionService.h> |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 24 | #include <android/os/IStatsPullerCallback.h> |
David Chen | 1481fe1 | 2017-10-16 13:16:34 -0700 | [diff] [blame] | 25 | #include <cutils/log.h> |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 26 | #include <math.h> |
Chenjie Yu | 3b3adcd | 2018-04-18 16:25:36 -0700 | [diff] [blame] | 27 | #include <stdint.h> |
Alec Mouri | 1dc5f1e | 2019-09-18 21:13:01 -0700 | [diff] [blame] | 28 | |
David Chen | 1481fe1 | 2017-10-16 13:16:34 -0700 | [diff] [blame] | 29 | #include <algorithm> |
Alec Mouri | 1dc5f1e | 2019-09-18 21:13:01 -0700 | [diff] [blame] | 30 | #include <iostream> |
| 31 | |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 32 | #include "../StatsService.h" |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 33 | #include "../logd/LogEvent.h" |
| 34 | #include "../stats_log_util.h" |
| 35 | #include "../statscompanion_util.h" |
Mark Tabry | 9dc1357 | 2019-11-06 13:42:30 -0800 | [diff] [blame] | 36 | #include "CarStatsPuller.h" |
Yiwei Zhang | 7e63303 | 2019-03-01 17:25:27 -0800 | [diff] [blame] | 37 | #include "GpuStatsPuller.h" |
Bookatz | 92da283 | 2018-11-01 18:10:03 -0700 | [diff] [blame] | 38 | #include "PowerStatsPuller.h" |
Tej Singh | 4029831 | 2018-02-16 00:15:09 -0800 | [diff] [blame] | 39 | #include "ResourceHealthManagerPuller.h" |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 40 | #include "StatsCallbackPuller.h" |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 41 | #include "StatsCallbackPullerDeprecated.h" |
Chenjie Yu | 97dbb20 | 2019-02-13 16:42:04 -0800 | [diff] [blame] | 42 | #include "StatsCompanionServicePuller.h" |
Tej Singh | bf972d9 | 2018-01-10 20:51:13 -0800 | [diff] [blame] | 43 | #include "SubsystemSleepStatePuller.h" |
Chenjie Yu | 97dbb20 | 2019-02-13 16:42:04 -0800 | [diff] [blame] | 44 | #include "TrainInfoPuller.h" |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 45 | #include "statslog.h" |
David Chen | 1481fe1 | 2017-10-16 13:16:34 -0700 | [diff] [blame] | 46 | |
Yao Chen | 93fe3a3 | 2017-11-02 13:52:59 -0700 | [diff] [blame] | 47 | using std::make_shared; |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 48 | using std::map; |
Yao Chen | 93fe3a3 | 2017-11-02 13:52:59 -0700 | [diff] [blame] | 49 | using std::shared_ptr; |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 50 | using std::string; |
| 51 | using std::vector; |
Chenjie Yu | 6736c89 | 2017-11-09 10:50:09 -0800 | [diff] [blame] | 52 | using std::list; |
Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 53 | |
| 54 | namespace android { |
| 55 | namespace os { |
| 56 | namespace statsd { |
| 57 | |
Chenjie Yu | 3b3adcd | 2018-04-18 16:25:36 -0700 | [diff] [blame] | 58 | // Values smaller than this may require to update the alarm. |
| 59 | const int64_t NO_ALARM_UPDATE = INT64_MAX; |
| 60 | |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 61 | std::map<PullerKey, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 62 | // wifi_bytes_transfer |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 63 | {{.atomTag = android::util::WIFI_BYTES_TRANSFER}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 64 | {.additiveFields = {2, 3, 4, 5}, |
| 65 | .puller = new StatsCompanionServicePuller(android::util::WIFI_BYTES_TRANSFER)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 66 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 67 | // wifi_bytes_transfer_by_fg_bg |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 68 | {{.atomTag = android::util::WIFI_BYTES_TRANSFER_BY_FG_BG}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 69 | {.additiveFields = {3, 4, 5, 6}, |
| 70 | .puller = new StatsCompanionServicePuller(android::util::WIFI_BYTES_TRANSFER_BY_FG_BG)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 71 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 72 | // mobile_bytes_transfer |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 73 | {{.atomTag = android::util::MOBILE_BYTES_TRANSFER}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 74 | {.additiveFields = {2, 3, 4, 5}, |
| 75 | .puller = new StatsCompanionServicePuller(android::util::MOBILE_BYTES_TRANSFER)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 76 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 77 | // mobile_bytes_transfer_by_fg_bg |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 78 | {{.atomTag = android::util::MOBILE_BYTES_TRANSFER_BY_FG_BG}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 79 | {.additiveFields = {3, 4, 5, 6}, |
| 80 | .puller = |
| 81 | new StatsCompanionServicePuller(android::util::MOBILE_BYTES_TRANSFER_BY_FG_BG)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 82 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 83 | // bluetooth_bytes_transfer |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 84 | {{.atomTag = android::util::BLUETOOTH_BYTES_TRANSFER}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 85 | {.additiveFields = {2, 3}, |
| 86 | .puller = new StatsCompanionServicePuller(android::util::BLUETOOTH_BYTES_TRANSFER)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 87 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 88 | // kernel_wakelock |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 89 | {{.atomTag = android::util::KERNEL_WAKELOCK}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 90 | {.puller = new StatsCompanionServicePuller(android::util::KERNEL_WAKELOCK)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 91 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 92 | // subsystem_sleep_state |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 93 | {{.atomTag = android::util::SUBSYSTEM_SLEEP_STATE}, |
| 94 | {.puller = new SubsystemSleepStatePuller()}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 95 | |
Bookatz | 92da283 | 2018-11-01 18:10:03 -0700 | [diff] [blame] | 96 | // on_device_power_measurement |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 97 | {{.atomTag = android::util::ON_DEVICE_POWER_MEASUREMENT}, |
| 98 | {.puller = new PowerStatsPuller()}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 99 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 100 | // cpu_time_per_freq |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 101 | {{.atomTag = android::util::CPU_TIME_PER_FREQ}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 102 | {.additiveFields = {3}, |
| 103 | .puller = new StatsCompanionServicePuller(android::util::CPU_TIME_PER_FREQ)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 104 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 105 | // cpu_time_per_uid |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 106 | {{.atomTag = android::util::CPU_TIME_PER_UID}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 107 | {.additiveFields = {2, 3}, |
| 108 | .puller = new StatsCompanionServicePuller(android::util::CPU_TIME_PER_UID)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 109 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 110 | // cpu_time_per_uid_freq |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 111 | // the throttling is 3sec, handled in |
| 112 | // frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 113 | {{.atomTag = android::util::CPU_TIME_PER_UID_FREQ}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 114 | {.additiveFields = {4}, |
| 115 | .puller = new StatsCompanionServicePuller(android::util::CPU_TIME_PER_UID_FREQ)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 116 | |
Chenjie Yu | ec67661 | 2018-03-07 09:19:17 -0800 | [diff] [blame] | 117 | // cpu_active_time |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 118 | // the throttling is 3sec, handled in |
| 119 | // frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 120 | {{.atomTag = android::util::CPU_ACTIVE_TIME}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 121 | {.additiveFields = {2}, |
| 122 | .puller = new StatsCompanionServicePuller(android::util::CPU_ACTIVE_TIME)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 123 | |
Chenjie Yu | ec67661 | 2018-03-07 09:19:17 -0800 | [diff] [blame] | 124 | // cpu_cluster_time |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 125 | // the throttling is 3sec, handled in |
| 126 | // frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 127 | {{.atomTag = android::util::CPU_CLUSTER_TIME}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 128 | {.additiveFields = {3}, |
| 129 | .puller = new StatsCompanionServicePuller(android::util::CPU_CLUSTER_TIME)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 130 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 131 | // wifi_activity_energy_info |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 132 | {{.atomTag = android::util::WIFI_ACTIVITY_INFO}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 133 | {.puller = new StatsCompanionServicePuller(android::util::WIFI_ACTIVITY_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 134 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 135 | // modem_activity_info |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 136 | {{.atomTag = android::util::MODEM_ACTIVITY_INFO}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 137 | {.puller = new StatsCompanionServicePuller(android::util::MODEM_ACTIVITY_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 138 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 139 | // bluetooth_activity_info |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 140 | {{.atomTag = android::util::BLUETOOTH_ACTIVITY_INFO}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 141 | {.puller = new StatsCompanionServicePuller(android::util::BLUETOOTH_ACTIVITY_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 142 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 143 | // system_elapsed_realtime |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 144 | {{.atomTag = android::util::SYSTEM_ELAPSED_REALTIME}, |
Nick Desaulniers | 691e1a0 | 2019-10-10 13:08:34 -0700 | [diff] [blame] | 145 | {.coolDownNs = NS_PER_SEC, |
| 146 | .puller = new StatsCompanionServicePuller(android::util::SYSTEM_ELAPSED_REALTIME), |
| 147 | .pullTimeoutNs = NS_PER_SEC / 2, |
| 148 | }}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 149 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 150 | // system_uptime |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 151 | {{.atomTag = android::util::SYSTEM_UPTIME}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 152 | {.puller = new StatsCompanionServicePuller(android::util::SYSTEM_UPTIME)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 153 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 154 | // remaining_battery_capacity |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 155 | {{.atomTag = android::util::REMAINING_BATTERY_CAPACITY}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 156 | {.puller = new ResourceHealthManagerPuller(android::util::REMAINING_BATTERY_CAPACITY)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 157 | |
Chenjie Yu | feba309 | 2018-02-08 14:33:37 -0800 | [diff] [blame] | 158 | // full_battery_capacity |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 159 | {{.atomTag = android::util::FULL_BATTERY_CAPACITY}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 160 | {.puller = new ResourceHealthManagerPuller(android::util::FULL_BATTERY_CAPACITY)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 161 | |
Bookatz | 17f0d8a | 2018-09-13 12:56:32 -0700 | [diff] [blame] | 162 | // battery_voltage |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 163 | {{.atomTag = android::util::BATTERY_VOLTAGE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 164 | {.puller = new ResourceHealthManagerPuller(android::util::BATTERY_VOLTAGE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 165 | |
Maggie White | 8735b85 | 2019-01-18 11:40:49 -0800 | [diff] [blame] | 166 | // battery_level |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 167 | {{.atomTag = android::util::BATTERY_LEVEL}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 168 | {.puller = new ResourceHealthManagerPuller(android::util::BATTERY_LEVEL)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 169 | |
Maggie White | 8735b85 | 2019-01-18 11:40:49 -0800 | [diff] [blame] | 170 | // battery_cycle_count |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 171 | {{.atomTag = android::util::BATTERY_CYCLE_COUNT}, |
Maggie White | 8735b85 | 2019-01-18 11:40:49 -0800 | [diff] [blame] | 172 | {.puller = new ResourceHealthManagerPuller(android::util::BATTERY_CYCLE_COUNT)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 173 | |
Rajeev Kumar | 22d92b7 | 2018-02-07 18:38:36 -0800 | [diff] [blame] | 174 | // process_memory_state |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 175 | {{.atomTag = android::util::PROCESS_MEMORY_STATE}, |
Rafal Slawik | 203c3db | 2019-09-25 19:53:01 +0100 | [diff] [blame] | 176 | {.additiveFields = {4, 5, 6, 7, 8}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 177 | .puller = new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 178 | |
Rafal Slawik | d4e8757 | 2019-03-12 13:08:38 +0000 | [diff] [blame] | 179 | // process_memory_high_water_mark |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 180 | {{.atomTag = android::util::PROCESS_MEMORY_HIGH_WATER_MARK}, |
Rafal Slawik | 203c3db | 2019-09-25 19:53:01 +0100 | [diff] [blame] | 181 | {.puller = |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 182 | new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_HIGH_WATER_MARK)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 183 | |
Rafal Slawik | 7efcefb | 2019-09-20 11:16:20 +0100 | [diff] [blame] | 184 | // process_memory_snapshot |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 185 | {{.atomTag = android::util::PROCESS_MEMORY_SNAPSHOT}, |
Rafal Slawik | 7efcefb | 2019-09-20 11:16:20 +0100 | [diff] [blame] | 186 | {.puller = new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_SNAPSHOT)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 187 | |
Rafal Slawik | d4e8757 | 2019-03-12 13:08:38 +0000 | [diff] [blame] | 188 | // system_ion_heap_size |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 189 | {{.atomTag = android::util::SYSTEM_ION_HEAP_SIZE}, |
Rafal Slawik | d4e8757 | 2019-03-12 13:08:38 +0000 | [diff] [blame] | 190 | {.puller = new StatsCompanionServicePuller(android::util::SYSTEM_ION_HEAP_SIZE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 191 | |
Rafal Slawik | 77987ed | 2019-06-17 12:28:23 +0100 | [diff] [blame] | 192 | // process_system_ion_heap_size |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 193 | {{.atomTag = android::util::PROCESS_SYSTEM_ION_HEAP_SIZE}, |
Rafal Slawik | 77987ed | 2019-06-17 12:28:23 +0100 | [diff] [blame] | 194 | {.puller = new StatsCompanionServicePuller(android::util::PROCESS_SYSTEM_ION_HEAP_SIZE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 195 | |
Tej Singh | 4029831 | 2018-02-16 00:15:09 -0800 | [diff] [blame] | 196 | // temperature |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 197 | {{.atomTag = android::util::TEMPERATURE}, |
Chenjie Yu | 97dbb20 | 2019-02-13 16:42:04 -0800 | [diff] [blame] | 198 | {.puller = new StatsCompanionServicePuller(android::util::TEMPERATURE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 199 | |
Maggie White | 442b631 | 2019-04-05 16:26:44 -0700 | [diff] [blame] | 200 | // cooling_device |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 201 | {{.atomTag = android::util::COOLING_DEVICE}, |
Maggie White | 442b631 | 2019-04-05 16:26:44 -0700 | [diff] [blame] | 202 | {.puller = new StatsCompanionServicePuller(android::util::COOLING_DEVICE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 203 | |
Olivier Gaillard | 00bfb1b | 2018-07-10 11:25:09 +0100 | [diff] [blame] | 204 | // binder_calls |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 205 | {{.atomTag = android::util::BINDER_CALLS}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 206 | {.additiveFields = {4, 5, 6, 8, 12}, |
| 207 | .puller = new StatsCompanionServicePuller(android::util::BINDER_CALLS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 208 | |
Olivier Gaillard | 6f52d15 | 2018-07-25 12:13:12 +0100 | [diff] [blame] | 209 | // binder_calls_exceptions |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 210 | {{.atomTag = android::util::BINDER_CALLS_EXCEPTIONS}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 211 | {.puller = new StatsCompanionServicePuller(android::util::BINDER_CALLS_EXCEPTIONS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 212 | |
Marcin Oczeretko | d8cc859 | 2018-08-22 16:07:36 +0100 | [diff] [blame] | 213 | // looper_stats |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 214 | {{.atomTag = android::util::LOOPER_STATS}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 215 | {.additiveFields = {5, 6, 7, 8, 9}, |
| 216 | .puller = new StatsCompanionServicePuller(android::util::LOOPER_STATS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 217 | |
Tej Singh | 86dc9db | 2018-09-06 00:39:57 +0000 | [diff] [blame] | 218 | // Disk Stats |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 219 | {{.atomTag = android::util::DISK_STATS}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 220 | {.puller = new StatsCompanionServicePuller(android::util::DISK_STATS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 221 | |
Tej Singh | 86dc9db | 2018-09-06 00:39:57 +0000 | [diff] [blame] | 222 | // Directory usage |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 223 | {{.atomTag = android::util::DIRECTORY_USAGE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 224 | {.puller = new StatsCompanionServicePuller(android::util::DIRECTORY_USAGE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 225 | |
Tej Singh | 86dc9db | 2018-09-06 00:39:57 +0000 | [diff] [blame] | 226 | // Size of app's code, data, and cache |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 227 | {{.atomTag = android::util::APP_SIZE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 228 | {.puller = new StatsCompanionServicePuller(android::util::APP_SIZE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 229 | |
Tej Singh | 86dc9db | 2018-09-06 00:39:57 +0000 | [diff] [blame] | 230 | // Size of specific categories of files. Eg. Music. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 231 | {{.atomTag = android::util::CATEGORY_SIZE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 232 | {.puller = new StatsCompanionServicePuller(android::util::CATEGORY_SIZE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 233 | |
Kevin Chyn | 6ecc570 | 2019-01-28 12:00:37 -0800 | [diff] [blame] | 234 | // Number of fingerprints enrolled for each user. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 235 | {{.atomTag = android::util::NUM_FINGERPRINTS_ENROLLED}, |
Kevin Chyn | 1741a07 | 2019-01-17 11:54:40 -0800 | [diff] [blame] | 236 | {.puller = new StatsCompanionServicePuller(android::util::NUM_FINGERPRINTS_ENROLLED)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 237 | |
Kevin Chyn | 6ecc570 | 2019-01-28 12:00:37 -0800 | [diff] [blame] | 238 | // Number of faces enrolled for each user. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 239 | {{.atomTag = android::util::NUM_FACES_ENROLLED}, |
Kevin Chyn | 6ecc570 | 2019-01-28 12:00:37 -0800 | [diff] [blame] | 240 | {.puller = new StatsCompanionServicePuller(android::util::NUM_FACES_ENROLLED)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 241 | |
Chenjie Yu | 2c0d83d | 2018-09-02 06:37:08 -0700 | [diff] [blame] | 242 | // ProcStats. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 243 | {{.atomTag = android::util::PROC_STATS}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 244 | {.puller = new StatsCompanionServicePuller(android::util::PROC_STATS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 245 | |
Chenjie Yu | b52779e | 2018-10-05 12:03:36 -0700 | [diff] [blame] | 246 | // ProcStatsPkgProc. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 247 | {{.atomTag = android::util::PROC_STATS_PKG_PROC}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 248 | {.puller = new StatsCompanionServicePuller(android::util::PROC_STATS_PKG_PROC)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 249 | |
Tej Singh | e7726dc | 2018-09-21 11:42:12 -0700 | [diff] [blame] | 250 | // Disk I/O stats per uid. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 251 | {{.atomTag = android::util::DISK_IO}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 252 | {.additiveFields = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, |
| 253 | .coolDownNs = 3 * NS_PER_SEC, |
| 254 | .puller = new StatsCompanionServicePuller(android::util::DISK_IO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 255 | |
Chenjie Yu | ab53020 | 2018-09-26 12:39:20 -0700 | [diff] [blame] | 256 | // PowerProfile constants for power model calculations. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 257 | {{.atomTag = android::util::POWER_PROFILE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 258 | {.puller = new StatsCompanionServicePuller(android::util::POWER_PROFILE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 259 | |
Yangster-mac | 308ea0c | 2018-10-22 13:10:25 -0700 | [diff] [blame] | 260 | // Process cpu stats. Min cool-down is 5 sec, inline with what AcitivityManagerService uses. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 261 | {{.atomTag = android::util::PROCESS_CPU_TIME}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 262 | {.coolDownNs = 5 * NS_PER_SEC /* min cool-down in seconds*/, |
| 263 | .puller = new StatsCompanionServicePuller(android::util::PROCESS_CPU_TIME)}}, |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 264 | {{.atomTag = android::util::CPU_TIME_PER_THREAD_FREQ}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 265 | {.additiveFields = {7, 9, 11, 13, 15, 17, 19, 21}, |
| 266 | .puller = new StatsCompanionServicePuller(android::util::CPU_TIME_PER_THREAD_FREQ)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 267 | |
Bookatz | 75ee6042 | 2018-11-09 12:27:37 -0800 | [diff] [blame] | 268 | // DeviceCalculatedPowerUse. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 269 | {{.atomTag = android::util::DEVICE_CALCULATED_POWER_USE}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 270 | {.puller = new StatsCompanionServicePuller(android::util::DEVICE_CALCULATED_POWER_USE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 271 | |
Bookatz | 75ee6042 | 2018-11-09 12:27:37 -0800 | [diff] [blame] | 272 | // DeviceCalculatedPowerBlameUid. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 273 | {{.atomTag = android::util::DEVICE_CALCULATED_POWER_BLAME_UID}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 274 | {.puller = new StatsCompanionServicePuller( |
| 275 | android::util::DEVICE_CALCULATED_POWER_BLAME_UID)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 276 | |
Bookatz | 75ee6042 | 2018-11-09 12:27:37 -0800 | [diff] [blame] | 277 | // DeviceCalculatedPowerBlameOther. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 278 | {{.atomTag = android::util::DEVICE_CALCULATED_POWER_BLAME_OTHER}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 279 | {.puller = new StatsCompanionServicePuller( |
| 280 | android::util::DEVICE_CALCULATED_POWER_BLAME_OTHER)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 281 | |
Olivier Gaillard | 18d45220 | 2019-01-22 15:03:41 +0000 | [diff] [blame] | 282 | // DebugElapsedClock. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 283 | {{.atomTag = android::util::DEBUG_ELAPSED_CLOCK}, |
Olivier Gaillard | 18d45220 | 2019-01-22 15:03:41 +0000 | [diff] [blame] | 284 | {.additiveFields = {1, 2, 3, 4}, |
| 285 | .puller = new StatsCompanionServicePuller(android::util::DEBUG_ELAPSED_CLOCK)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 286 | |
Olivier Gaillard | 18d45220 | 2019-01-22 15:03:41 +0000 | [diff] [blame] | 287 | // DebugFailingElapsedClock. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 288 | {{.atomTag = android::util::DEBUG_FAILING_ELAPSED_CLOCK}, |
Olivier Gaillard | 18d45220 | 2019-01-22 15:03:41 +0000 | [diff] [blame] | 289 | {.additiveFields = {1, 2, 3, 4}, |
| 290 | .puller = new StatsCompanionServicePuller(android::util::DEBUG_FAILING_ELAPSED_CLOCK)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 291 | |
Bookatz | 366a443 | 2018-11-20 09:42:33 -0800 | [diff] [blame] | 292 | // BuildInformation. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 293 | {{.atomTag = android::util::BUILD_INFORMATION}, |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 294 | {.puller = new StatsCompanionServicePuller(android::util::BUILD_INFORMATION)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 295 | |
Philip P. Moltmann | 70b42ae | 2019-01-29 16:24:19 -0800 | [diff] [blame] | 296 | // RoleHolder. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 297 | {{.atomTag = android::util::ROLE_HOLDER}, |
Philip P. Moltmann | 70b42ae | 2019-01-29 16:24:19 -0800 | [diff] [blame] | 298 | {.puller = new StatsCompanionServicePuller(android::util::ROLE_HOLDER)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 299 | |
Philip P. Moltmann | f21a350 | 2019-01-30 09:53:04 -0800 | [diff] [blame] | 300 | // PermissionState. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 301 | {{.atomTag = android::util::DANGEROUS_PERMISSION_STATE}, |
Philip P. Moltmann | f21a350 | 2019-01-30 09:53:04 -0800 | [diff] [blame] | 302 | {.puller = new StatsCompanionServicePuller(android::util::DANGEROUS_PERMISSION_STATE)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 303 | |
Chenjie Yu | 97dbb20 | 2019-02-13 16:42:04 -0800 | [diff] [blame] | 304 | // TrainInfo. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 305 | {{.atomTag = android::util::TRAIN_INFO}, {.puller = new TrainInfoPuller()}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 306 | |
Neil Fuller | db14b48 | 2019-02-05 19:44:44 +0000 | [diff] [blame] | 307 | // TimeZoneDataInfo. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 308 | {{.atomTag = android::util::TIME_ZONE_DATA_INFO}, |
Neil Fuller | db14b48 | 2019-02-05 19:44:44 +0000 | [diff] [blame] | 309 | {.puller = new StatsCompanionServicePuller(android::util::TIME_ZONE_DATA_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 310 | |
Carmen Agimof | 12dec12 | 2019-03-06 16:14:38 +0000 | [diff] [blame] | 311 | // ExternalStorageInfo |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 312 | {{.atomTag = android::util::EXTERNAL_STORAGE_INFO}, |
Carmen Agimof | 12dec12 | 2019-03-06 16:14:38 +0000 | [diff] [blame] | 313 | {.puller = new StatsCompanionServicePuller(android::util::EXTERNAL_STORAGE_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 314 | |
Yiwei Zhang | 7e63303 | 2019-03-01 17:25:27 -0800 | [diff] [blame] | 315 | // GpuStatsGlobalInfo |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 316 | {{.atomTag = android::util::GPU_STATS_GLOBAL_INFO}, |
Yiwei Zhang | 7e63303 | 2019-03-01 17:25:27 -0800 | [diff] [blame] | 317 | {.puller = new GpuStatsPuller(android::util::GPU_STATS_GLOBAL_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 318 | |
Yiwei Zhang | 4fb9289 | 2019-03-04 14:29:25 -0800 | [diff] [blame] | 319 | // GpuStatsAppInfo |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 320 | {{.atomTag = android::util::GPU_STATS_APP_INFO}, |
Yiwei Zhang | 4fb9289 | 2019-03-04 14:29:25 -0800 | [diff] [blame] | 321 | {.puller = new GpuStatsPuller(android::util::GPU_STATS_APP_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 322 | |
Carmen Agimof | a769c15 | 2019-03-04 14:39:14 +0000 | [diff] [blame] | 323 | // AppsOnExternalStorageInfo |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 324 | {{.atomTag = android::util::APPS_ON_EXTERNAL_STORAGE_INFO}, |
Carmen Agimof | a769c15 | 2019-03-04 14:39:14 +0000 | [diff] [blame] | 325 | {.puller = new StatsCompanionServicePuller(android::util::APPS_ON_EXTERNAL_STORAGE_INFO)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 326 | |
joshmccloskey | 34c1f8e | 2019-04-11 14:06:43 -0700 | [diff] [blame] | 327 | // Face Settings |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 328 | {{.atomTag = android::util::FACE_SETTINGS}, |
joshmccloskey | 34c1f8e | 2019-04-11 14:06:43 -0700 | [diff] [blame] | 329 | {.puller = new StatsCompanionServicePuller(android::util::FACE_SETTINGS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 330 | |
Martijn Coenen | cd95d46 | 2019-04-25 17:09:45 +0200 | [diff] [blame] | 331 | // App ops |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 332 | {{.atomTag = android::util::APP_OPS}, |
Martijn Coenen | cd95d46 | 2019-04-25 17:09:45 +0200 | [diff] [blame] | 333 | {.puller = new StatsCompanionServicePuller(android::util::APP_OPS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 334 | |
Mark Tabry | 9dc1357 | 2019-11-06 13:42:30 -0800 | [diff] [blame] | 335 | // VmsClientStats |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 336 | {{.atomTag = android::util::VMS_CLIENT_STATS}, |
Mark Tabry | 9dc1357 | 2019-11-06 13:42:30 -0800 | [diff] [blame] | 337 | {.additiveFields = {5, 6, 7, 8, 9, 10}, |
| 338 | .puller = new CarStatsPuller(android::util::VMS_CLIENT_STATS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 339 | |
Chris Wren | cdea3b7 | 2019-11-22 16:58:17 -0500 | [diff] [blame] | 340 | // NotiifcationRemoteViews. |
| 341 | {{.atomTag = android::util::NOTIFICATION_REMOTE_VIEWS}, |
| 342 | {.puller = new StatsCompanionServicePuller(android::util::NOTIFICATION_REMOTE_VIEWS)}}, |
Jeffrey Huang | fdd3c7c | 2020-01-09 13:54:24 -0800 | [diff] [blame^] | 343 | |
Stanislav Zholnin | ccb82e4 | 2019-11-29 18:59:49 +0000 | [diff] [blame] | 344 | // PermissionStateSampled. |
| 345 | {{.atomTag = android::util::DANGEROUS_PERMISSION_STATE_SAMPLED}, |
| 346 | {.puller = |
| 347 | new StatsCompanionServicePuller(android::util::DANGEROUS_PERMISSION_STATE_SAMPLED)}}, |
Chenjie Yu | 2c0d83d | 2018-09-02 06:37:08 -0700 | [diff] [blame] | 348 | }; |
Chenjie Yu | 80f9112 | 2018-01-31 20:24:50 -0800 | [diff] [blame] | 349 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 350 | StatsPullerManager::StatsPullerManager() : mNextPullTimeNs(NO_ALARM_UPDATE) { |
Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 351 | } |
| 352 | |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 353 | bool StatsPullerManager::Pull(int tagId, vector<shared_ptr<LogEvent>>* data) { |
Tej Singh | fa1c137 | 2019-12-05 20:36:54 -0800 | [diff] [blame] | 354 | AutoMutex _l(mLock); |
| 355 | return PullLocked(tagId, data); |
| 356 | } |
| 357 | |
| 358 | bool StatsPullerManager::PullLocked(int tagId, vector<shared_ptr<LogEvent>>* data) { |
Tej Singh | 484524a | 2018-02-01 15:10:05 -0800 | [diff] [blame] | 359 | VLOG("Initiating pulling %d", tagId); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 360 | |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 361 | if (kAllPullAtomInfo.find({.atomTag = tagId}) != kAllPullAtomInfo.end()) { |
| 362 | bool ret = kAllPullAtomInfo.find({.atomTag = tagId})->second.puller->Pull(data); |
Tej Singh | 484524a | 2018-02-01 15:10:05 -0800 | [diff] [blame] | 363 | VLOG("pulled %d items", (int)data->size()); |
Misha Wagner | 1eee221 | 2019-01-22 11:47:11 +0000 | [diff] [blame] | 364 | if (!ret) { |
| 365 | StatsdStats::getInstance().notePullFailed(tagId); |
| 366 | } |
Tej Singh | 484524a | 2018-02-01 15:10:05 -0800 | [diff] [blame] | 367 | return ret; |
Yao Chen | 93fe3a3 | 2017-11-02 13:52:59 -0700 | [diff] [blame] | 368 | } else { |
Tej Singh | 484524a | 2018-02-01 15:10:05 -0800 | [diff] [blame] | 369 | VLOG("Unknown tagId %d", tagId); |
Yao Chen | 93fe3a3 | 2017-11-02 13:52:59 -0700 | [diff] [blame] | 370 | return false; // Return early since we don't know what to pull. |
| 371 | } |
| 372 | } |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 373 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 374 | bool StatsPullerManager::PullerForMatcherExists(int tagId) const { |
Tej Singh | de473b51 | 2019-04-10 19:25:03 -0700 | [diff] [blame] | 375 | // Vendor pulled atoms might be registered after we parse the config. |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 376 | return isVendorPulledAtom(tagId) || |
| 377 | kAllPullAtomInfo.find({.atomTag = tagId}) != kAllPullAtomInfo.end(); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 378 | } |
| 379 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 380 | void StatsPullerManager::updateAlarmLocked() { |
Chenjie Yu | 3b3adcd | 2018-04-18 16:25:36 -0700 | [diff] [blame] | 381 | if (mNextPullTimeNs == NO_ALARM_UPDATE) { |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 382 | VLOG("No need to set alarms. Skipping"); |
| 383 | return; |
| 384 | } |
| 385 | |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 386 | sp<IStatsCompanionService> statsCompanionServiceCopy = mStatsCompanionService; |
| 387 | if (statsCompanionServiceCopy != nullptr) { |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 388 | statsCompanionServiceCopy->setPullingAlarm(mNextPullTimeNs / 1000000); |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 389 | } else { |
| 390 | VLOG("StatsCompanionService not available. Alarm not set."); |
| 391 | } |
| 392 | return; |
| 393 | } |
| 394 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 395 | void StatsPullerManager::SetStatsCompanionService( |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 396 | sp<IStatsCompanionService> statsCompanionService) { |
| 397 | AutoMutex _l(mLock); |
| 398 | sp<IStatsCompanionService> tmpForLock = mStatsCompanionService; |
| 399 | mStatsCompanionService = statsCompanionService; |
| 400 | for (const auto& pulledAtom : kAllPullAtomInfo) { |
| 401 | pulledAtom.second.puller->SetStatsCompanionService(statsCompanionService); |
| 402 | } |
| 403 | if (mStatsCompanionService != nullptr) { |
| 404 | updateAlarmLocked(); |
| 405 | } |
| 406 | } |
| 407 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 408 | void StatsPullerManager::RegisterReceiver(int tagId, wp<PullDataReceiver> receiver, |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 409 | int64_t nextPullTimeNs, int64_t intervalNs) { |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 410 | AutoMutex _l(mLock); |
Chenjie Yu | 6736c89 | 2017-11-09 10:50:09 -0800 | [diff] [blame] | 411 | auto& receivers = mReceivers[tagId]; |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 412 | for (auto it = receivers.begin(); it != receivers.end(); it++) { |
Chenjie Yu | 6736c89 | 2017-11-09 10:50:09 -0800 | [diff] [blame] | 413 | if (it->receiver == receiver) { |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 414 | VLOG("Receiver already registered of %d", (int)receivers.size()); |
| 415 | return; |
| 416 | } |
| 417 | } |
| 418 | ReceiverInfo receiverInfo; |
| 419 | receiverInfo.receiver = receiver; |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 420 | |
Chenjie Yu | 85ed838 | 2017-12-14 16:48:54 -0800 | [diff] [blame] | 421 | // Round it to the nearest minutes. This is the limit of alarm manager. |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 422 | // In practice, we should always have larger buckets. |
| 423 | int64_t roundedIntervalNs = intervalNs / NS_PER_SEC / 60 * NS_PER_SEC * 60; |
Chenjie Yu | 83baaa1 | 2018-03-19 10:41:35 -0700 | [diff] [blame] | 424 | // Scheduled pulling should be at least 1 min apart. |
| 425 | // This can be lower in cts tests, in which case we round it to 1 min. |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 426 | if (roundedIntervalNs < 60 * (int64_t)NS_PER_SEC) { |
| 427 | roundedIntervalNs = 60 * (int64_t)NS_PER_SEC; |
Chenjie Yu | 83baaa1 | 2018-03-19 10:41:35 -0700 | [diff] [blame] | 428 | } |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 429 | |
| 430 | receiverInfo.intervalNs = roundedIntervalNs; |
| 431 | receiverInfo.nextPullTimeNs = nextPullTimeNs; |
| 432 | receivers.push_back(receiverInfo); |
| 433 | |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 434 | // There is only one alarm for all pulled events. So only set it to the smallest denom. |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 435 | if (nextPullTimeNs < mNextPullTimeNs) { |
| 436 | VLOG("Updating next pull time %lld", (long long)mNextPullTimeNs); |
| 437 | mNextPullTimeNs = nextPullTimeNs; |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 438 | updateAlarmLocked(); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 439 | } |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 440 | VLOG("Puller for tagId %d registered of %d", tagId, (int)receivers.size()); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 441 | } |
| 442 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 443 | void StatsPullerManager::UnRegisterReceiver(int tagId, wp<PullDataReceiver> receiver) { |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 444 | AutoMutex _l(mLock); |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 445 | if (mReceivers.find(tagId) == mReceivers.end()) { |
| 446 | VLOG("Unknown pull code or no receivers: %d", tagId); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 447 | return; |
| 448 | } |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 449 | auto& receivers = mReceivers.find(tagId)->second; |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 450 | for (auto it = receivers.begin(); it != receivers.end(); it++) { |
Chenjie Yu | 6736c89 | 2017-11-09 10:50:09 -0800 | [diff] [blame] | 451 | if (receiver == it->receiver) { |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 452 | receivers.erase(it); |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 453 | VLOG("Puller for tagId %d unregistered of %d", tagId, (int)receivers.size()); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 454 | return; |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 459 | void StatsPullerManager::OnAlarmFired(int64_t elapsedTimeNs) { |
Chenjie Yu | aa5b201 | 2018-03-21 13:53:15 -0700 | [diff] [blame] | 460 | AutoMutex _l(mLock); |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 461 | int64_t wallClockNs = getWallClockNs(); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 462 | |
Chenjie Yu | 3b3adcd | 2018-04-18 16:25:36 -0700 | [diff] [blame] | 463 | int64_t minNextPullTimeNs = NO_ALARM_UPDATE; |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 464 | |
| 465 | vector<pair<int, vector<ReceiverInfo*>>> needToPull = |
| 466 | vector<pair<int, vector<ReceiverInfo*>>>(); |
| 467 | for (auto& pair : mReceivers) { |
| 468 | vector<ReceiverInfo*> receivers = vector<ReceiverInfo*>(); |
Yao Chen | 93fe3a3 | 2017-11-02 13:52:59 -0700 | [diff] [blame] | 469 | if (pair.second.size() != 0) { |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 470 | for (ReceiverInfo& receiverInfo : pair.second) { |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 471 | if (receiverInfo.nextPullTimeNs <= elapsedTimeNs) { |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 472 | receivers.push_back(&receiverInfo); |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 473 | } else { |
| 474 | if (receiverInfo.nextPullTimeNs < minNextPullTimeNs) { |
| 475 | minNextPullTimeNs = receiverInfo.nextPullTimeNs; |
| 476 | } |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 477 | } |
| 478 | } |
| 479 | if (receivers.size() > 0) { |
| 480 | needToPull.push_back(make_pair(pair.first, receivers)); |
| 481 | } |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | for (const auto& pullInfo : needToPull) { |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 486 | vector<shared_ptr<LogEvent>> data; |
Tej Singh | fa1c137 | 2019-12-05 20:36:54 -0800 | [diff] [blame] | 487 | bool pullSuccess = PullLocked(pullInfo.first, &data); |
Olivier Gaillard | c5f11c4 | 2019-02-05 12:44:58 +0000 | [diff] [blame] | 488 | if (pullSuccess) { |
| 489 | StatsdStats::getInstance().notePullDelay( |
| 490 | pullInfo.first, getElapsedRealtimeNs() - elapsedTimeNs); |
| 491 | } else { |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 492 | VLOG("pull failed at %lld, will try again later", (long long)elapsedTimeNs); |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 493 | } |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 494 | |
| 495 | // Convention is to mark pull atom timestamp at request time. |
| 496 | // If we pull at t0, puller starts at t1, finishes at t2, and send back |
| 497 | // at t3, we mark t0 as its timestamp, which should correspond to its |
| 498 | // triggering event, such as condition change at t0. |
| 499 | // Here the triggering event is alarm fired from AlarmManager. |
| 500 | // In ValueMetricProducer and GaugeMetricProducer we do same thing |
| 501 | // when pull on condition change, etc. |
| 502 | for (auto& event : data) { |
| 503 | event->setElapsedTimestampNs(elapsedTimeNs); |
| 504 | event->setLogdWallClockTimestampNs(wallClockNs); |
| 505 | } |
| 506 | |
| 507 | for (const auto& receiverInfo : pullInfo.second) { |
| 508 | sp<PullDataReceiver> receiverPtr = receiverInfo->receiver.promote(); |
| 509 | if (receiverPtr != nullptr) { |
Olivier Gaillard | 11203df | 2019-02-06 13:18:09 +0000 | [diff] [blame] | 510 | receiverPtr->onDataPulled(data, pullSuccess, elapsedTimeNs); |
Olivier Gaillard | c5f11c4 | 2019-02-05 12:44:58 +0000 | [diff] [blame] | 511 | // We may have just come out of a coma, compute next pull time. |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 512 | int numBucketsAhead = |
| 513 | (elapsedTimeNs - receiverInfo->nextPullTimeNs) / receiverInfo->intervalNs; |
| 514 | receiverInfo->nextPullTimeNs += (numBucketsAhead + 1) * receiverInfo->intervalNs; |
| 515 | if (receiverInfo->nextPullTimeNs < minNextPullTimeNs) { |
| 516 | minNextPullTimeNs = receiverInfo->nextPullTimeNs; |
Chenjie Yu | 6736c89 | 2017-11-09 10:50:09 -0800 | [diff] [blame] | 517 | } |
Chenjie Yu | 0bd73db | 2018-12-16 07:37:04 -0800 | [diff] [blame] | 518 | } else { |
| 519 | VLOG("receiver already gone."); |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 520 | } |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 521 | } |
| 522 | } |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 523 | |
Chenjie Yu | 3b3adcd | 2018-04-18 16:25:36 -0700 | [diff] [blame] | 524 | VLOG("mNextPullTimeNs: %lld updated to %lld", (long long)mNextPullTimeNs, |
| 525 | (long long)minNextPullTimeNs); |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 526 | mNextPullTimeNs = minNextPullTimeNs; |
| 527 | updateAlarmLocked(); |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 528 | } |
| 529 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 530 | int StatsPullerManager::ForceClearPullerCache() { |
Chenjie Yu | fa22d65 | 2018-02-05 14:37:48 -0800 | [diff] [blame] | 531 | int totalCleared = 0; |
Chenjie Yu | 80f9112 | 2018-01-31 20:24:50 -0800 | [diff] [blame] | 532 | for (const auto& pulledAtom : kAllPullAtomInfo) { |
| 533 | totalCleared += pulledAtom.second.puller->ForceClearCache(); |
Chenjie Yu | e72252b | 2018-02-01 13:19:35 -0800 | [diff] [blame] | 534 | } |
Chenjie Yu | fa22d65 | 2018-02-05 14:37:48 -0800 | [diff] [blame] | 535 | return totalCleared; |
| 536 | } |
| 537 | |
Chenjie Yu | e221920 | 2018-06-08 10:07:51 -0700 | [diff] [blame] | 538 | int StatsPullerManager::ClearPullerCacheIfNecessary(int64_t timestampNs) { |
Chenjie Yu | fa22d65 | 2018-02-05 14:37:48 -0800 | [diff] [blame] | 539 | int totalCleared = 0; |
Chenjie Yu | 80f9112 | 2018-01-31 20:24:50 -0800 | [diff] [blame] | 540 | for (const auto& pulledAtom : kAllPullAtomInfo) { |
Chenjie Yu | 1a0a941 | 2018-03-28 10:07:22 -0700 | [diff] [blame] | 541 | totalCleared += pulledAtom.second.puller->ClearCacheIfNecessary(timestampNs); |
Chenjie Yu | fa22d65 | 2018-02-05 14:37:48 -0800 | [diff] [blame] | 542 | } |
| 543 | return totalCleared; |
Chenjie Yu | e72252b | 2018-02-01 13:19:35 -0800 | [diff] [blame] | 544 | } |
| 545 | |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 546 | // Deprecated, remove after puller API is complete. |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 547 | void StatsPullerManager::RegisterPullerCallback(int32_t atomTag, |
| 548 | const sp<IStatsPullerCallback>& callback) { |
| 549 | AutoMutex _l(mLock); |
| 550 | // Platform pullers cannot be changed. |
Tej Singh | de473b51 | 2019-04-10 19:25:03 -0700 | [diff] [blame] | 551 | if (!isVendorPulledAtom(atomTag)) { |
| 552 | VLOG("RegisterPullerCallback: atom tag %d is not vendor pulled", atomTag); |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 553 | return; |
| 554 | } |
| 555 | VLOG("RegisterPullerCallback: adding puller for tag %d", atomTag); |
| 556 | StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/true); |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 557 | kAllPullAtomInfo[{.atomTag = atomTag}] = { |
| 558 | .puller = new StatsCallbackPullerDeprecated(atomTag, callback)}; |
| 559 | } |
| 560 | |
| 561 | void StatsPullerManager::RegisterPullAtomCallback(const int uid, const int32_t atomTag, |
| 562 | const int64_t coolDownNs, const int64_t timeoutNs, |
| 563 | const vector<int32_t>& additiveFields, |
| 564 | const sp<IPullAtomCallback>& callback) { |
| 565 | AutoMutex _l(mLock); |
| 566 | VLOG("RegisterPullerCallback: adding puller for tag %d", atomTag); |
| 567 | // TODO: linkToDeath with the callback so that we can remove it and delete the puller. |
| 568 | StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/true); |
Tej Singh | 8981763 | 2019-12-09 16:58:08 -0800 | [diff] [blame] | 569 | kAllPullAtomInfo[{.atomTag = atomTag}] = { |
| 570 | .additiveFields = additiveFields, |
| 571 | .coolDownNs = coolDownNs, |
| 572 | .puller = new StatsCallbackPuller(atomTag, callback, timeoutNs), |
| 573 | .pullTimeoutNs = timeoutNs, |
Nick Desaulniers | fceda70 | 2019-11-21 12:23:57 -0800 | [diff] [blame] | 574 | }; |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | void StatsPullerManager::UnregisterPullerCallback(int32_t atomTag) { |
| 578 | AutoMutex _l(mLock); |
| 579 | // Platform pullers cannot be changed. |
Tej Singh | de473b51 | 2019-04-10 19:25:03 -0700 | [diff] [blame] | 580 | if (!isVendorPulledAtom(atomTag)) { |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 581 | return; |
| 582 | } |
| 583 | StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/false); |
Tej Singh | 6a5c943 | 2019-10-11 11:07:06 -0700 | [diff] [blame] | 584 | kAllPullAtomInfo.erase({.atomTag = atomTag}); |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 585 | } |
| 586 | |
Tej Singh | fa1c137 | 2019-12-05 20:36:54 -0800 | [diff] [blame] | 587 | void StatsPullerManager::UnregisterPullAtomCallback(const int uid, const int32_t atomTag) { |
| 588 | AutoMutex _l(mLock); |
| 589 | StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/false); |
| 590 | kAllPullAtomInfo.erase({.atomTag = atomTag}); |
| 591 | } |
| 592 | |
Chenjie Yu | 1a317ba | 2017-10-05 16:05:32 -0700 | [diff] [blame] | 593 | } // namespace statsd |
| 594 | } // namespace os |
| 595 | } // namespace android |