blob: e0222d9f036debd8c2af1503f3ffd476f4b1b926 [file] [log] [blame]
Joe Onorato5dcbc6c2017-08-29 15:13:58 -07001# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH:= $(call my-dir)
16
Yao Chend54f9dd2017-10-17 17:37:48 +000017statsd_common_src := \
18 ../../core/java/android/os/IStatsCompanionService.aidl \
19 ../../core/java/android/os/IStatsManager.aidl \
Yao Chend54f9dd2017-10-17 17:37:48 +000020 src/statsd_config.proto \
Yao Chen8a8d16c2018-02-08 14:50:40 -080021 src/FieldValue.cpp \
Yangster-mac20877162017-12-22 17:19:39 -080022 src/stats_log_util.cpp \
Yangster-mac932ecec2018-02-01 10:23:52 -080023 src/anomaly/AlarmMonitor.cpp \
24 src/anomaly/AlarmTracker.cpp \
Yangster-mace2cd6d52017-11-09 20:38:30 -080025 src/anomaly/AnomalyTracker.cpp \
Bookatz857aaa52017-12-19 15:29:06 -080026 src/anomaly/DurationAnomalyTracker.cpp \
Yangster-mac932ecec2018-02-01 10:23:52 -080027 src/anomaly/subscriber_util.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000028 src/condition/CombinationConditionTracker.cpp \
29 src/condition/condition_util.cpp \
30 src/condition/SimpleConditionTracker.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070031 src/condition/ConditionWizard.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -080032 src/condition/StateTracker.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070033 src/config/ConfigKey.cpp \
34 src/config/ConfigListener.cpp \
35 src/config/ConfigManager.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000036 src/external/Perfetto.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080037 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070038 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080039 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080040 src/external/ResourceHealthManagerPuller.cpp \
Tej Singh40298312018-02-16 00:15:09 -080041 src/external/ResourceThermalManagerPuller.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080042 src/external/StatsPullerManagerImpl.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -080043 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070044 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070045 src/logd/LogListener.cpp \
46 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000047 src/matchers/CombinationLogMatchingTracker.cpp \
48 src/matchers/matcher_util.cpp \
49 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070050 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070051 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000052 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070053 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070054 src/metrics/duration_helper/OringDurationTracker.cpp \
55 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070056 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070057 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000058 src/metrics/MetricsManager.cpp \
59 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070060 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000061 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080062 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000063 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000064 src/StatsService.cpp \
Chenjie Yuaa5b2012018-03-21 13:53:15 -070065 src/statscompanion_util.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080066 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080067 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080068 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080069 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070070
Yao Chend54f9dd2017-10-17 17:37:48 +000071statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070072 $(LOCAL_PATH)/src \
73 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070074
Yao Chend54f9dd2017-10-17 17:37:48 +000075statsd_common_aidl_includes := \
76 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070077
Joe Onorato62c220b2017-11-18 20:32:56 -080078statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080079 libhealthhalutils \
80 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080081
Yao Chend54f9dd2017-10-17 17:37:48 +000082statsd_common_shared_libraries := \
83 libbase \
84 libbinder \
Yao Chend54f9dd2017-10-17 17:37:48 +000085 libincident \
86 liblog \
Yao Chend54f9dd2017-10-17 17:37:48 +000087 libutils \
88 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070089 libprotoutil \
90 libstatslog \
91 libhardware \
92 libhardware_legacy \
93 libhidlbase \
94 libhidltransport \
95 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -080096 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070097 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -080098 android.hardware.power@1.1 \
Yao Chen20e9e622018-02-28 11:18:51 -080099 android.hardware.thermal@1.0
Yao Chenab273e22017-09-06 12:53:50 -0700100
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700101# =========
102# statsd
103# =========
104
105include $(CLEAR_VARS)
106
107LOCAL_MODULE := statsd
108
109LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000110 $(statsd_common_src) \
111 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700112
113LOCAL_CFLAGS += \
114 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800115 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700116 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700117 -Wno-unused-parameter
118
119ifeq (debug,)
120 LOCAL_CFLAGS += \
121 -g -O0
122else
123 # optimize for size (protobuf glop can get big)
124 LOCAL_CFLAGS += \
125 -Os
126endif
Yao Chen20e9e622018-02-28 11:18:51 -0800127LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700128
David Chen1481fe12017-10-16 13:16:34 -0700129LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000130LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700131
Joe Onorato62c220b2017-11-18 20:32:56 -0800132LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
133
David Chend6896892017-10-25 11:49:03 -0700134LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
135 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700136
137LOCAL_MODULE_CLASS := EXECUTABLES
138
Yao Chencd7f9002018-03-21 11:00:53 -0700139# Enable sanitizer on eng builds
140ifeq ($(TARGET_BUILD_VARIANT),eng)
141 LOCAL_CLANG := true
Yao Chen461a75f2018-03-21 16:38:26 -0700142 LOCAL_SANITIZE := address
Yao Chencd7f9002018-03-21 11:00:53 -0700143endif
144
yro9b979762018-01-29 16:23:13 -0800145LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700146
147include $(BUILD_EXECUTABLE)
148
Yao Chend54f9dd2017-10-17 17:37:48 +0000149
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700150# ==============
151# statsd_test
152# ==============
153
154include $(CLEAR_VARS)
155
156LOCAL_MODULE := statsd_test
157LOCAL_COMPATIBILITY_SUITE := device-tests
158LOCAL_MODULE_TAGS := tests
159
David Chen1481fe12017-10-16 13:16:34 -0700160LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000161LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700162
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700163LOCAL_CFLAGS += \
164 -Wall \
165 -Werror \
166 -Wno-missing-field-initializers \
167 -Wno-unused-variable \
168 -Wno-unused-function \
169 -Wno-unused-parameter
170
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700171LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800173 src/atom_field_options.proto \
174 src/atoms.proto \
175 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800176 tests/AlarmMonitor_test.cpp \
177 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700178 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700179 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800180 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700182 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800184 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000185 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800186 tests/StatsLogProcessor_test.cpp \
David Chen9fdd4032018-03-20 14:38:56 -0700187 tests/StatsService_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700188 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800189 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800190 tests/condition/CombinationConditionTracker_test.cpp \
191 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800192 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700193 tests/metrics/OringDurationTracker_test.cpp \
194 tests/metrics/MaxDurationTracker_test.cpp \
195 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800196 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800197 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800198 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800199 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800200 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800201 tests/metrics/metrics_test_helper.cpp \
202 tests/statsd_test_util.cpp \
203 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800204 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac684d1952018-03-24 16:47:16 -0700205 tests/e2e/Alarm_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800206 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac3fa5d7f2018-03-10 21:50:27 -0800207 tests/e2e/GaugeMetric_e2e_push_test.cpp \
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700208 tests/e2e/GaugeMetric_e2e_pull_test.cpp \
209 tests/e2e/ValueMetric_pull_e2e_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800210 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
211 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
Yangster-macbe10ddf2018-03-13 15:39:51 -0700212 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp \
213 tests/e2e/Anomaly_count_e2e_test.cpp \
Yangster-macb142cc82018-03-30 15:22:08 -0700214 tests/e2e/Anomaly_duration_sum_e2e_test.cpp \
David Chenbd125272018-04-04 19:02:50 -0700215 tests/e2e/ConfigTtl_e2e_test.cpp \
216 tests/e2e/PartialBucket_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700217
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700218LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800219 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000220 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700221
Yao Chen9c1debe2018-02-19 14:39:19 -0800222LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000223
Yao Chen9c1debe2018-02-19 14:39:19 -0800224LOCAL_PROTOC_FLAGS := \
225 -Iexternal/protobuf/src
226
227LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
228 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000229
Joe Onorato62c220b2017-11-18 20:32:56 -0800230include $(BUILD_NATIVE_TEST)
231
Yao Chen459dee62018-01-10 16:47:05 -0800232##############################
233# stats proto static java lib
234##############################
235
236include $(CLEAR_VARS)
237LOCAL_MODULE := statsdprotolite
238
239LOCAL_SRC_FILES := \
240 src/stats_log.proto \
241 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000242 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800243 src/atoms.proto
244
245LOCAL_PROTOC_OPTIMIZE_TYPE := lite
246
247LOCAL_STATIC_JAVA_LIBRARIES := \
248 platformprotoslite
249
Yao Chen9c1debe2018-02-19 14:39:19 -0800250LOCAL_PROTOC_FLAGS := \
251 -Iexternal/protobuf/src
252
Yao Chen459dee62018-01-10 16:47:05 -0800253include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800254
Yao Chen48d75182018-01-23 09:40:48 -0800255##############################
256# statsd micro benchmark
257##############################
258
259include $(CLEAR_VARS)
260LOCAL_MODULE := statsd_benchmark
261
262LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800263 src/atom_field_options.proto \
264 src/atoms.proto \
265 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800266 benchmark/main.cpp \
267 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800268 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800269 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800270 benchmark/filter_value_benchmark.cpp \
271 benchmark/get_dimensions_for_condition_benchmark.cpp \
272 benchmark/metric_util.cpp \
273 benchmark/duration_metric_benchmark.cpp
274
275LOCAL_STATIC_LIBRARIES := \
276 $(statsd_common_static_libraries)
277
278LOCAL_PROTOC_OPTIMIZE_TYPE := full
279
280LOCAL_PROTOC_FLAGS := \
281 -Iexternal/protobuf/src
282
283LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
284 libprotobuf-cpp-full
285
286
287LOCAL_STATIC_JAVA_LIBRARIES := \
288 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800289
290LOCAL_C_INCLUDES := $(statsd_common_c_includes)
291
292LOCAL_CFLAGS := -Wall \
293 -Werror \
294 -Wno-unused-parameter \
295 -Wno-unused-variable \
296 -Wno-unused-function \
297
298# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
299LOCAL_CFLAGS += -Wno-varargs
300
301LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
302
303LOCAL_STATIC_LIBRARIES := \
304 $(statsd_common_static_libraries)
305
306LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800307 libgtest_prod \
308 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800309
Yao Chen48d75182018-01-23 09:40:48 -0800310LOCAL_MODULE_TAGS := eng tests
311
312include $(BUILD_NATIVE_BENCHMARK)
313
314
Yao Chend54f9dd2017-10-17 17:37:48 +0000315statsd_common_src:=
316statsd_common_aidl_includes:=
317statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800318statsd_common_static_libraries:=
319statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700320
Yao Chen1ff4f432017-11-16 17:01:40 -0800321
Yao Chenb19425e2018-03-08 14:38:12 -0800322include $(call all-makefiles-under,$(LOCAL_PATH))