blob: 7f0a26c1714ea47f0fa006620bbf040ff981ff45 [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 \
85 libcutils \
86 libincident \
87 liblog \
88 libselinux \
89 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 Chen20e9e622018-02-28 11:18:51 -0800101 android.hardware.thermal@1.0
Yao Chenab273e22017-09-06 12:53:50 -0700102
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700103# =========
104# statsd
105# =========
106
107include $(CLEAR_VARS)
108
109LOCAL_MODULE := statsd
110
111LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000112 $(statsd_common_src) \
113 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700114
115LOCAL_CFLAGS += \
116 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800117 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700118 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700119 -Wno-unused-parameter
120
121ifeq (debug,)
122 LOCAL_CFLAGS += \
123 -g -O0
124else
125 # optimize for size (protobuf glop can get big)
126 LOCAL_CFLAGS += \
127 -Os
128endif
Yao Chen20e9e622018-02-28 11:18:51 -0800129LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700130
David Chen1481fe12017-10-16 13:16:34 -0700131LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000132LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700133
Joe Onorato62c220b2017-11-18 20:32:56 -0800134LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
135
David Chend6896892017-10-25 11:49:03 -0700136LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
137 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700138
139LOCAL_MODULE_CLASS := EXECUTABLES
140
yro9b979762018-01-29 16:23:13 -0800141LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700142
143include $(BUILD_EXECUTABLE)
144
Yao Chend54f9dd2017-10-17 17:37:48 +0000145
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700146# ==============
147# statsd_test
148# ==============
149
150include $(CLEAR_VARS)
151
152LOCAL_MODULE := statsd_test
153LOCAL_COMPATIBILITY_SUITE := device-tests
154LOCAL_MODULE_TAGS := tests
155
David Chen1481fe12017-10-16 13:16:34 -0700156LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000157LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700158
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700159LOCAL_CFLAGS += \
160 -Wall \
161 -Werror \
162 -Wno-missing-field-initializers \
163 -Wno-unused-variable \
164 -Wno-unused-function \
165 -Wno-unused-parameter
166
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700167LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000168 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800169 src/atom_field_options.proto \
170 src/atoms.proto \
171 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800172 tests/AlarmMonitor_test.cpp \
173 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700174 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700175 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800176 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000177 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700178 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800180 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800182 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700183 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800184 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800185 tests/condition/CombinationConditionTracker_test.cpp \
186 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800187 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700188 tests/metrics/OringDurationTracker_test.cpp \
189 tests/metrics/MaxDurationTracker_test.cpp \
190 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800191 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800192 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800193 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800194 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800195 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800196 tests/metrics/metrics_test_helper.cpp \
197 tests/statsd_test_util.cpp \
198 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800199 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800200 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800201 tests/e2e/GaugeMetric_e2e_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800202 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
203 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
204 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700205
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700206LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800207 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000208 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700209
Yao Chen9c1debe2018-02-19 14:39:19 -0800210LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000211
Yao Chen9c1debe2018-02-19 14:39:19 -0800212LOCAL_PROTOC_FLAGS := \
213 -Iexternal/protobuf/src
214
215LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
216 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000217
Joe Onorato62c220b2017-11-18 20:32:56 -0800218include $(BUILD_NATIVE_TEST)
219
Yao Chen459dee62018-01-10 16:47:05 -0800220##############################
221# stats proto static java lib
222##############################
223
224include $(CLEAR_VARS)
225LOCAL_MODULE := statsdprotolite
226
227LOCAL_SRC_FILES := \
228 src/stats_log.proto \
Yao Chen9c1debe2018-02-19 14:39:19 -0800229 src/stats_log_common.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800230 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000231 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800232 src/atoms.proto
233
234LOCAL_PROTOC_OPTIMIZE_TYPE := lite
235
236LOCAL_STATIC_JAVA_LIBRARIES := \
237 platformprotoslite
238
Yao Chen9c1debe2018-02-19 14:39:19 -0800239LOCAL_PROTOC_FLAGS := \
240 -Iexternal/protobuf/src
241
Yao Chen459dee62018-01-10 16:47:05 -0800242include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800243
Yao Chen48d75182018-01-23 09:40:48 -0800244##############################
245# statsd micro benchmark
246##############################
247
248include $(CLEAR_VARS)
249LOCAL_MODULE := statsd_benchmark
250
251LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800252 src/atom_field_options.proto \
253 src/atoms.proto \
254 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800255 benchmark/main.cpp \
256 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800257 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800258 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800259 benchmark/filter_value_benchmark.cpp \
260 benchmark/get_dimensions_for_condition_benchmark.cpp \
261 benchmark/metric_util.cpp \
262 benchmark/duration_metric_benchmark.cpp
263
264LOCAL_STATIC_LIBRARIES := \
265 $(statsd_common_static_libraries)
266
267LOCAL_PROTOC_OPTIMIZE_TYPE := full
268
269LOCAL_PROTOC_FLAGS := \
270 -Iexternal/protobuf/src
271
272LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
273 libprotobuf-cpp-full
274
275
276LOCAL_STATIC_JAVA_LIBRARIES := \
277 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800278
279LOCAL_C_INCLUDES := $(statsd_common_c_includes)
280
281LOCAL_CFLAGS := -Wall \
282 -Werror \
283 -Wno-unused-parameter \
284 -Wno-unused-variable \
285 -Wno-unused-function \
286
287# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
288LOCAL_CFLAGS += -Wno-varargs
289
290LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
291
292LOCAL_STATIC_LIBRARIES := \
293 $(statsd_common_static_libraries)
294
295LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800296 libgtest_prod \
297 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800298
Yao Chen48d75182018-01-23 09:40:48 -0800299LOCAL_MODULE_TAGS := eng tests
300
301include $(BUILD_NATIVE_BENCHMARK)
302
303
Yao Chend54f9dd2017-10-17 17:37:48 +0000304statsd_common_src:=
305statsd_common_aidl_includes:=
306statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800307statsd_common_static_libraries:=
308statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700309
Yao Chen1ff4f432017-11-16 17:01:40 -0800310
Yangster13fb7e42018-03-07 17:30:49 -0800311include $(call all-makefiles-under,$(LOCAL_PATH))