blob: 5c3d17e305859f258bfd8e981bb33e5c7c081b76 [file] [log] [blame]
Yao Chend54f9dd2017-10-17 17:37:48 +00001//
Colin Cross05c9e5c2018-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 Cross05c9e5c2018-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/StatsPuller.cpp",
72 "src/external/StatsCompanionServicePuller.cpp",
73 "src/external/SubsystemSleepStatePuller.cpp",
74 "src/external/ResourceHealthManagerPuller.cpp",
75 "src/external/ResourceThermalManagerPuller.cpp",
76 "src/external/StatsPullerManagerImpl.cpp",
77 "src/external/puller_util.cpp",
78 "src/logd/LogEvent.cpp",
79 "src/logd/LogListener.cpp",
80 "src/logd/LogReader.cpp",
81 "src/matchers/CombinationLogMatchingTracker.cpp",
82 "src/matchers/matcher_util.cpp",
83 "src/matchers/SimpleLogMatchingTracker.cpp",
84 "src/metrics/MetricProducer.cpp",
85 "src/metrics/EventMetricProducer.cpp",
86 "src/metrics/CountMetricProducer.cpp",
87 "src/metrics/DurationMetricProducer.cpp",
88 "src/metrics/duration_helper/OringDurationTracker.cpp",
89 "src/metrics/duration_helper/MaxDurationTracker.cpp",
90 "src/metrics/ValueMetricProducer.cpp",
91 "src/metrics/GaugeMetricProducer.cpp",
92 "src/metrics/MetricsManager.cpp",
93 "src/metrics/metrics_manager_util.cpp",
94 "src/packages/UidMap.cpp",
95 "src/perfetto/perfetto_config.proto",
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 ],
106
107 local_include_dirs: [
108 "src",
109 ],
110
111 static_libs: [
112 "libhealthhalutils",
113 "libplatformprotos",
114 ],
115
116 shared_libs: [
117 "libbase",
118 "libbinder",
119 "libincident",
120 "liblog",
121 "libutils",
122 "libservices",
123 "libprotoutil",
124 "libstatslog",
125 "libhardware",
126 "libhardware_legacy",
127 "libhidlbase",
128 "libhidltransport",
129 "libhwbinder",
130 "android.hardware.health@2.0",
131 "android.hardware.power@1.0",
132 "android.hardware.power@1.1",
133 "android.hardware.thermal@1.0",
134 "libpackagelistparser",
135 "libsysutils",
136 "libcutils",
137 ],
138}
139
140// =========
141// statsd
142// =========
143
144cc_binary {
145 name: "statsd",
146 defaults: ["statsd_defaults"],
147
148 srcs: ["src/main.cpp"],
149
150 cflags: [
151 "-Wall",
152 "-Wextra",
153 "-Werror",
154 "-Wno-unused-parameter",
155 // optimize for size (protobuf glop can get big)
156 "-Os",
157 // "-g",
158 // "-O0",
159 ],
160
161 product_variables: {
162 eng: {
163 // Enable sanitizer and allow very verbose printing on eng builds
164 cflags: ["-DVERY_VERBOSE_PRINTING"],
165 sanitize: {
166 address: true,
167 },
168 },
169 },
170
171 proto: {
172 type: "lite",
173 },
174
175 shared_libs: ["libgtest_prod"],
176
177 init_rc: ["statsd.rc"],
178}
179
180// ==============
181// statsd_test
182// ==============
183
184cc_test {
185 name: "statsd_test",
186 defaults: ["statsd_defaults"],
187 test_suites: ["device-tests"],
188
189 cflags: [
190 "-Wall",
191 "-Werror",
192 "-Wno-missing-field-initializers",
193 "-Wno-unused-variable",
194 "-Wno-unused-function",
195 "-Wno-unused-parameter",
196 ],
197
198 srcs: [
199 "src/atom_field_options.proto",
200 "src/atoms.proto",
201 "src/stats_log.proto",
202 "tests/AlarmMonitor_test.cpp",
203 "tests/anomaly/AlarmTracker_test.cpp",
204 "tests/anomaly/AnomalyTracker_test.cpp",
205 "tests/ConfigManager_test.cpp",
206 "tests/external/puller_util_test.cpp",
207 "tests/indexed_priority_queue_test.cpp",
208 "tests/LogEntryMatcher_test.cpp",
209 "tests/LogReader_test.cpp",
210 "tests/LogEvent_test.cpp",
211 "tests/MetricsManager_test.cpp",
212 "tests/StatsLogProcessor_test.cpp",
213 "tests/StatsService_test.cpp",
214 "tests/UidMap_test.cpp",
215 "tests/FieldValue_test.cpp",
216 "tests/condition/CombinationConditionTracker_test.cpp",
217 "tests/condition/SimpleConditionTracker_test.cpp",
218 "tests/condition/StateTracker_test.cpp",
219 "tests/metrics/OringDurationTracker_test.cpp",
220 "tests/metrics/MaxDurationTracker_test.cpp",
221 "tests/metrics/CountMetricProducer_test.cpp",
222 "tests/metrics/DurationMetricProducer_test.cpp",
223 "tests/metrics/EventMetricProducer_test.cpp",
224 "tests/metrics/ValueMetricProducer_test.cpp",
225 "tests/metrics/GaugeMetricProducer_test.cpp",
226 "tests/guardrail/StatsdStats_test.cpp",
227 "tests/metrics/metrics_test_helper.cpp",
228 "tests/statsd_test_util.cpp",
229 "tests/e2e/WakelockDuration_e2e_test.cpp",
230 "tests/e2e/MetricConditionLink_e2e_test.cpp",
231 "tests/e2e/Alarm_e2e_test.cpp",
232 "tests/e2e/Attribution_e2e_test.cpp",
233 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
234 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
235 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
236 "tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp",
237 "tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp",
238 "tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp",
239 "tests/e2e/Anomaly_count_e2e_test.cpp",
240 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
241 "tests/e2e/ConfigTtl_e2e_test.cpp",
242 "tests/e2e/PartialBucket_e2e_test.cpp",
243 ],
244
245 static_libs: ["libgmock"],
246
247 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800248 type: "full",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700249 include_dirs: ["external/protobuf/src"],
250 },
251
Colin Cross47046b82018-11-04 17:24:15 -0800252 shared_libs: ["libprotobuf-cpp-full"],
Colin Cross05c9e5c2018-10-26 22:34:06 -0700253
254}
255
256//#############################
257// statsd micro benchmark
258//#############################
259
260cc_benchmark {
261 name: "statsd_benchmark",
262 defaults: ["statsd_defaults"],
263
264 srcs: [
265 "src/atom_field_options.proto",
266 "src/atoms.proto",
267 "src/stats_log.proto",
268 "benchmark/main.cpp",
269 "benchmark/hello_world_benchmark.cpp",
270 "benchmark/log_event_benchmark.cpp",
271 "benchmark/stats_write_benchmark.cpp",
272 "benchmark/filter_value_benchmark.cpp",
273 "benchmark/get_dimensions_for_condition_benchmark.cpp",
274 "benchmark/metric_util.cpp",
275 "benchmark/duration_metric_benchmark.cpp",
276 ],
277
278 proto: {
Colin Cross47046b82018-11-04 17:24:15 -0800279 type: "full",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700280 include_dirs: ["external/protobuf/src"],
281 },
282
283 cflags: [
284 "-Wall",
285 "-Werror",
286 "-Wno-unused-parameter",
287 "-Wno-unused-variable",
288 "-Wno-unused-function",
289
290 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
291 "-Wno-varargs"
292 ],
293
294 shared_libs: [
295 "libgtest_prod",
296 "libstatslog",
Colin Cross47046b82018-11-04 17:24:15 -0800297 "libprotobuf-cpp-full",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700298 ],
299}
Joe Onorato62c220b2017-11-18 20:32:56 -0800300
gopinath17593b02018-10-26 16:00:34 -0700301// ==== java proto device library (for test only) ==============================
302java_library {
303 name: "statsdprotolite",
304 no_framework_libs: true,
305 proto: {
306 type: "lite",
307 include_dirs: ["external/protobuf/src"],
308 },
309
310 srcs: [
311 "src/stats_log.proto",
312 "src/statsd_config.proto",
313 "src/perfetto/perfetto_config.proto",
314 "src/atoms.proto",
315 ],
316
317 static_libs: [
318 "platformprotoslite",
319 ],
320 // Protos have lots of MissingOverride and similar.
321 errorprone: {
322 javacflags: ["-XepDisableAllChecks"],
323 },
324}
325
326