blob: ca104823b7cf9ad401ec33b068d489cb29830c42 [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",
53 "src/statsd_config.proto",
54 "src/FieldValue.cpp",
55 "src/hash.cpp",
56 "src/stats_log_util.cpp",
57 "src/anomaly/AlarmMonitor.cpp",
58 "src/anomaly/AlarmTracker.cpp",
59 "src/anomaly/AnomalyTracker.cpp",
60 "src/anomaly/DurationAnomalyTracker.cpp",
61 "src/anomaly/subscriber_util.cpp",
62 "src/condition/CombinationConditionTracker.cpp",
63 "src/condition/condition_util.cpp",
64 "src/condition/SimpleConditionTracker.cpp",
65 "src/condition/ConditionWizard.cpp",
66 "src/condition/StateTracker.cpp",
67 "src/config/ConfigKey.cpp",
68 "src/config/ConfigListener.cpp",
69 "src/config/ConfigManager.cpp",
70 "src/external/Perfetto.cpp",
71 "src/external/Perfprofd.cpp",
72 "src/external/StatsPuller.cpp",
73 "src/external/StatsCompanionServicePuller.cpp",
74 "src/external/SubsystemSleepStatePuller.cpp",
Bookatz92da2832018-11-01 18:10:03 -070075 "src/external/PowerStatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070076 "src/external/ResourceHealthManagerPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070077 "src/external/StatsPullerManager.cpp",
78 "src/external/puller_util.cpp",
79 "src/logd/LogEvent.cpp",
80 "src/logd/LogListener.cpp",
81 "src/matchers/CombinationLogMatchingTracker.cpp",
82 "src/matchers/EventMatcherWizard.cpp",
83 "src/matchers/matcher_util.cpp",
84 "src/matchers/SimpleLogMatchingTracker.cpp",
85 "src/metrics/MetricProducer.cpp",
86 "src/metrics/EventMetricProducer.cpp",
87 "src/metrics/CountMetricProducer.cpp",
88 "src/metrics/DurationMetricProducer.cpp",
89 "src/metrics/duration_helper/OringDurationTracker.cpp",
90 "src/metrics/duration_helper/MaxDurationTracker.cpp",
91 "src/metrics/ValueMetricProducer.cpp",
92 "src/metrics/GaugeMetricProducer.cpp",
93 "src/metrics/MetricsManager.cpp",
94 "src/metrics/metrics_manager_util.cpp",
95 "src/packages/UidMap.cpp",
96 "src/storage/StorageManager.cpp",
97 "src/StatsLogProcessor.cpp",
98 "src/StatsService.cpp",
99 "src/statscompanion_util.cpp",
100 "src/subscriber/IncidentdReporter.cpp",
101 "src/subscriber/SubscriberReporter.cpp",
102 "src/HashableDimensionKey.cpp",
103 "src/guardrail/StatsdStats.cpp",
104 "src/socket/StatsSocketListener.cpp",
105 "src/shell/ShellSubscriber.cpp",
106 "src/shell/shell_config.proto",
107
108 ":perfprofd_aidl",
109 ],
110
111 local_include_dirs: [
112 "src",
113 ],
114
115 static_libs: [
116 "libhealthhalutils",
117 ],
118
119 shared_libs: [
120 "libbase",
121 "libbinder",
122 "libincident",
123 "liblog",
124 "libutils",
125 "libservices",
126 "libprotoutil",
127 "libstatslog",
128 "libhardware",
129 "libhardware_legacy",
130 "libhidlbase",
131 "libhidltransport",
132 "libhwbinder",
133 "android.frameworks.stats@1.0",
134 "android.hardware.health@2.0",
135 "android.hardware.power@1.0",
136 "android.hardware.power@1.1",
Bookatz92da2832018-11-01 18:10:03 -0700137 "android.hardware.power.stats@1.0",
Colin Crossbc2dc312018-10-26 22:34:06 -0700138 "libpackagelistparser",
139 "libsysutils",
140 "libcutils",
141 ],
142}
143
144// =========
145// statsd
146// =========
147
148cc_binary {
149 name: "statsd",
150 defaults: ["statsd_defaults"],
151
152 srcs: ["src/main.cpp"],
153
154 cflags: [
155 "-Wall",
156 "-Wextra",
157 "-Werror",
158 "-Wno-unused-parameter",
159 // optimize for size (protobuf glop can get big)
160 "-Os",
161 // "-g",
162 // "-O0",
163 ],
164
165 product_variables: {
166 eng: {
167 // Enable sanitizer ONLY on eng builds
168 //sanitize: {
169 // address: true,
170 //},
171 },
172 debuggable: {
173 // Add a flag to enable stats log printing from statsd on debug builds.
174 cflags: ["-DVERY_VERBOSE_PRINTING"],
175 },
176 },
177
178 proto: {
179 type: "lite",
180 },
181
182 shared_libs: ["libgtest_prod"],
183
Howard Ro1260bb42018-10-29 17:22:36 -0700184 vintf_fragments: ["android.frameworks.stats@1.0-service.xml"],
185
Colin Crossbc2dc312018-10-26 22:34:06 -0700186 init_rc: ["statsd.rc"],
187}
188
189// ==============
190// statsd_test
191// ==============
192
193cc_test {
194 name: "statsd_test",
195 defaults: ["statsd_defaults"],
196 test_suites: ["device-tests"],
197
198 cflags: [
199 "-Wall",
200 "-Werror",
201 "-Wno-missing-field-initializers",
202 "-Wno-unused-variable",
203 "-Wno-unused-function",
204 "-Wno-unused-parameter",
205 ],
206
207 srcs: [
208 "src/atom_field_options.proto",
209 "src/atoms.proto",
210 "src/stats_log.proto",
211 "src/shell/shell_data.proto",
212 "tests/AlarmMonitor_test.cpp",
213 "tests/anomaly/AlarmTracker_test.cpp",
214 "tests/anomaly/AnomalyTracker_test.cpp",
215 "tests/ConfigManager_test.cpp",
216 "tests/external/puller_util_test.cpp",
Chenjie Yu0bd73db2018-12-16 07:37:04 -0800217 "tests/external/StatsPuller_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700218 "tests/indexed_priority_queue_test.cpp",
219 "tests/LogEntryMatcher_test.cpp",
220 "tests/LogEvent_test.cpp",
221 "tests/MetricsManager_test.cpp",
222 "tests/StatsLogProcessor_test.cpp",
223 "tests/StatsService_test.cpp",
224 "tests/UidMap_test.cpp",
225 "tests/FieldValue_test.cpp",
226 "tests/condition/CombinationConditionTracker_test.cpp",
227 "tests/condition/SimpleConditionTracker_test.cpp",
228 "tests/condition/StateTracker_test.cpp",
229 "tests/metrics/OringDurationTracker_test.cpp",
230 "tests/metrics/MaxDurationTracker_test.cpp",
231 "tests/metrics/CountMetricProducer_test.cpp",
232 "tests/metrics/DurationMetricProducer_test.cpp",
233 "tests/metrics/EventMetricProducer_test.cpp",
234 "tests/metrics/ValueMetricProducer_test.cpp",
235 "tests/metrics/GaugeMetricProducer_test.cpp",
236 "tests/guardrail/StatsdStats_test.cpp",
237 "tests/metrics/metrics_test_helper.cpp",
238 "tests/statsd_test_util.cpp",
239 "tests/e2e/WakelockDuration_e2e_test.cpp",
240 "tests/e2e/MetricActivation_e2e_test.cpp",
241 "tests/e2e/MetricConditionLink_e2e_test.cpp",
242 "tests/e2e/Alarm_e2e_test.cpp",
243 "tests/e2e/Attribution_e2e_test.cpp",
244 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
245 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
246 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
247 "tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp",
248 "tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp",
249 "tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp",
250 "tests/e2e/Anomaly_count_e2e_test.cpp",
251 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
252 "tests/e2e/ConfigTtl_e2e_test.cpp",
253 "tests/e2e/PartialBucket_e2e_test.cpp",
254 "tests/shell/ShellSubscriber_test.cpp",
255 ],
256
257 static_libs: [
258 "libgmock",
259 "libplatformprotos",
260 ],
261
262 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800263 type: "full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700264 include_dirs: ["external/protobuf/src"],
265 },
266
Colin Cross47046b82018-11-04 17:24:15 -0800267 shared_libs: ["libprotobuf-cpp-full"],
Colin Crossbc2dc312018-10-26 22:34:06 -0700268
269}
270
271//#############################
272// statsd micro benchmark
273//#############################
274
275cc_benchmark {
276 name: "statsd_benchmark",
277 defaults: ["statsd_defaults"],
278
279 srcs: [
280 "src/atom_field_options.proto",
281 "src/atoms.proto",
282 "src/stats_log.proto",
283 "benchmark/main.cpp",
284 "benchmark/hello_world_benchmark.cpp",
285 "benchmark/log_event_benchmark.cpp",
286 "benchmark/stats_write_benchmark.cpp",
287 "benchmark/filter_value_benchmark.cpp",
288 "benchmark/get_dimensions_for_condition_benchmark.cpp",
289 "benchmark/metric_util.cpp",
290 "benchmark/duration_metric_benchmark.cpp",
291 ],
292
293 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800294 type: "full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700295 include_dirs: ["external/protobuf/src"],
296 },
297
298 cflags: [
299 "-Wall",
300 "-Werror",
301 "-Wno-unused-parameter",
302 "-Wno-unused-variable",
303 "-Wno-unused-function",
304
305 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
306 "-Wno-varargs"
307 ],
308
309 static_libs: [
310 "libplatformprotos",
311 ],
312
313 shared_libs: [
314 "libgtest_prod",
315 "libstatslog",
Colin Cross47046b82018-11-04 17:24:15 -0800316 "libprotobuf-cpp-full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700317 ],
318}
Joe Onorato62c220b2017-11-18 20:32:56 -0800319
gopinatha9864fd2018-08-22 16:45:57 -0700320// ==== java proto device library (for test only) ==============================
321java_library {
322 name: "statsdprotolite",
Chenjie Yu159e4f82018-08-29 11:49:11 -0700323 no_framework_libs: true,
gopinatha9864fd2018-08-22 16:45:57 -0700324 proto: {
325 type: "lite",
326 include_dirs: ["external/protobuf/src"],
327 },
328
329 srcs: [
330 "src/stats_log.proto",
331 "src/statsd_config.proto",
332 "src/atoms.proto",
Yao Chen35cb8d62019-01-03 16:49:14 -0800333 "src/shell/shell_config.proto",
334 "src/shell/shell_data.proto",
gopinatha9864fd2018-08-22 16:45:57 -0700335 ],
336
337 static_libs: [
338 "platformprotoslite",
339 ],
340 // Protos have lots of MissingOverride and similar.
341 errorprone: {
342 javacflags: ["-XepDisableAllChecks"],
343 },
344}