blob: 7298da6f68357aae3f09c9fe63f2fafd4d70b78c [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/statsd_config.proto",
55 "src/FieldValue.cpp",
56 "src/hash.cpp",
57 "src/stats_log_util.cpp",
58 "src/anomaly/AlarmMonitor.cpp",
59 "src/anomaly/AlarmTracker.cpp",
60 "src/anomaly/AnomalyTracker.cpp",
61 "src/anomaly/DurationAnomalyTracker.cpp",
62 "src/anomaly/subscriber_util.cpp",
63 "src/condition/CombinationConditionTracker.cpp",
64 "src/condition/condition_util.cpp",
65 "src/condition/SimpleConditionTracker.cpp",
66 "src/condition/ConditionWizard.cpp",
67 "src/condition/StateTracker.cpp",
68 "src/config/ConfigKey.cpp",
69 "src/config/ConfigListener.cpp",
70 "src/config/ConfigManager.cpp",
Yiwei Zhang7e633032019-03-01 17:25:27 -080071 "src/external/GpuStatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070072 "src/external/Perfetto.cpp",
73 "src/external/Perfprofd.cpp",
74 "src/external/StatsPuller.cpp",
Tej Singha0c89dd2019-01-25 16:39:18 -080075 "src/external/StatsCallbackPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070076 "src/external/StatsCompanionServicePuller.cpp",
77 "src/external/SubsystemSleepStatePuller.cpp",
Bookatz92da2832018-11-01 18:10:03 -070078 "src/external/PowerStatsPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070079 "src/external/ResourceHealthManagerPuller.cpp",
Chenjie Yu97dbb202019-02-13 16:42:04 -080080 "src/external/TrainInfoPuller.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -070081 "src/external/StatsPullerManager.cpp",
82 "src/external/puller_util.cpp",
83 "src/logd/LogEvent.cpp",
84 "src/logd/LogListener.cpp",
85 "src/matchers/CombinationLogMatchingTracker.cpp",
86 "src/matchers/EventMatcherWizard.cpp",
87 "src/matchers/matcher_util.cpp",
88 "src/matchers/SimpleLogMatchingTracker.cpp",
89 "src/metrics/MetricProducer.cpp",
90 "src/metrics/EventMetricProducer.cpp",
91 "src/metrics/CountMetricProducer.cpp",
92 "src/metrics/DurationMetricProducer.cpp",
93 "src/metrics/duration_helper/OringDurationTracker.cpp",
94 "src/metrics/duration_helper/MaxDurationTracker.cpp",
95 "src/metrics/ValueMetricProducer.cpp",
96 "src/metrics/GaugeMetricProducer.cpp",
97 "src/metrics/MetricsManager.cpp",
98 "src/metrics/metrics_manager_util.cpp",
99 "src/packages/UidMap.cpp",
100 "src/storage/StorageManager.cpp",
101 "src/StatsLogProcessor.cpp",
102 "src/StatsService.cpp",
103 "src/statscompanion_util.cpp",
104 "src/subscriber/IncidentdReporter.cpp",
105 "src/subscriber/SubscriberReporter.cpp",
106 "src/HashableDimensionKey.cpp",
107 "src/guardrail/StatsdStats.cpp",
108 "src/socket/StatsSocketListener.cpp",
109 "src/shell/ShellSubscriber.cpp",
110 "src/shell/shell_config.proto",
111
112 ":perfprofd_aidl",
113 ],
114
115 local_include_dirs: [
116 "src",
117 ],
118
119 static_libs: [
120 "libhealthhalutils",
121 ],
122
123 shared_libs: [
124 "libbase",
125 "libbinder",
Yiwei Zhang7e633032019-03-01 17:25:27 -0800126 "libgraphicsenv",
Colin Crossbc2dc312018-10-26 22:34:06 -0700127 "libincident",
128 "liblog",
129 "libutils",
130 "libservices",
131 "libprotoutil",
132 "libstatslog",
133 "libhardware",
134 "libhardware_legacy",
135 "libhidlbase",
136 "libhidltransport",
137 "libhwbinder",
138 "android.frameworks.stats@1.0",
139 "android.hardware.health@2.0",
140 "android.hardware.power@1.0",
141 "android.hardware.power@1.1",
Bookatz92da2832018-11-01 18:10:03 -0700142 "android.hardware.power.stats@1.0",
Colin Crossbc2dc312018-10-26 22:34:06 -0700143 "libpackagelistparser",
144 "libsysutils",
145 "libcutils",
146 ],
147}
148
149// =========
150// statsd
151// =========
152
153cc_binary {
154 name: "statsd",
155 defaults: ["statsd_defaults"],
156
157 srcs: ["src/main.cpp"],
158
159 cflags: [
160 "-Wall",
161 "-Wextra",
162 "-Werror",
163 "-Wno-unused-parameter",
164 // optimize for size (protobuf glop can get big)
165 "-Os",
166 // "-g",
167 // "-O0",
168 ],
169
170 product_variables: {
171 eng: {
172 // Enable sanitizer ONLY on eng builds
173 //sanitize: {
174 // address: true,
175 //},
176 },
177 debuggable: {
178 // Add a flag to enable stats log printing from statsd on debug builds.
179 cflags: ["-DVERY_VERBOSE_PRINTING"],
180 },
181 },
182
183 proto: {
184 type: "lite",
185 },
186
187 shared_libs: ["libgtest_prod"],
188
Howard Ro1260bb42018-10-29 17:22:36 -0700189 vintf_fragments: ["android.frameworks.stats@1.0-service.xml"],
190
Colin Crossbc2dc312018-10-26 22:34:06 -0700191 init_rc: ["statsd.rc"],
192}
193
194// ==============
195// statsd_test
196// ==============
197
198cc_test {
199 name: "statsd_test",
200 defaults: ["statsd_defaults"],
201 test_suites: ["device-tests"],
202
203 cflags: [
204 "-Wall",
205 "-Werror",
206 "-Wno-missing-field-initializers",
207 "-Wno-unused-variable",
208 "-Wno-unused-function",
209 "-Wno-unused-parameter",
210 ],
211
212 srcs: [
213 "src/atom_field_options.proto",
214 "src/atoms.proto",
215 "src/stats_log.proto",
216 "src/shell/shell_data.proto",
217 "tests/AlarmMonitor_test.cpp",
218 "tests/anomaly/AlarmTracker_test.cpp",
219 "tests/anomaly/AnomalyTracker_test.cpp",
220 "tests/ConfigManager_test.cpp",
221 "tests/external/puller_util_test.cpp",
Yao Chena8e78b92019-03-04 17:23:38 -0800222 "tests/external/IncidentReportArgs_test.cpp",
Chenjie Yuc7939cb2019-02-04 17:25:45 -0800223 "tests/external/StatsPuller_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700224 "tests/indexed_priority_queue_test.cpp",
225 "tests/LogEntryMatcher_test.cpp",
226 "tests/LogEvent_test.cpp",
227 "tests/MetricsManager_test.cpp",
228 "tests/StatsLogProcessor_test.cpp",
229 "tests/StatsService_test.cpp",
230 "tests/UidMap_test.cpp",
231 "tests/FieldValue_test.cpp",
232 "tests/condition/CombinationConditionTracker_test.cpp",
233 "tests/condition/SimpleConditionTracker_test.cpp",
234 "tests/condition/StateTracker_test.cpp",
235 "tests/metrics/OringDurationTracker_test.cpp",
236 "tests/metrics/MaxDurationTracker_test.cpp",
237 "tests/metrics/CountMetricProducer_test.cpp",
238 "tests/metrics/DurationMetricProducer_test.cpp",
239 "tests/metrics/EventMetricProducer_test.cpp",
240 "tests/metrics/ValueMetricProducer_test.cpp",
241 "tests/metrics/GaugeMetricProducer_test.cpp",
242 "tests/guardrail/StatsdStats_test.cpp",
243 "tests/metrics/metrics_test_helper.cpp",
244 "tests/statsd_test_util.cpp",
Chenjie Yu6b1667c2019-01-18 10:09:33 -0800245 "tests/storage/StorageManager_test.cpp",
Colin Crossbc2dc312018-10-26 22:34:06 -0700246 "tests/e2e/WakelockDuration_e2e_test.cpp",
247 "tests/e2e/MetricActivation_e2e_test.cpp",
248 "tests/e2e/MetricConditionLink_e2e_test.cpp",
249 "tests/e2e/Alarm_e2e_test.cpp",
250 "tests/e2e/Attribution_e2e_test.cpp",
251 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
252 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
253 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
254 "tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp",
255 "tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp",
256 "tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp",
257 "tests/e2e/Anomaly_count_e2e_test.cpp",
258 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
259 "tests/e2e/ConfigTtl_e2e_test.cpp",
260 "tests/e2e/PartialBucket_e2e_test.cpp",
261 "tests/shell/ShellSubscriber_test.cpp",
262 ],
263
264 static_libs: [
265 "libgmock",
266 "libplatformprotos",
267 ],
268
269 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800270 type: "full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700271 include_dirs: ["external/protobuf/src"],
272 },
273
Colin Cross47046b82018-11-04 17:24:15 -0800274 shared_libs: ["libprotobuf-cpp-full"],
Colin Crossbc2dc312018-10-26 22:34:06 -0700275
276}
277
278//#############################
279// statsd micro benchmark
280//#############################
281
282cc_benchmark {
283 name: "statsd_benchmark",
284 defaults: ["statsd_defaults"],
285
286 srcs: [
287 "src/atom_field_options.proto",
288 "src/atoms.proto",
289 "src/stats_log.proto",
290 "benchmark/main.cpp",
291 "benchmark/hello_world_benchmark.cpp",
292 "benchmark/log_event_benchmark.cpp",
293 "benchmark/stats_write_benchmark.cpp",
294 "benchmark/filter_value_benchmark.cpp",
295 "benchmark/get_dimensions_for_condition_benchmark.cpp",
296 "benchmark/metric_util.cpp",
297 "benchmark/duration_metric_benchmark.cpp",
298 ],
299
300 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800301 type: "full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700302 include_dirs: ["external/protobuf/src"],
303 },
304
305 cflags: [
306 "-Wall",
307 "-Werror",
308 "-Wno-unused-parameter",
309 "-Wno-unused-variable",
310 "-Wno-unused-function",
311
312 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
313 "-Wno-varargs"
314 ],
315
316 static_libs: [
317 "libplatformprotos",
318 ],
319
320 shared_libs: [
321 "libgtest_prod",
322 "libstatslog",
Colin Cross47046b82018-11-04 17:24:15 -0800323 "libprotobuf-cpp-full",
Colin Crossbc2dc312018-10-26 22:34:06 -0700324 ],
325}
Joe Onorato62c220b2017-11-18 20:32:56 -0800326
gopinatha9864fd2018-08-22 16:45:57 -0700327// ==== java proto device library (for test only) ==============================
328java_library {
329 name: "statsdprotolite",
Chenjie Yu159e4f82018-08-29 11:49:11 -0700330 no_framework_libs: true,
gopinatha9864fd2018-08-22 16:45:57 -0700331 proto: {
332 type: "lite",
333 include_dirs: ["external/protobuf/src"],
334 },
335
336 srcs: [
337 "src/stats_log.proto",
338 "src/statsd_config.proto",
339 "src/atoms.proto",
Yao Chen35cb8d62019-01-03 16:49:14 -0800340 "src/shell/shell_config.proto",
341 "src/shell/shell_data.proto",
gopinatha9864fd2018-08-22 16:45:57 -0700342 ],
343
344 static_libs: [
345 "platformprotoslite",
346 ],
347 // Protos have lots of MissingOverride and similar.
348 errorprone: {
349 javacflags: ["-XepDisableAllChecks"],
350 },
351}
Harry Zhangfe16c8f2019-02-26 10:47:04 -0800352
353// Filegroup for statsd config proto definition.
354filegroup {
355 name: "statsd-config-proto-def",
356 srcs: ["src/statsd_config.proto"],
357}