Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 1 | // |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 2 | // Copyright (C) 2017 The Android Open Source Project |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 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 | |
| 17 | // ========================================================== |
| 18 | // Build the library for use on the host |
| 19 | // ========================================================== |
| 20 | cc_library_host_shared { |
| 21 | name: "libstats_proto_host", |
| 22 | srcs: [ |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 23 | "src/atoms.proto", |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 24 | "src/atom_field_options.proto", |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 25 | ], |
| 26 | |
| 27 | shared_libs: [ |
| 28 | "libplatformprotos", |
| 29 | ], |
| 30 | |
| 31 | proto: { |
| 32 | type: "full", |
| 33 | export_proto_headers: true, |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 34 | include_dirs: [ |
| 35 | "external/protobuf/src", |
| 36 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 37 | }, |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 38 | |
| 39 | export_shared_lib_headers: [ |
| 40 | "libplatformprotos", |
| 41 | ] |
| 42 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 45 | cc_defaults { |
| 46 | name: "statsd_defaults", |
| 47 | aidl: { |
| 48 | include_dirs: ["frameworks/base/core/java"], |
| 49 | }, |
| 50 | |
| 51 | srcs: [ |
| 52 | ":statsd_aidl", |
Chenjie Yu | c7939cb | 2019-02-04 17:25:45 -0800 | [diff] [blame] | 53 | "src/active_config_list.proto", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 54 | "src/statsd_config.proto", |
Max Dashouk | 11e0d40 | 2019-05-16 16:58:07 -0700 | [diff] [blame] | 55 | "src/uid_data.proto", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 56 | "src/FieldValue.cpp", |
| 57 | "src/hash.cpp", |
| 58 | "src/stats_log_util.cpp", |
| 59 | "src/anomaly/AlarmMonitor.cpp", |
| 60 | "src/anomaly/AlarmTracker.cpp", |
| 61 | "src/anomaly/AnomalyTracker.cpp", |
| 62 | "src/anomaly/DurationAnomalyTracker.cpp", |
| 63 | "src/anomaly/subscriber_util.cpp", |
| 64 | "src/condition/CombinationConditionTracker.cpp", |
| 65 | "src/condition/condition_util.cpp", |
| 66 | "src/condition/SimpleConditionTracker.cpp", |
| 67 | "src/condition/ConditionWizard.cpp", |
tsaichristine | c46fbf9 | 2019-09-04 15:47:57 -0700 | [diff] [blame^] | 68 | "src/condition/StateConditionTracker.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 69 | "src/config/ConfigKey.cpp", |
| 70 | "src/config/ConfigListener.cpp", |
| 71 | "src/config/ConfigManager.cpp", |
Yiwei Zhang | 7e63303 | 2019-03-01 17:25:27 -0800 | [diff] [blame] | 72 | "src/external/GpuStatsPuller.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 73 | "src/external/Perfetto.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 74 | "src/external/StatsPuller.cpp", |
Tej Singh | a0c89dd | 2019-01-25 16:39:18 -0800 | [diff] [blame] | 75 | "src/external/StatsCallbackPuller.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 76 | "src/external/StatsCompanionServicePuller.cpp", |
| 77 | "src/external/SubsystemSleepStatePuller.cpp", |
Bookatz | 92da283 | 2018-11-01 18:10:03 -0700 | [diff] [blame] | 78 | "src/external/PowerStatsPuller.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 79 | "src/external/ResourceHealthManagerPuller.cpp", |
Chenjie Yu | 97dbb20 | 2019-02-13 16:42:04 -0800 | [diff] [blame] | 80 | "src/external/TrainInfoPuller.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 81 | "src/external/StatsPullerManager.cpp", |
| 82 | "src/external/puller_util.cpp", |
| 83 | "src/logd/LogEvent.cpp", |
Yao Chen | 0f86186 | 2019-03-27 11:51:15 -0700 | [diff] [blame] | 84 | "src/logd/LogEventQueue.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 85 | "src/matchers/CombinationLogMatchingTracker.cpp", |
| 86 | "src/matchers/EventMatcherWizard.cpp", |
| 87 | "src/matchers/matcher_util.cpp", |
| 88 | "src/matchers/SimpleLogMatchingTracker.cpp", |
| 89 | "src/metrics/MetricProducer.cpp", |
| 90 | "src/metrics/EventMetricProducer.cpp", |
| 91 | "src/metrics/CountMetricProducer.cpp", |
| 92 | "src/metrics/DurationMetricProducer.cpp", |
| 93 | "src/metrics/duration_helper/OringDurationTracker.cpp", |
| 94 | "src/metrics/duration_helper/MaxDurationTracker.cpp", |
| 95 | "src/metrics/ValueMetricProducer.cpp", |
| 96 | "src/metrics/GaugeMetricProducer.cpp", |
| 97 | "src/metrics/MetricsManager.cpp", |
| 98 | "src/metrics/metrics_manager_util.cpp", |
| 99 | "src/packages/UidMap.cpp", |
| 100 | "src/storage/StorageManager.cpp", |
| 101 | "src/StatsLogProcessor.cpp", |
| 102 | "src/StatsService.cpp", |
| 103 | "src/statscompanion_util.cpp", |
| 104 | "src/subscriber/IncidentdReporter.cpp", |
| 105 | "src/subscriber/SubscriberReporter.cpp", |
| 106 | "src/HashableDimensionKey.cpp", |
| 107 | "src/guardrail/StatsdStats.cpp", |
| 108 | "src/socket/StatsSocketListener.cpp", |
| 109 | "src/shell/ShellSubscriber.cpp", |
| 110 | "src/shell/shell_config.proto", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 111 | ], |
| 112 | |
| 113 | local_include_dirs: [ |
| 114 | "src", |
| 115 | ], |
| 116 | |
| 117 | static_libs: [ |
| 118 | "libhealthhalutils", |
Joe Onorato | 99598ee | 2019-02-11 15:55:13 +0000 | [diff] [blame] | 119 | "libplatformprotos", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 120 | ], |
| 121 | |
| 122 | shared_libs: [ |
| 123 | "libbase", |
| 124 | "libbinder", |
Yiwei Zhang | 7e63303 | 2019-03-01 17:25:27 -0800 | [diff] [blame] | 125 | "libgraphicsenv", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 126 | "libincident", |
| 127 | "liblog", |
| 128 | "libutils", |
| 129 | "libservices", |
| 130 | "libprotoutil", |
| 131 | "libstatslog", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 132 | "libhidlbase", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 133 | "android.frameworks.stats@1.0", |
| 134 | "android.hardware.health@2.0", |
| 135 | "android.hardware.power@1.0", |
| 136 | "android.hardware.power@1.1", |
Bookatz | 92da283 | 2018-11-01 18:10:03 -0700 | [diff] [blame] | 137 | "android.hardware.power.stats@1.0", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 138 | "libsysutils", |
| 139 | "libcutils", |
| 140 | ], |
| 141 | } |
| 142 | |
| 143 | // ========= |
| 144 | // statsd |
| 145 | // ========= |
| 146 | |
| 147 | cc_binary { |
| 148 | name: "statsd", |
| 149 | defaults: ["statsd_defaults"], |
| 150 | |
| 151 | srcs: ["src/main.cpp"], |
| 152 | |
| 153 | cflags: [ |
| 154 | "-Wall", |
| 155 | "-Wextra", |
| 156 | "-Werror", |
| 157 | "-Wno-unused-parameter", |
| 158 | // optimize for size (protobuf glop can get big) |
| 159 | "-Os", |
| 160 | // "-g", |
| 161 | // "-O0", |
| 162 | ], |
| 163 | |
| 164 | product_variables: { |
| 165 | eng: { |
| 166 | // Enable sanitizer ONLY on eng builds |
| 167 | //sanitize: { |
| 168 | // address: true, |
| 169 | //}, |
| 170 | }, |
| 171 | debuggable: { |
| 172 | // Add a flag to enable stats log printing from statsd on debug builds. |
| 173 | cflags: ["-DVERY_VERBOSE_PRINTING"], |
| 174 | }, |
| 175 | }, |
| 176 | |
| 177 | proto: { |
| 178 | type: "lite", |
| 179 | }, |
| 180 | |
| 181 | shared_libs: ["libgtest_prod"], |
| 182 | |
Howard Ro | 1260bb4 | 2018-10-29 17:22:36 -0700 | [diff] [blame] | 183 | vintf_fragments: ["android.frameworks.stats@1.0-service.xml"], |
| 184 | |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 185 | init_rc: ["statsd.rc"], |
| 186 | } |
| 187 | |
| 188 | // ============== |
| 189 | // statsd_test |
| 190 | // ============== |
| 191 | |
| 192 | cc_test { |
| 193 | name: "statsd_test", |
| 194 | defaults: ["statsd_defaults"], |
| 195 | test_suites: ["device-tests"], |
| 196 | |
| 197 | cflags: [ |
| 198 | "-Wall", |
| 199 | "-Werror", |
| 200 | "-Wno-missing-field-initializers", |
| 201 | "-Wno-unused-variable", |
| 202 | "-Wno-unused-function", |
| 203 | "-Wno-unused-parameter", |
| 204 | ], |
| 205 | |
| 206 | srcs: [ |
| 207 | "src/atom_field_options.proto", |
| 208 | "src/atoms.proto", |
| 209 | "src/stats_log.proto", |
| 210 | "src/shell/shell_data.proto", |
| 211 | "tests/AlarmMonitor_test.cpp", |
| 212 | "tests/anomaly/AlarmTracker_test.cpp", |
| 213 | "tests/anomaly/AnomalyTracker_test.cpp", |
| 214 | "tests/ConfigManager_test.cpp", |
| 215 | "tests/external/puller_util_test.cpp", |
Yiwei Zhang | d476542 | 2019-03-11 15:05:12 -0700 | [diff] [blame] | 216 | "tests/external/GpuStatsPuller_test.cpp", |
Yao Chen | a8e78b9 | 2019-03-04 17:23:38 -0800 | [diff] [blame] | 217 | "tests/external/IncidentReportArgs_test.cpp", |
Chenjie Yu | c7939cb | 2019-02-04 17:25:45 -0800 | [diff] [blame] | 218 | "tests/external/StatsPuller_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 219 | "tests/indexed_priority_queue_test.cpp", |
| 220 | "tests/LogEntryMatcher_test.cpp", |
| 221 | "tests/LogEvent_test.cpp", |
Yao Chen | 0f86186 | 2019-03-27 11:51:15 -0700 | [diff] [blame] | 222 | "tests/log_event/LogEventQueue_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 223 | "tests/MetricsManager_test.cpp", |
| 224 | "tests/StatsLogProcessor_test.cpp", |
| 225 | "tests/StatsService_test.cpp", |
| 226 | "tests/UidMap_test.cpp", |
| 227 | "tests/FieldValue_test.cpp", |
| 228 | "tests/condition/CombinationConditionTracker_test.cpp", |
| 229 | "tests/condition/SimpleConditionTracker_test.cpp", |
tsaichristine | c46fbf9 | 2019-09-04 15:47:57 -0700 | [diff] [blame^] | 230 | "tests/condition/StateConditionTracker_test.cpp", |
Yao Chen | e6cfb14 | 2019-04-08 12:00:01 -0700 | [diff] [blame] | 231 | "tests/condition/ConditionTimer_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 232 | "tests/metrics/OringDurationTracker_test.cpp", |
| 233 | "tests/metrics/MaxDurationTracker_test.cpp", |
| 234 | "tests/metrics/CountMetricProducer_test.cpp", |
| 235 | "tests/metrics/DurationMetricProducer_test.cpp", |
| 236 | "tests/metrics/EventMetricProducer_test.cpp", |
| 237 | "tests/metrics/ValueMetricProducer_test.cpp", |
| 238 | "tests/metrics/GaugeMetricProducer_test.cpp", |
| 239 | "tests/guardrail/StatsdStats_test.cpp", |
| 240 | "tests/metrics/metrics_test_helper.cpp", |
| 241 | "tests/statsd_test_util.cpp", |
Chenjie Yu | 6b1667c | 2019-01-18 10:09:33 -0800 | [diff] [blame] | 242 | "tests/storage/StorageManager_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 243 | "tests/e2e/WakelockDuration_e2e_test.cpp", |
| 244 | "tests/e2e/MetricActivation_e2e_test.cpp", |
| 245 | "tests/e2e/MetricConditionLink_e2e_test.cpp", |
| 246 | "tests/e2e/Alarm_e2e_test.cpp", |
| 247 | "tests/e2e/Attribution_e2e_test.cpp", |
| 248 | "tests/e2e/GaugeMetric_e2e_push_test.cpp", |
| 249 | "tests/e2e/GaugeMetric_e2e_pull_test.cpp", |
| 250 | "tests/e2e/ValueMetric_pull_e2e_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 251 | "tests/e2e/Anomaly_count_e2e_test.cpp", |
| 252 | "tests/e2e/Anomaly_duration_sum_e2e_test.cpp", |
| 253 | "tests/e2e/ConfigTtl_e2e_test.cpp", |
| 254 | "tests/e2e/PartialBucket_e2e_test.cpp", |
Muhammad Qureshi | 18e4692 | 2019-05-24 16:38:49 -0700 | [diff] [blame] | 255 | "tests/e2e/DurationMetric_e2e_test.cpp", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 256 | "tests/shell/ShellSubscriber_test.cpp", |
| 257 | ], |
| 258 | |
| 259 | static_libs: [ |
| 260 | "libgmock", |
| 261 | "libplatformprotos", |
| 262 | ], |
| 263 | |
| 264 | proto: { |
Colin Cross | 47046b8 | 2018-11-04 17:24:15 -0800 | [diff] [blame] | 265 | type: "full", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 266 | include_dirs: ["external/protobuf/src"], |
| 267 | }, |
| 268 | |
Colin Cross | 47046b8 | 2018-11-04 17:24:15 -0800 | [diff] [blame] | 269 | shared_libs: ["libprotobuf-cpp-full"], |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 270 | |
| 271 | } |
| 272 | |
| 273 | //############################# |
| 274 | // statsd micro benchmark |
| 275 | //############################# |
| 276 | |
| 277 | cc_benchmark { |
| 278 | name: "statsd_benchmark", |
| 279 | defaults: ["statsd_defaults"], |
| 280 | |
| 281 | srcs: [ |
| 282 | "src/atom_field_options.proto", |
| 283 | "src/atoms.proto", |
| 284 | "src/stats_log.proto", |
| 285 | "benchmark/main.cpp", |
| 286 | "benchmark/hello_world_benchmark.cpp", |
| 287 | "benchmark/log_event_benchmark.cpp", |
| 288 | "benchmark/stats_write_benchmark.cpp", |
| 289 | "benchmark/filter_value_benchmark.cpp", |
| 290 | "benchmark/get_dimensions_for_condition_benchmark.cpp", |
| 291 | "benchmark/metric_util.cpp", |
| 292 | "benchmark/duration_metric_benchmark.cpp", |
| 293 | ], |
| 294 | |
| 295 | proto: { |
Colin Cross | 47046b8 | 2018-11-04 17:24:15 -0800 | [diff] [blame] | 296 | type: "full", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 297 | include_dirs: ["external/protobuf/src"], |
| 298 | }, |
| 299 | |
| 300 | cflags: [ |
| 301 | "-Wall", |
| 302 | "-Werror", |
| 303 | "-Wno-unused-parameter", |
| 304 | "-Wno-unused-variable", |
| 305 | "-Wno-unused-function", |
| 306 | |
| 307 | // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374 |
| 308 | "-Wno-varargs" |
| 309 | ], |
| 310 | |
| 311 | static_libs: [ |
| 312 | "libplatformprotos", |
| 313 | ], |
| 314 | |
| 315 | shared_libs: [ |
| 316 | "libgtest_prod", |
| 317 | "libstatslog", |
Colin Cross | 47046b8 | 2018-11-04 17:24:15 -0800 | [diff] [blame] | 318 | "libprotobuf-cpp-full", |
Colin Cross | bc2dc31 | 2018-10-26 22:34:06 -0700 | [diff] [blame] | 319 | ], |
| 320 | } |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 321 | |
gopinath | a9864fd | 2018-08-22 16:45:57 -0700 | [diff] [blame] | 322 | // ==== java proto device library (for test only) ============================== |
| 323 | java_library { |
| 324 | name: "statsdprotolite", |
Paul Duffin | 8fcace4 | 2019-06-12 13:47:18 +0100 | [diff] [blame] | 325 | sdk_version: "core_platform", |
gopinath | a9864fd | 2018-08-22 16:45:57 -0700 | [diff] [blame] | 326 | proto: { |
| 327 | type: "lite", |
| 328 | include_dirs: ["external/protobuf/src"], |
| 329 | }, |
| 330 | |
| 331 | srcs: [ |
| 332 | "src/stats_log.proto", |
| 333 | "src/statsd_config.proto", |
| 334 | "src/atoms.proto", |
Yao Chen | 35cb8d6 | 2019-01-03 16:49:14 -0800 | [diff] [blame] | 335 | "src/shell/shell_config.proto", |
| 336 | "src/shell/shell_data.proto", |
gopinath | a9864fd | 2018-08-22 16:45:57 -0700 | [diff] [blame] | 337 | ], |
| 338 | |
| 339 | static_libs: [ |
| 340 | "platformprotoslite", |
| 341 | ], |
| 342 | // Protos have lots of MissingOverride and similar. |
| 343 | errorprone: { |
| 344 | javacflags: ["-XepDisableAllChecks"], |
| 345 | }, |
| 346 | } |
Harry Zhang | fe16c8f | 2019-02-26 10:47:04 -0800 | [diff] [blame] | 347 | |
| 348 | // Filegroup for statsd config proto definition. |
| 349 | filegroup { |
| 350 | name: "statsd-config-proto-def", |
| 351 | srcs: ["src/statsd_config.proto"], |
| 352 | } |