blob: 05ff49045b179af82fbb20e317bd67b1617a1937 [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",
Chenjie Yuc7939cb2019-02-04 17:25:45 -080053 "src/active_config_list.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -070054 "src/anomaly/AlarmMonitor.cpp",
55 "src/anomaly/AlarmTracker.cpp",
56 "src/anomaly/AnomalyTracker.cpp",
57 "src/anomaly/DurationAnomalyTracker.cpp",
58 "src/anomaly/subscriber_util.cpp",
59 "src/condition/CombinationConditionTracker.cpp",
60 "src/condition/condition_util.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070061 "src/condition/ConditionWizard.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070062 "src/condition/SimpleConditionTracker.cpp",
tsaichristinec46fbf92019-09-04 15:47:57 -070063 "src/condition/StateConditionTracker.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070064 "src/config/ConfigKey.cpp",
65 "src/config/ConfigListener.cpp",
66 "src/config/ConfigManager.cpp",
Yiwei Zhang7e633032019-03-01 17:25:27 -080067 "src/external/GpuStatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070068 "src/external/Perfetto.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070069 "src/external/PowerStatsPuller.cpp",
70 "src/external/puller_util.cpp",
71 "src/external/ResourceHealthManagerPuller.cpp",
Tej Singha0c89dd2019-01-25 16:39:18 -080072 "src/external/StatsCallbackPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070073 "src/external/StatsCompanionServicePuller.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070074 "src/external/StatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070075 "src/external/StatsPullerManager.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070076 "src/external/SubsystemSleepStatePuller.cpp",
77 "src/external/TrainInfoPuller.cpp",
78 "src/FieldValue.cpp",
79 "src/guardrail/StatsdStats.cpp",
80 "src/hash.cpp",
81 "src/HashableDimensionKey.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070082 "src/logd/LogEvent.cpp",
Yao Chen0f861862019-03-27 11:51:15 -070083 "src/logd/LogEventQueue.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070084 "src/matchers/CombinationLogMatchingTracker.cpp",
85 "src/matchers/EventMatcherWizard.cpp",
86 "src/matchers/matcher_util.cpp",
87 "src/matchers/SimpleLogMatchingTracker.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070088 "src/metrics/CountMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070089 "src/metrics/duration_helper/MaxDurationTracker.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070090 "src/metrics/duration_helper/OringDurationTracker.cpp",
91 "src/metrics/DurationMetricProducer.cpp",
92 "src/metrics/EventMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070093 "src/metrics/GaugeMetricProducer.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070094 "src/metrics/MetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070095 "src/metrics/metrics_manager_util.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070096 "src/metrics/MetricsManager.cpp",
97 "src/metrics/ValueMetricProducer.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070098 "src/packages/UidMap.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -070099 "src/shell/shell_config.proto",
100 "src/shell/ShellSubscriber.cpp",
101 "src/socket/StatsSocketListener.cpp",
tsaichristine10978642019-09-10 14:12:49 -0700102 "src/state/StateManager.cpp",
103 "src/state/StateTracker.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700104 "src/stats_log_util.cpp",
105 "src/statscompanion_util.cpp",
106 "src/statsd_config.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700107 "src/StatsLogProcessor.cpp",
108 "src/StatsService.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700109 "src/storage/StorageManager.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700110 "src/subscriber/IncidentdReporter.cpp",
111 "src/subscriber/SubscriberReporter.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700112 "src/uid_data.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700113 ],
114
115 local_include_dirs: [
116 "src",
117 ],
118
119 static_libs: [
120 "libhealthhalutils",
Joe Onorato99598ee2019-02-11 15:55:13 +0000121 "libplatformprotos",
Colin Crossbc2dc312018-10-26 22:34:06 -0700122 ],
123
124 shared_libs: [
Colin Crossbc2dc312018-10-26 22:34:06 -0700125 "android.frameworks.stats@1.0",
126 "android.hardware.health@2.0",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700127 "android.hardware.power.stats@1.0",
Colin Crossbc2dc312018-10-26 22:34:06 -0700128 "android.hardware.power@1.0",
129 "android.hardware.power@1.1",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700130 "libbase",
131 "libbinder",
Colin Crossbc2dc312018-10-26 22:34:06 -0700132 "libcutils",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700133 "libgraphicsenv",
134 "libhidlbase",
135 "libincident",
136 "liblog",
137 "libprotoutil",
138 "libservices",
139 "libstatslog",
140 "libsysutils",
141 "libutils",
Colin Crossbc2dc312018-10-26 22:34:06 -0700142 ],
143}
144
145// =========
146// statsd
147// =========
148
149cc_binary {
150 name: "statsd",
151 defaults: ["statsd_defaults"],
152
153 srcs: ["src/main.cpp"],
154
155 cflags: [
156 "-Wall",
157 "-Wextra",
158 "-Werror",
159 "-Wno-unused-parameter",
160 // optimize for size (protobuf glop can get big)
161 "-Os",
162 // "-g",
163 // "-O0",
164 ],
165
166 product_variables: {
167 eng: {
168 // Enable sanitizer ONLY on eng builds
169 //sanitize: {
170 // address: true,
171 //},
172 },
173 debuggable: {
174 // Add a flag to enable stats log printing from statsd on debug builds.
175 cflags: ["-DVERY_VERBOSE_PRINTING"],
176 },
177 },
178
179 proto: {
180 type: "lite",
181 },
182
183 shared_libs: ["libgtest_prod"],
184
Howard Ro1260bb42018-10-29 17:22:36 -0700185 vintf_fragments: ["android.frameworks.stats@1.0-service.xml"],
186
Colin Crossbc2dc312018-10-26 22:34:06 -0700187 init_rc: ["statsd.rc"],
188}
189
190// ==============
191// statsd_test
192// ==============
193
194cc_test {
195 name: "statsd_test",
196 defaults: ["statsd_defaults"],
197 test_suites: ["device-tests"],
198
199 cflags: [
200 "-Wall",
201 "-Werror",
202 "-Wno-missing-field-initializers",
203 "-Wno-unused-variable",
204 "-Wno-unused-function",
205 "-Wno-unused-parameter",
206 ],
207
208 srcs: [
Colin Cross3f51ab52018-10-26 23:28:02 -0700209 // atom_field_options.proto needs field_options.proto, but that is
210 // not included in libprotobuf-cpp-lite, so compile it here.
211 ":libprotobuf-internal-protos",
212
Colin Crossbc2dc312018-10-26 22:34:06 -0700213 "src/atom_field_options.proto",
214 "src/atoms.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700215 "src/shell/shell_data.proto",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700216 "src/stats_log.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700217 "tests/AlarmMonitor_test.cpp",
218 "tests/anomaly/AlarmTracker_test.cpp",
219 "tests/anomaly/AnomalyTracker_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700220 "tests/condition/CombinationConditionTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700221 "tests/condition/ConditionTimer_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700222 "tests/condition/SimpleConditionTracker_test.cpp",
tsaichristinec46fbf92019-09-04 15:47:57 -0700223 "tests/condition/StateConditionTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700224 "tests/ConfigManager_test.cpp",
225 "tests/e2e/Alarm_e2e_test.cpp",
226 "tests/e2e/Anomaly_count_e2e_test.cpp",
227 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
228 "tests/e2e/Attribution_e2e_test.cpp",
229 "tests/e2e/ConfigTtl_e2e_test.cpp",
230 "tests/e2e/DurationMetric_e2e_test.cpp",
231 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
232 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
233 "tests/e2e/MetricActivation_e2e_test.cpp",
234 "tests/e2e/MetricConditionLink_e2e_test.cpp",
235 "tests/e2e/PartialBucket_e2e_test.cpp",
236 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
237 "tests/e2e/WakelockDuration_e2e_test.cpp",
238 "tests/external/GpuStatsPuller_test.cpp",
239 "tests/external/IncidentReportArgs_test.cpp",
240 "tests/external/puller_util_test.cpp",
241 "tests/external/StatsPuller_test.cpp",
242 "tests/FieldValue_test.cpp",
243 "tests/guardrail/StatsdStats_test.cpp",
244 "tests/indexed_priority_queue_test.cpp",
245 "tests/log_event/LogEventQueue_test.cpp",
246 "tests/LogEntryMatcher_test.cpp",
247 "tests/LogEvent_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700248 "tests/metrics/CountMetricProducer_test.cpp",
249 "tests/metrics/DurationMetricProducer_test.cpp",
250 "tests/metrics/EventMetricProducer_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700251 "tests/metrics/GaugeMetricProducer_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700252 "tests/metrics/MaxDurationTracker_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700253 "tests/metrics/metrics_test_helper.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700254 "tests/metrics/OringDurationTracker_test.cpp",
255 "tests/metrics/ValueMetricProducer_test.cpp",
256 "tests/MetricsManager_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700257 "tests/shell/ShellSubscriber_test.cpp",
tsaichristine10978642019-09-10 14:12:49 -0700258 "tests/state/StateTracker_test.cpp",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700259 "tests/statsd_test_util.cpp",
260 "tests/StatsLogProcessor_test.cpp",
261 "tests/StatsService_test.cpp",
262 "tests/storage/StorageManager_test.cpp",
263 "tests/UidMap_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700264 ],
265
266 static_libs: [
267 "libgmock",
268 "libplatformprotos",
269 ],
270
271 proto: {
Colin Cross3f51ab52018-10-26 23:28:02 -0700272 type: "lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700273 include_dirs: ["external/protobuf/src"],
274 },
275
Colin Cross3f51ab52018-10-26 23:28:02 -0700276 shared_libs: ["libprotobuf-cpp-lite"],
Colin Crossbc2dc312018-10-26 22:34:06 -0700277
278}
279
280//#############################
281// statsd micro benchmark
282//#############################
283
284cc_benchmark {
285 name: "statsd_benchmark",
286 defaults: ["statsd_defaults"],
287
288 srcs: [
Colin Cross3f51ab52018-10-26 23:28:02 -0700289 // atom_field_options.proto needs field_options.proto, but that is
290 // not included in libprotobuf-cpp-lite, so compile it here.
291 ":libprotobuf-internal-protos",
292
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700293 "benchmark/duration_metric_benchmark.cpp",
294 "benchmark/filter_value_benchmark.cpp",
295 "benchmark/get_dimensions_for_condition_benchmark.cpp",
296 "benchmark/hello_world_benchmark.cpp",
297 "benchmark/log_event_benchmark.cpp",
298 "benchmark/main.cpp",
299 "benchmark/metric_util.cpp",
300 "benchmark/stats_write_benchmark.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700301 "src/atom_field_options.proto",
302 "src/atoms.proto",
303 "src/stats_log.proto",
Colin Crossbc2dc312018-10-26 22:34:06 -0700304 ],
305
306 proto: {
Colin Cross3f51ab52018-10-26 23:28:02 -0700307 type: "lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700308 include_dirs: ["external/protobuf/src"],
309 },
310
311 cflags: [
312 "-Wall",
313 "-Werror",
314 "-Wno-unused-parameter",
315 "-Wno-unused-variable",
316 "-Wno-unused-function",
317
318 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
319 "-Wno-varargs"
320 ],
321
322 static_libs: [
323 "libplatformprotos",
324 ],
325
326 shared_libs: [
327 "libgtest_prod",
328 "libstatslog",
Colin Cross3f51ab52018-10-26 23:28:02 -0700329 "libprotobuf-cpp-lite",
Colin Crossbc2dc312018-10-26 22:34:06 -0700330 ],
331}
Joe Onorato62c220b2017-11-18 20:32:56 -0800332
gopinatha9864fd2018-08-22 16:45:57 -0700333// ==== java proto device library (for test only) ==============================
334java_library {
335 name: "statsdprotolite",
Paul Duffin8fcace42019-06-12 13:47:18 +0100336 sdk_version: "core_platform",
gopinatha9864fd2018-08-22 16:45:57 -0700337 proto: {
338 type: "lite",
339 include_dirs: ["external/protobuf/src"],
340 },
341
342 srcs: [
gopinatha9864fd2018-08-22 16:45:57 -0700343 "src/atoms.proto",
Yao Chen35cb8d62019-01-03 16:49:14 -0800344 "src/shell/shell_config.proto",
345 "src/shell/shell_data.proto",
Ruchir Rastogi23d60f92019-09-16 15:23:56 -0700346 "src/stats_log.proto",
347 "src/statsd_config.proto",
gopinatha9864fd2018-08-22 16:45:57 -0700348 ],
349
350 static_libs: [
351 "platformprotoslite",
352 ],
353 // Protos have lots of MissingOverride and similar.
354 errorprone: {
355 javacflags: ["-XepDisableAllChecks"],
356 },
357}
Harry Zhangfe16c8f2019-02-26 10:47:04 -0800358
359// Filegroup for statsd config proto definition.
360filegroup {
361 name: "statsd-config-proto-def",
362 srcs: ["src/statsd_config.proto"],
363}