blob: cf286e66263095f3fde6143c50bd72c68823ee54 [file] [log] [blame]
Yao Chend54f9dd2017-10-17 17:37:48 +00001//
Colin Crossbc2dc312018-10-26 22:34:06 -07002// Copyright (C) 2017 The Android Open Source Project
Yao Chend54f9dd2017-10-17 17:37:48 +00003//
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// ==========================================================
20cc_library_host_shared {
21 name: "libstats_proto_host",
22 srcs: [
Stefan Lafonae2df012017-11-14 09:17:21 -080023 "src/atoms.proto",
Yao Chen9c1debe2018-02-19 14:39:19 -080024 "src/atom_field_options.proto",
Yao Chend54f9dd2017-10-17 17:37:48 +000025 ],
26
27 shared_libs: [
28 "libplatformprotos",
29 ],
30
31 proto: {
32 type: "full",
33 export_proto_headers: true,
Yao Chen9c1debe2018-02-19 14:39:19 -080034 include_dirs: [
35 "external/protobuf/src",
36 ],
Yao Chend54f9dd2017-10-17 17:37:48 +000037 },
Joe Onorato62c220b2017-11-18 20:32:56 -080038
39 export_shared_lib_headers: [
40 "libplatformprotos",
41 ]
42
Yao Chend54f9dd2017-10-17 17:37:48 +000043}
44
Colin Crossbc2dc312018-10-26 22:34:06 -070045cc_defaults {
46 name: "statsd_defaults",
47 aidl: {
48 include_dirs: ["frameworks/base/core/java"],
49 },
50
51 srcs: [
52 ":statsd_aidl",
Mark Tabry9dc13572019-11-06 13:42:30 -080053 ":ICarStatsService.aidl",
Chenjie Yuc7939cb2019-02-04 17:25:45 -080054 "src/active_config_list.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -070055 "src/anomaly/AlarmMonitor.cpp",
56 "src/anomaly/AlarmTracker.cpp",
57 "src/anomaly/AnomalyTracker.cpp",
58 "src/anomaly/DurationAnomalyTracker.cpp",
59 "src/anomaly/subscriber_util.cpp",
60 "src/condition/CombinationConditionTracker.cpp",
61 "src/condition/condition_util.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070062 "src/condition/ConditionWizard.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070063 "src/condition/SimpleConditionTracker.cpp",
tsaichristinec46fbf92019-09-04 15:47:57 -070064 "src/condition/StateConditionTracker.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070065 "src/config/ConfigKey.cpp",
66 "src/config/ConfigListener.cpp",
67 "src/config/ConfigManager.cpp",
Mark Tabry9dc13572019-11-06 13:42:30 -080068 "src/external/CarStatsPuller.cpp",
Yiwei Zhang7e633032019-03-01 17:25:27 -080069 "src/external/GpuStatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070070 "src/external/Perfetto.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070071 "src/external/PowerStatsPuller.cpp",
72 "src/external/puller_util.cpp",
73 "src/external/ResourceHealthManagerPuller.cpp",
Tej Singha0c89dd2019-01-25 16:39:18 -080074 "src/external/StatsCallbackPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070075 "src/external/StatsCompanionServicePuller.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070076 "src/external/StatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070077 "src/external/StatsPullerManager.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070078 "src/external/SubsystemSleepStatePuller.cpp",
Alec Mouri1dc5f1e2019-09-18 21:13:01 -070079 "src/external/SurfaceflingerStatsPuller.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070080 "src/external/TrainInfoPuller.cpp",
81 "src/FieldValue.cpp",
82 "src/guardrail/StatsdStats.cpp",
83 "src/hash.cpp",
84 "src/HashableDimensionKey.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070085 "src/logd/LogEvent.cpp",
Yao Chen0f861862019-03-27 11:51:15 -070086 "src/logd/LogEventQueue.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070087 "src/matchers/CombinationLogMatchingTracker.cpp",
88 "src/matchers/EventMatcherWizard.cpp",
89 "src/matchers/matcher_util.cpp",
90 "src/matchers/SimpleLogMatchingTracker.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070091 "src/metrics/CountMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070092 "src/metrics/duration_helper/MaxDurationTracker.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070093 "src/metrics/duration_helper/OringDurationTracker.cpp",
94 "src/metrics/DurationMetricProducer.cpp",
95 "src/metrics/EventMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070096 "src/metrics/GaugeMetricProducer.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070097 "src/metrics/MetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070098 "src/metrics/metrics_manager_util.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070099 "src/metrics/MetricsManager.cpp",
100 "src/metrics/ValueMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700101 "src/packages/UidMap.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700102 "src/shell/shell_config.proto",
103 "src/shell/ShellSubscriber.cpp",
104 "src/socket/StatsSocketListener.cpp",
tsaichristine10978642019-09-10 14:12:49 -0700105 "src/state/StateManager.cpp",
106 "src/state/StateTracker.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700107 "src/stats_log_util.cpp",
108 "src/statscompanion_util.cpp",
109 "src/statsd_config.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700110 "src/StatsLogProcessor.cpp",
111 "src/StatsService.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700112 "src/storage/StorageManager.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700113 "src/subscriber/IncidentdReporter.cpp",
114 "src/subscriber/SubscriberReporter.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700115 "src/uid_data.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700116 ],
117
118 local_include_dirs: [
119 "src",
120 ],
121
122 static_libs: [
123 "libhealthhalutils",
Joe Onorato99598ee2019-02-11 15:55:13 +0000124 "libplatformprotos",
Colin Crossbc2dc312018-10-26 22:34:06 -0700125 ],
126
127 shared_libs: [
Colin Crossbc2dc312018-10-26 22:34:06 -0700128 "android.frameworks.stats@1.0",
129 "android.hardware.health@2.0",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700130 "android.hardware.power.stats@1.0",
Colin Crossbc2dc312018-10-26 22:34:06 -0700131 "android.hardware.power@1.0",
132 "android.hardware.power@1.1",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700133 "libbase",
134 "libbinder",
Colin Crossbc2dc312018-10-26 22:34:06 -0700135 "libcutils",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700136 "libgraphicsenv",
137 "libhidlbase",
138 "libincident",
139 "liblog",
140 "libprotoutil",
141 "libservices",
142 "libstatslog",
Tej Singha02bfab2019-10-01 19:03:24 -0700143 "libstatssocket",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700144 "libsysutils",
Alec Mouri1dc5f1e2019-09-18 21:13:01 -0700145 "libtimestats_proto",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700146 "libutils",
Colin Crossbc2dc312018-10-26 22:34:06 -0700147 ],
148}
149
150// =========
151// statsd
152// =========
153
154cc_binary {
155 name: "statsd",
156 defaults: ["statsd_defaults"],
157
158 srcs: ["src/main.cpp"],
159
160 cflags: [
161 "-Wall",
162 "-Wextra",
163 "-Werror",
164 "-Wno-unused-parameter",
165 // optimize for size (protobuf glop can get big)
166 "-Os",
167 // "-g",
168 // "-O0",
169 ],
170
171 product_variables: {
172 eng: {
173 // Enable sanitizer ONLY on eng builds
174 //sanitize: {
175 // address: true,
176 //},
177 },
178 debuggable: {
179 // Add a flag to enable stats log printing from statsd on debug builds.
180 cflags: ["-DVERY_VERBOSE_PRINTING"],
181 },
182 },
183
184 proto: {
185 type: "lite",
186 },
187
188 shared_libs: ["libgtest_prod"],
189
Howard Ro1260bb42018-10-29 17:22:36 -0700190 vintf_fragments: ["android.frameworks.stats@1.0-service.xml"],
191
Colin Crossbc2dc312018-10-26 22:34:06 -0700192 init_rc: ["statsd.rc"],
193}
194
195// ==============
196// statsd_test
197// ==============
198
199cc_test {
200 name: "statsd_test",
201 defaults: ["statsd_defaults"],
202 test_suites: ["device-tests"],
203
204 cflags: [
205 "-Wall",
206 "-Werror",
207 "-Wno-missing-field-initializers",
208 "-Wno-unused-variable",
209 "-Wno-unused-function",
210 "-Wno-unused-parameter",
211 ],
212
213 srcs: [
Colin Cross3f51ab52018-10-26 23:28:02 -0700214 // atom_field_options.proto needs field_options.proto, but that is
215 // not included in libprotobuf-cpp-lite, so compile it here.
216 ":libprotobuf-internal-protos",
217
Colin Crossbc2dc312018-10-26 22:34:06 -0700218 "src/atom_field_options.proto",
219 "src/atoms.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700220 "src/shell/shell_data.proto",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700221 "src/stats_log.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700222 "tests/AlarmMonitor_test.cpp",
223 "tests/anomaly/AlarmTracker_test.cpp",
224 "tests/anomaly/AnomalyTracker_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700225 "tests/condition/CombinationConditionTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700226 "tests/condition/ConditionTimer_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700227 "tests/condition/SimpleConditionTracker_test.cpp",
tsaichristinec46fbf92019-09-04 15:47:57 -0700228 "tests/condition/StateConditionTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700229 "tests/ConfigManager_test.cpp",
230 "tests/e2e/Alarm_e2e_test.cpp",
231 "tests/e2e/Anomaly_count_e2e_test.cpp",
232 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
233 "tests/e2e/Attribution_e2e_test.cpp",
234 "tests/e2e/ConfigTtl_e2e_test.cpp",
tsaichristined21aacf2019-10-07 14:47:38 -0700235 "tests/e2e/CountMetric_e2e_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700236 "tests/e2e/DurationMetric_e2e_test.cpp",
237 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
238 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
239 "tests/e2e/MetricActivation_e2e_test.cpp",
240 "tests/e2e/MetricConditionLink_e2e_test.cpp",
241 "tests/e2e/PartialBucket_e2e_test.cpp",
242 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
243 "tests/e2e/WakelockDuration_e2e_test.cpp",
244 "tests/external/GpuStatsPuller_test.cpp",
245 "tests/external/IncidentReportArgs_test.cpp",
246 "tests/external/puller_util_test.cpp",
247 "tests/external/StatsPuller_test.cpp",
Alec Mouri1dc5f1e2019-09-18 21:13:01 -0700248 "tests/external/SurfaceflingerStatsPuller_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700249 "tests/FieldValue_test.cpp",
250 "tests/guardrail/StatsdStats_test.cpp",
251 "tests/indexed_priority_queue_test.cpp",
252 "tests/log_event/LogEventQueue_test.cpp",
253 "tests/LogEntryMatcher_test.cpp",
254 "tests/LogEvent_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700255 "tests/metrics/CountMetricProducer_test.cpp",
256 "tests/metrics/DurationMetricProducer_test.cpp",
257 "tests/metrics/EventMetricProducer_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700258 "tests/metrics/GaugeMetricProducer_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700259 "tests/metrics/MaxDurationTracker_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700260 "tests/metrics/metrics_test_helper.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700261 "tests/metrics/OringDurationTracker_test.cpp",
262 "tests/metrics/ValueMetricProducer_test.cpp",
263 "tests/MetricsManager_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700264 "tests/shell/ShellSubscriber_test.cpp",
tsaichristine10978642019-09-10 14:12:49 -0700265 "tests/state/StateTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700266 "tests/statsd_test_util.cpp",
267 "tests/StatsLogProcessor_test.cpp",
268 "tests/StatsService_test.cpp",
269 "tests/storage/StorageManager_test.cpp",
270 "tests/UidMap_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700271 ],
272
273 static_libs: [
274 "libgmock",
275 "libplatformprotos",
276 ],
277
278 proto: {
Colin Cross3f51ab52018-10-26 23:28:02 -0700279 type: "lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700280 include_dirs: ["external/protobuf/src"],
281 },
282
Colin Cross3f51ab52018-10-26 23:28:02 -0700283 shared_libs: ["libprotobuf-cpp-lite"],
Colin Crossbc2dc312018-10-26 22:34:06 -0700284
285}
286
287//#############################
288// statsd micro benchmark
289//#############################
290
291cc_benchmark {
292 name: "statsd_benchmark",
293 defaults: ["statsd_defaults"],
294
295 srcs: [
Colin Cross3f51ab52018-10-26 23:28:02 -0700296 // atom_field_options.proto needs field_options.proto, but that is
297 // not included in libprotobuf-cpp-lite, so compile it here.
298 ":libprotobuf-internal-protos",
299
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700300 "benchmark/duration_metric_benchmark.cpp",
301 "benchmark/filter_value_benchmark.cpp",
302 "benchmark/get_dimensions_for_condition_benchmark.cpp",
303 "benchmark/hello_world_benchmark.cpp",
304 "benchmark/log_event_benchmark.cpp",
305 "benchmark/main.cpp",
306 "benchmark/metric_util.cpp",
307 "benchmark/stats_write_benchmark.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700308 "src/atom_field_options.proto",
309 "src/atoms.proto",
310 "src/stats_log.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700311 ],
312
313 proto: {
Colin Cross3f51ab52018-10-26 23:28:02 -0700314 type: "lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700315 include_dirs: ["external/protobuf/src"],
316 },
317
318 cflags: [
319 "-Wall",
320 "-Werror",
321 "-Wno-unused-parameter",
322 "-Wno-unused-variable",
323 "-Wno-unused-function",
324
325 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
326 "-Wno-varargs"
327 ],
328
329 static_libs: [
330 "libplatformprotos",
331 ],
332
333 shared_libs: [
334 "libgtest_prod",
335 "libstatslog",
Colin Cross3f51ab52018-10-26 23:28:02 -0700336 "libprotobuf-cpp-lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700337 ],
338}
Joe Onorato62c220b2017-11-18 20:32:56 -0800339
gopinatha9864fd2018-08-22 16:45:57 -0700340// ==== java proto device library (for test only) ==============================
341java_library {
342 name: "statsdprotolite",
Paul Duffin8fcace42019-06-12 13:47:18 +0100343 sdk_version: "core_platform",
gopinatha9864fd2018-08-22 16:45:57 -0700344 proto: {
345 type: "lite",
346 include_dirs: ["external/protobuf/src"],
347 },
348
349 srcs: [
gopinatha9864fd2018-08-22 16:45:57 -0700350 "src/atoms.proto",
Yao Chen35cb8d62019-01-03 16:49:14 -0800351 "src/shell/shell_config.proto",
352 "src/shell/shell_data.proto",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700353 "src/stats_log.proto",
354 "src/statsd_config.proto",
gopinatha9864fd2018-08-22 16:45:57 -0700355 ],
356
357 static_libs: [
358 "platformprotoslite",
359 ],
360 // Protos have lots of MissingOverride and similar.
361 errorprone: {
362 javacflags: ["-XepDisableAllChecks"],
363 },
364}
Harry Zhangfe16c8f2019-02-26 10:47:04 -0800365
366// Filegroup for statsd config proto definition.
367filegroup {
368 name: "statsd-config-proto-def",
369 srcs: ["src/statsd_config.proto"],
370}