blob: 5d6a1d1a6c15985cb8ccb09b7dcca4449585ce52 [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 Chen5154a3792017-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 \
Yi Jinafb36062018-01-31 19:14:25 -080065 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080066 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080067 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080068 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070069
Yao Chend54f9dd2017-10-17 17:37:48 +000070statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070071 $(LOCAL_PATH)/src \
72 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070073
Yao Chend54f9dd2017-10-17 17:37:48 +000074statsd_common_aidl_includes := \
75 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070076
Joe Onorato62c220b2017-11-18 20:32:56 -080077statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080078 libhealthhalutils \
79 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080080
Yao Chend54f9dd2017-10-17 17:37:48 +000081statsd_common_shared_libraries := \
82 libbase \
83 libbinder \
Yao Chend54f9dd2017-10-17 17:37:48 +000084 libincident \
85 liblog \
Yao Chend54f9dd2017-10-17 17:37:48 +000086 libutils \
87 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070088 libprotoutil \
89 libstatslog \
90 libhardware \
91 libhardware_legacy \
92 libhidlbase \
93 libhidltransport \
94 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -080095 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070096 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -080097 android.hardware.power@1.1 \
Yao Chen20e9e622018-02-28 11:18:51 -080098 android.hardware.thermal@1.0
Yao Chenab273e22017-09-06 12:53:50 -070099
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700100# =========
101# statsd
102# =========
103
104include $(CLEAR_VARS)
105
106LOCAL_MODULE := statsd
107
108LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000109 $(statsd_common_src) \
110 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700111
112LOCAL_CFLAGS += \
113 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800114 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700115 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700116 -Wno-unused-parameter
117
118ifeq (debug,)
119 LOCAL_CFLAGS += \
120 -g -O0
121else
122 # optimize for size (protobuf glop can get big)
123 LOCAL_CFLAGS += \
124 -Os
125endif
Yao Chen20e9e622018-02-28 11:18:51 -0800126LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700127
David Chen1481fe12017-10-16 13:16:34 -0700128LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000129LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700130
Joe Onorato62c220b2017-11-18 20:32:56 -0800131LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
132
David Chend6896892017-10-25 11:49:03 -0700133LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
134 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700135
136LOCAL_MODULE_CLASS := EXECUTABLES
137
yro9b979762018-01-29 16:23:13 -0800138LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700139
140include $(BUILD_EXECUTABLE)
141
Yao Chend54f9dd2017-10-17 17:37:48 +0000142
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700143# ==============
144# statsd_test
145# ==============
146
147include $(CLEAR_VARS)
148
149LOCAL_MODULE := statsd_test
150LOCAL_COMPATIBILITY_SUITE := device-tests
151LOCAL_MODULE_TAGS := tests
152
David Chen1481fe12017-10-16 13:16:34 -0700153LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000154LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700155
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700156LOCAL_CFLAGS += \
157 -Wall \
158 -Werror \
159 -Wno-missing-field-initializers \
160 -Wno-unused-variable \
161 -Wno-unused-function \
162 -Wno-unused-parameter
163
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700164LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000165 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800166 src/atom_field_options.proto \
167 src/atoms.proto \
168 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800169 tests/AlarmMonitor_test.cpp \
170 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700171 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700172 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800173 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000174 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700175 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800177 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800179 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a3792017-10-30 22:57:06 -0700180 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800181 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800182 tests/condition/CombinationConditionTracker_test.cpp \
183 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800184 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700185 tests/metrics/OringDurationTracker_test.cpp \
186 tests/metrics/MaxDurationTracker_test.cpp \
187 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800188 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800189 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800190 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800191 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800192 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800193 tests/metrics/metrics_test_helper.cpp \
194 tests/statsd_test_util.cpp \
195 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800196 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800197 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac3fa5d7f2018-03-10 21:50:27 -0800198 tests/e2e/GaugeMetric_e2e_push_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800199 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
200 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
201 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700202
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700203LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800204 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000205 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700206
Yao Chen9c1debe2018-02-19 14:39:19 -0800207LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000208
Yao Chen9c1debe2018-02-19 14:39:19 -0800209LOCAL_PROTOC_FLAGS := \
210 -Iexternal/protobuf/src
211
212LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
213 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000214
Joe Onorato62c220b2017-11-18 20:32:56 -0800215include $(BUILD_NATIVE_TEST)
216
Yao Chen459dee62018-01-10 16:47:05 -0800217##############################
218# stats proto static java lib
219##############################
220
221include $(CLEAR_VARS)
222LOCAL_MODULE := statsdprotolite
223
224LOCAL_SRC_FILES := \
225 src/stats_log.proto \
226 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000227 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800228 src/atoms.proto
229
230LOCAL_PROTOC_OPTIMIZE_TYPE := lite
231
232LOCAL_STATIC_JAVA_LIBRARIES := \
233 platformprotoslite
234
Yao Chen9c1debe2018-02-19 14:39:19 -0800235LOCAL_PROTOC_FLAGS := \
236 -Iexternal/protobuf/src
237
Yao Chen459dee62018-01-10 16:47:05 -0800238include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800239
Yao Chen48d75182018-01-23 09:40:48 -0800240##############################
241# statsd micro benchmark
242##############################
243
244include $(CLEAR_VARS)
245LOCAL_MODULE := statsd_benchmark
246
247LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800248 src/atom_field_options.proto \
249 src/atoms.proto \
250 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800251 benchmark/main.cpp \
252 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800253 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800254 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800255 benchmark/filter_value_benchmark.cpp \
256 benchmark/get_dimensions_for_condition_benchmark.cpp \
257 benchmark/metric_util.cpp \
258 benchmark/duration_metric_benchmark.cpp
259
260LOCAL_STATIC_LIBRARIES := \
261 $(statsd_common_static_libraries)
262
263LOCAL_PROTOC_OPTIMIZE_TYPE := full
264
265LOCAL_PROTOC_FLAGS := \
266 -Iexternal/protobuf/src
267
268LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
269 libprotobuf-cpp-full
270
271
272LOCAL_STATIC_JAVA_LIBRARIES := \
273 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800274
275LOCAL_C_INCLUDES := $(statsd_common_c_includes)
276
277LOCAL_CFLAGS := -Wall \
278 -Werror \
279 -Wno-unused-parameter \
280 -Wno-unused-variable \
281 -Wno-unused-function \
282
283# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
284LOCAL_CFLAGS += -Wno-varargs
285
286LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
287
288LOCAL_STATIC_LIBRARIES := \
289 $(statsd_common_static_libraries)
290
291LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800292 libgtest_prod \
293 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800294
Yao Chen48d75182018-01-23 09:40:48 -0800295LOCAL_MODULE_TAGS := eng tests
296
297include $(BUILD_NATIVE_BENCHMARK)
298
299
Yao Chend54f9dd2017-10-17 17:37:48 +0000300statsd_common_src:=
301statsd_common_aidl_includes:=
302statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800303statsd_common_static_libraries:=
304statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700305
Yao Chen1ff4f432017-11-16 17:01:40 -0800306
Yao Chenb19425e2018-03-08 14:38:12 -0800307include $(call all-makefiles-under,$(LOCAL_PATH))