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