blob: 3b679fc5cef32755f77eb1b373c826f9281ff0e0 [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 Chen9c1debe2018-02-19 14:39:19 -080020 src/stats_log_common.proto \
Yao Chend54f9dd2017-10-17 17:37:48 +000021 src/statsd_config.proto \
Yao Chen8a8d16c2018-02-08 14:50:40 -080022 src/FieldValue.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 \
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
yro9b979762018-01-29 16:23:13 -0800139LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700140
141include $(BUILD_EXECUTABLE)
142
Yao Chend54f9dd2017-10-17 17:37:48 +0000143
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700144# ==============
145# statsd_test
146# ==============
147
148include $(CLEAR_VARS)
149
150LOCAL_MODULE := statsd_test
151LOCAL_COMPATIBILITY_SUITE := device-tests
152LOCAL_MODULE_TAGS := tests
153
David Chen1481fe12017-10-16 13:16:34 -0700154LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000155LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700156
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700157LOCAL_CFLAGS += \
158 -Wall \
159 -Werror \
160 -Wno-missing-field-initializers \
161 -Wno-unused-variable \
162 -Wno-unused-function \
163 -Wno-unused-parameter
164
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700165LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000166 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800167 src/atom_field_options.proto \
168 src/atoms.proto \
169 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800170 tests/AlarmMonitor_test.cpp \
171 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700172 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700173 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800174 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000175 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700176 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000177 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800178 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800180 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700181 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800182 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800183 tests/condition/CombinationConditionTracker_test.cpp \
184 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800185 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700186 tests/metrics/OringDurationTracker_test.cpp \
187 tests/metrics/MaxDurationTracker_test.cpp \
188 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800189 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800190 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800191 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800192 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800193 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800194 tests/metrics/metrics_test_helper.cpp \
195 tests/statsd_test_util.cpp \
196 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800197 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800198 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800199 tests/e2e/GaugeMetric_e2e_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800200 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
201 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
202 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700203
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700204LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800205 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000206 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700207
Yao Chen9c1debe2018-02-19 14:39:19 -0800208LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000209
Yao Chen9c1debe2018-02-19 14:39:19 -0800210LOCAL_PROTOC_FLAGS := \
211 -Iexternal/protobuf/src
212
213LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
214 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000215
Joe Onorato62c220b2017-11-18 20:32:56 -0800216include $(BUILD_NATIVE_TEST)
217
Yao Chen459dee62018-01-10 16:47:05 -0800218##############################
219# stats proto static java lib
220##############################
221
222include $(CLEAR_VARS)
223LOCAL_MODULE := statsdprotolite
224
225LOCAL_SRC_FILES := \
226 src/stats_log.proto \
Yao Chen9c1debe2018-02-19 14:39:19 -0800227 src/stats_log_common.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800228 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000229 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800230 src/atoms.proto
231
232LOCAL_PROTOC_OPTIMIZE_TYPE := lite
233
234LOCAL_STATIC_JAVA_LIBRARIES := \
235 platformprotoslite
236
Yao Chen9c1debe2018-02-19 14:39:19 -0800237LOCAL_PROTOC_FLAGS := \
238 -Iexternal/protobuf/src
239
Yao Chen459dee62018-01-10 16:47:05 -0800240include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800241
Yao Chen48d75182018-01-23 09:40:48 -0800242##############################
243# statsd micro benchmark
244##############################
245
246include $(CLEAR_VARS)
247LOCAL_MODULE := statsd_benchmark
248
249LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800250 src/atom_field_options.proto \
251 src/atoms.proto \
252 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800253 benchmark/main.cpp \
254 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800255 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800256 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800257 benchmark/filter_value_benchmark.cpp \
258 benchmark/get_dimensions_for_condition_benchmark.cpp \
259 benchmark/metric_util.cpp \
260 benchmark/duration_metric_benchmark.cpp
261
262LOCAL_STATIC_LIBRARIES := \
263 $(statsd_common_static_libraries)
264
265LOCAL_PROTOC_OPTIMIZE_TYPE := full
266
267LOCAL_PROTOC_FLAGS := \
268 -Iexternal/protobuf/src
269
270LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
271 libprotobuf-cpp-full
272
273
274LOCAL_STATIC_JAVA_LIBRARIES := \
275 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800276
277LOCAL_C_INCLUDES := $(statsd_common_c_includes)
278
279LOCAL_CFLAGS := -Wall \
280 -Werror \
281 -Wno-unused-parameter \
282 -Wno-unused-variable \
283 -Wno-unused-function \
284
285# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
286LOCAL_CFLAGS += -Wno-varargs
287
288LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
289
290LOCAL_STATIC_LIBRARIES := \
291 $(statsd_common_static_libraries)
292
293LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800294 libgtest_prod \
295 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800296
Yao Chen48d75182018-01-23 09:40:48 -0800297LOCAL_MODULE_TAGS := eng tests
298
299include $(BUILD_NATIVE_BENCHMARK)
300
301
Yao Chend54f9dd2017-10-17 17:37:48 +0000302statsd_common_src:=
303statsd_common_aidl_includes:=
304statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800305statsd_common_static_libraries:=
306statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700307
Yao Chen1ff4f432017-11-16 17:01:40 -0800308
Yao Chenb19425e2018-03-08 14:38:12 -0800309include $(call all-makefiles-under,$(LOCAL_PATH))