blob: 091268e15ad47e595e7c561d2c7304c32bed4c16 [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-mac9def8e32018-04-17 13:55:51 -070022 src/hash.cpp \
Yangster-mac20877162017-12-22 17:19:39 -080023 src/stats_log_util.cpp \
Yangster-mac932ecec2018-02-01 10:23:52 -080024 src/anomaly/AlarmMonitor.cpp \
25 src/anomaly/AlarmTracker.cpp \
Yangster-mace2cd6d52017-11-09 20:38:30 -080026 src/anomaly/AnomalyTracker.cpp \
Bookatz857aaa52017-12-19 15:29:06 -080027 src/anomaly/DurationAnomalyTracker.cpp \
Yangster-mac932ecec2018-02-01 10:23:52 -080028 src/anomaly/subscriber_util.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000029 src/condition/CombinationConditionTracker.cpp \
30 src/condition/condition_util.cpp \
31 src/condition/SimpleConditionTracker.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070032 src/condition/ConditionWizard.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -080033 src/condition/StateTracker.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070034 src/config/ConfigKey.cpp \
35 src/config/ConfigListener.cpp \
36 src/config/ConfigManager.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000037 src/external/Perfetto.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080038 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070039 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080040 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080041 src/external/ResourceHealthManagerPuller.cpp \
Tej Singh40298312018-02-16 00:15:09 -080042 src/external/ResourceThermalManagerPuller.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080043 src/external/StatsPullerManagerImpl.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -080044 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070045 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070046 src/logd/LogListener.cpp \
47 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000048 src/matchers/CombinationLogMatchingTracker.cpp \
49 src/matchers/matcher_util.cpp \
50 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070051 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070052 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000053 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070054 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070055 src/metrics/duration_helper/OringDurationTracker.cpp \
56 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070057 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070058 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000059 src/metrics/MetricsManager.cpp \
60 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070061 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000062 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080063 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000064 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000065 src/StatsService.cpp \
Chenjie Yuaa5b2012018-03-21 13:53:15 -070066 src/statscompanion_util.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080067 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080068 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080069 src/HashableDimensionKey.cpp \
Yao Chen49954cd2018-04-18 13:48:02 -070070 src/guardrail/StatsdStats.cpp \
71 src/socket/StatsSocketListener.cpp
Yao Chenab273e22017-09-06 12:53:50 -070072
Yao Chend54f9dd2017-10-17 17:37:48 +000073statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070074 $(LOCAL_PATH)/src \
75 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070076
Yao Chend54f9dd2017-10-17 17:37:48 +000077statsd_common_aidl_includes := \
78 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070079
Joe Onorato62c220b2017-11-18 20:32:56 -080080statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080081 libhealthhalutils \
82 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080083
Yao Chend54f9dd2017-10-17 17:37:48 +000084statsd_common_shared_libraries := \
85 libbase \
86 libbinder \
Yao Chend54f9dd2017-10-17 17:37:48 +000087 libincident \
88 liblog \
Yao Chend54f9dd2017-10-17 17:37:48 +000089 libutils \
90 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070091 libprotoutil \
92 libstatslog \
93 libhardware \
94 libhardware_legacy \
95 libhidlbase \
96 libhidltransport \
97 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -080098 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070099 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800100 android.hardware.power@1.1 \
Yao Chen49954cd2018-04-18 13:48:02 -0700101 android.hardware.thermal@1.0 \
102 libpackagelistparser \
103 libsysutils \
104 libcutils
Yao Chenab273e22017-09-06 12:53:50 -0700105
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700106# =========
107# statsd
108# =========
109
110include $(CLEAR_VARS)
111
112LOCAL_MODULE := statsd
113
114LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000115 $(statsd_common_src) \
116 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700117
118LOCAL_CFLAGS += \
119 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800120 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700121 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700122 -Wno-unused-parameter
123
124ifeq (debug,)
125 LOCAL_CFLAGS += \
126 -g -O0
127else
128 # optimize for size (protobuf glop can get big)
129 LOCAL_CFLAGS += \
130 -Os
131endif
Yao Chen20e9e622018-02-28 11:18:51 -0800132LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700133
David Chen1481fe12017-10-16 13:16:34 -0700134LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000135LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700136
Joe Onorato62c220b2017-11-18 20:32:56 -0800137LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
138
David Chend6896892017-10-25 11:49:03 -0700139LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
140 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700141
142LOCAL_MODULE_CLASS := EXECUTABLES
143
Yao Chen876889c2018-05-02 11:16:16 -0700144# Enable sanitizer and allow very verbose printing on eng builds
Yao Chencd7f9002018-03-21 11:00:53 -0700145ifeq ($(TARGET_BUILD_VARIANT),eng)
146 LOCAL_CLANG := true
Yao Chen461a75f2018-03-21 16:38:26 -0700147 LOCAL_SANITIZE := address
Yao Chen876889c2018-05-02 11:16:16 -0700148 LOCAL_CFLAGS += \
149 -DVERY_VERBOSE_PRINTING
Yao Chencd7f9002018-03-21 11:00:53 -0700150endif
151
yro9b979762018-01-29 16:23:13 -0800152LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700153
154include $(BUILD_EXECUTABLE)
155
Yao Chend54f9dd2017-10-17 17:37:48 +0000156
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700157# ==============
158# statsd_test
159# ==============
160
161include $(CLEAR_VARS)
162
163LOCAL_MODULE := statsd_test
164LOCAL_COMPATIBILITY_SUITE := device-tests
165LOCAL_MODULE_TAGS := tests
166
David Chen1481fe12017-10-16 13:16:34 -0700167LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000168LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700169
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700170LOCAL_CFLAGS += \
171 -Wall \
172 -Werror \
173 -Wno-missing-field-initializers \
174 -Wno-unused-variable \
175 -Wno-unused-function \
176 -Wno-unused-parameter
177
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700178LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800180 src/atom_field_options.proto \
181 src/atoms.proto \
182 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800183 tests/AlarmMonitor_test.cpp \
184 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700185 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700186 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800187 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000188 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700189 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000190 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800191 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000192 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800193 tests/StatsLogProcessor_test.cpp \
David Chen9fdd4032018-03-20 14:38:56 -0700194 tests/StatsService_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700195 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800196 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800197 tests/condition/CombinationConditionTracker_test.cpp \
198 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800199 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700200 tests/metrics/OringDurationTracker_test.cpp \
201 tests/metrics/MaxDurationTracker_test.cpp \
202 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800203 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800204 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800205 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800206 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800207 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800208 tests/metrics/metrics_test_helper.cpp \
209 tests/statsd_test_util.cpp \
210 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800211 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac684d1952018-03-24 16:47:16 -0700212 tests/e2e/Alarm_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800213 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac3fa5d7f2018-03-10 21:50:27 -0800214 tests/e2e/GaugeMetric_e2e_push_test.cpp \
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700215 tests/e2e/GaugeMetric_e2e_pull_test.cpp \
216 tests/e2e/ValueMetric_pull_e2e_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800217 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
218 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
Yangster-macbe10ddf2018-03-13 15:39:51 -0700219 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp \
220 tests/e2e/Anomaly_count_e2e_test.cpp \
Yangster-macb142cc82018-03-30 15:22:08 -0700221 tests/e2e/Anomaly_duration_sum_e2e_test.cpp \
David Chenbd125272018-04-04 19:02:50 -0700222 tests/e2e/ConfigTtl_e2e_test.cpp \
223 tests/e2e/PartialBucket_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700224
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700225LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800226 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000227 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700228
Yao Chen9c1debe2018-02-19 14:39:19 -0800229LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000230
Yao Chen9c1debe2018-02-19 14:39:19 -0800231LOCAL_PROTOC_FLAGS := \
232 -Iexternal/protobuf/src
233
234LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
235 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000236
Joe Onorato62c220b2017-11-18 20:32:56 -0800237include $(BUILD_NATIVE_TEST)
238
Yao Chen459dee62018-01-10 16:47:05 -0800239##############################
240# stats proto static java lib
241##############################
242
243include $(CLEAR_VARS)
244LOCAL_MODULE := statsdprotolite
245
246LOCAL_SRC_FILES := \
247 src/stats_log.proto \
248 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000249 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800250 src/atoms.proto
251
252LOCAL_PROTOC_OPTIMIZE_TYPE := lite
253
254LOCAL_STATIC_JAVA_LIBRARIES := \
255 platformprotoslite
256
Yao Chen9c1debe2018-02-19 14:39:19 -0800257LOCAL_PROTOC_FLAGS := \
258 -Iexternal/protobuf/src
259
Yao Chen459dee62018-01-10 16:47:05 -0800260include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800261
Yao Chen48d75182018-01-23 09:40:48 -0800262##############################
263# statsd micro benchmark
264##############################
265
266include $(CLEAR_VARS)
267LOCAL_MODULE := statsd_benchmark
268
269LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800270 src/atom_field_options.proto \
271 src/atoms.proto \
272 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800273 benchmark/main.cpp \
274 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800275 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800276 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800277 benchmark/filter_value_benchmark.cpp \
278 benchmark/get_dimensions_for_condition_benchmark.cpp \
279 benchmark/metric_util.cpp \
280 benchmark/duration_metric_benchmark.cpp
281
282LOCAL_STATIC_LIBRARIES := \
283 $(statsd_common_static_libraries)
284
285LOCAL_PROTOC_OPTIMIZE_TYPE := full
286
287LOCAL_PROTOC_FLAGS := \
288 -Iexternal/protobuf/src
289
290LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
291 libprotobuf-cpp-full
292
293
294LOCAL_STATIC_JAVA_LIBRARIES := \
295 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800296
297LOCAL_C_INCLUDES := $(statsd_common_c_includes)
298
299LOCAL_CFLAGS := -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
306LOCAL_CFLAGS += -Wno-varargs
307
308LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
309
310LOCAL_STATIC_LIBRARIES := \
311 $(statsd_common_static_libraries)
312
313LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800314 libgtest_prod \
315 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800316
Yao Chen48d75182018-01-23 09:40:48 -0800317LOCAL_MODULE_TAGS := eng tests
318
319include $(BUILD_NATIVE_BENCHMARK)
320
321
Yao Chend54f9dd2017-10-17 17:37:48 +0000322statsd_common_src:=
323statsd_common_aidl_includes:=
324statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800325statsd_common_static_libraries:=
326statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700327
Yao Chen1ff4f432017-11-16 17:01:40 -0800328
Yao Chenb19425e2018-03-08 14:38:12 -0800329include $(call all-makefiles-under,$(LOCAL_PATH))