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