blob: f6b0db80f3ad82791c06cee7a6e85cbba512bb41 [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 \
Andreas Gampe48f98322018-05-08 10:34:55 -070038 src/external/Perfprofd.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080039 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070040 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080041 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080042 src/external/ResourceHealthManagerPuller.cpp \
Tej Singh40298312018-02-16 00:15:09 -080043 src/external/ResourceThermalManagerPuller.cpp \
Chenjie Yue2219202018-06-08 10:07:51 -070044 src/external/StatsPullerManager.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -080045 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070046 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070047 src/logd/LogListener.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 \
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 Chen49954cd2018-04-18 13:48:02 -070069 src/guardrail/StatsdStats.cpp \
Yao Chena80e5c02018-09-04 13:55:29 -070070 src/socket/StatsSocketListener.cpp \
71 src/shell/ShellSubscriber.cpp \
72 src/shell/shell_config.proto
Yao Chenab273e22017-09-06 12:53:50 -070073
Yao Chen5bfffb52018-06-21 16:58:51 -070074# TODO(b/110563449): Once statsd is using a blueprint file, migrate to the proper filegroups.
Andreas Gampeca1fb022018-05-07 09:10:21 -070075statsd_common_src += \
Primiano Tucci65c72fc2018-07-17 16:53:14 +010076 ../../../../system/extras/perfprofd/binder_interface/aidl/android/os/IPerfProfd.aidl
Andreas Gampeca1fb022018-05-07 09:10:21 -070077
Yao Chend54f9dd2017-10-17 17:37:48 +000078statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070079 $(LOCAL_PATH)/src \
80 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070081
Yao Chend54f9dd2017-10-17 17:37:48 +000082statsd_common_aidl_includes := \
83 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070084
Joe Onorato62c220b2017-11-18 20:32:56 -080085statsd_common_static_libraries := \
Howard Rocb767f62018-06-19 19:58:05 -070086 libhealthhalutils
Joe Onorato62c220b2017-11-18 20:32:56 -080087
Yao Chend54f9dd2017-10-17 17:37:48 +000088statsd_common_shared_libraries := \
89 libbase \
90 libbinder \
Yao Chend54f9dd2017-10-17 17:37:48 +000091 libincident \
92 liblog \
Yao Chend54f9dd2017-10-17 17:37:48 +000093 libutils \
94 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070095 libprotoutil \
96 libstatslog \
97 libhardware \
98 libhardware_legacy \
99 libhidlbase \
100 libhidltransport \
101 libhwbinder \
Howard Roa46b6582018-09-18 16:45:02 -0700102 android.frameworks.stats@1.0 \
Tej Singhbf972d92018-01-10 20:51:13 -0800103 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -0700104 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800105 android.hardware.power@1.1 \
Yao Chen49954cd2018-04-18 13:48:02 -0700106 android.hardware.thermal@1.0 \
107 libpackagelistparser \
108 libsysutils \
109 libcutils
Yao Chenab273e22017-09-06 12:53:50 -0700110
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700111# =========
112# statsd
113# =========
114
115include $(CLEAR_VARS)
116
117LOCAL_MODULE := statsd
118
119LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000120 $(statsd_common_src) \
121 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700122
123LOCAL_CFLAGS += \
124 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800125 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700126 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700127 -Wno-unused-parameter
128
129ifeq (debug,)
130 LOCAL_CFLAGS += \
131 -g -O0
132else
133 # optimize for size (protobuf glop can get big)
134 LOCAL_CFLAGS += \
135 -Os
136endif
Yao Chen20e9e622018-02-28 11:18:51 -0800137LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700138
David Chen1481fe12017-10-16 13:16:34 -0700139LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000140LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700141
Joe Onorato62c220b2017-11-18 20:32:56 -0800142LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
143
David Chend6896892017-10-25 11:49:03 -0700144LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
145 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700146
147LOCAL_MODULE_CLASS := EXECUTABLES
148
Yao Chen980333c2018-05-30 09:03:17 -0700149# Enable sanitizer ONLY on eng builds.
Yao Chen2cc4b4a2018-09-24 14:35:29 -0700150#ifeq ($(TARGET_BUILD_VARIANT),eng)
151# LOCAL_CLANG := true
152# LOCAL_SANITIZE := address
153#endif
Yao Chen980333c2018-05-30 09:03:17 -0700154
155# Add a flag to enable stats log printing from statsd on debug builds.
156ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
Yao Chen876889c2018-05-02 11:16:16 -0700157 LOCAL_CFLAGS += \
158 -DVERY_VERBOSE_PRINTING
Yao Chencd7f9002018-03-21 11:00:53 -0700159endif
160
yro9b979762018-01-29 16:23:13 -0800161LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700162
163include $(BUILD_EXECUTABLE)
164
Yao Chend54f9dd2017-10-17 17:37:48 +0000165
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700166# ==============
167# statsd_test
168# ==============
169
170include $(CLEAR_VARS)
171
172LOCAL_MODULE := statsd_test
173LOCAL_COMPATIBILITY_SUITE := device-tests
174LOCAL_MODULE_TAGS := tests
175
David Chen1481fe12017-10-16 13:16:34 -0700176LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000177LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700178
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700179LOCAL_CFLAGS += \
180 -Wall \
181 -Werror \
182 -Wno-missing-field-initializers \
183 -Wno-unused-variable \
184 -Wno-unused-function \
185 -Wno-unused-parameter
186
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700187LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000188 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800189 src/atom_field_options.proto \
190 src/atoms.proto \
191 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800192 tests/AlarmMonitor_test.cpp \
193 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700194 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700195 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800196 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000197 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700198 tests/LogEntryMatcher_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800199 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000200 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800201 tests/StatsLogProcessor_test.cpp \
David Chen9fdd4032018-03-20 14:38:56 -0700202 tests/StatsService_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700203 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800204 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800205 tests/condition/CombinationConditionTracker_test.cpp \
206 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800207 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700208 tests/metrics/OringDurationTracker_test.cpp \
209 tests/metrics/MaxDurationTracker_test.cpp \
210 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800211 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800212 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800213 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800214 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800215 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800216 tests/metrics/metrics_test_helper.cpp \
217 tests/statsd_test_util.cpp \
218 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800219 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac684d1952018-03-24 16:47:16 -0700220 tests/e2e/Alarm_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800221 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac3fa5d7f2018-03-10 21:50:27 -0800222 tests/e2e/GaugeMetric_e2e_push_test.cpp \
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700223 tests/e2e/GaugeMetric_e2e_pull_test.cpp \
224 tests/e2e/ValueMetric_pull_e2e_test.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800225 tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
226 tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
Yangster-macbe10ddf2018-03-13 15:39:51 -0700227 tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp \
228 tests/e2e/Anomaly_count_e2e_test.cpp \
Yangster-macb142cc82018-03-30 15:22:08 -0700229 tests/e2e/Anomaly_duration_sum_e2e_test.cpp \
David Chenbd125272018-04-04 19:02:50 -0700230 tests/e2e/ConfigTtl_e2e_test.cpp \
Yao Chen398dd192018-10-01 14:49:03 -0700231 tests/e2e/PartialBucket_e2e_test.cpp \
232 tests/shell/ShellSubscriber_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700233
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700234LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800235 $(statsd_common_static_libraries) \
Howard Rocb767f62018-06-19 19:58:05 -0700236 libgmock \
Howard Rocb767f62018-06-19 19:58:05 -0700237 libplatformprotos
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700238
Yao Chen9c1debe2018-02-19 14:39:19 -0800239LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000240
Yao Chen9c1debe2018-02-19 14:39:19 -0800241LOCAL_PROTOC_FLAGS := \
242 -Iexternal/protobuf/src
243
244LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
245 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000246
Joe Onorato62c220b2017-11-18 20:32:56 -0800247include $(BUILD_NATIVE_TEST)
248
Yao Chen459dee62018-01-10 16:47:05 -0800249##############################
Yao Chen48d75182018-01-23 09:40:48 -0800250# statsd micro benchmark
251##############################
252
253include $(CLEAR_VARS)
254LOCAL_MODULE := statsd_benchmark
255
256LOCAL_SRC_FILES := $(statsd_common_src) \
Yangster13fb7e42018-03-07 17:30:49 -0800257 src/atom_field_options.proto \
258 src/atoms.proto \
259 src/stats_log.proto \
Yao Chen48d75182018-01-23 09:40:48 -0800260 benchmark/main.cpp \
261 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800262 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800263 benchmark/stats_write_benchmark.cpp \
Yangster13fb7e42018-03-07 17:30:49 -0800264 benchmark/filter_value_benchmark.cpp \
265 benchmark/get_dimensions_for_condition_benchmark.cpp \
266 benchmark/metric_util.cpp \
267 benchmark/duration_metric_benchmark.cpp
268
269LOCAL_STATIC_LIBRARIES := \
270 $(statsd_common_static_libraries)
271
272LOCAL_PROTOC_OPTIMIZE_TYPE := full
273
274LOCAL_PROTOC_FLAGS := \
275 -Iexternal/protobuf/src
276
277LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
278 libprotobuf-cpp-full
279
Yangster13fb7e42018-03-07 17:30:49 -0800280LOCAL_STATIC_JAVA_LIBRARIES := \
281 platformprotoslite
Yao Chen48d75182018-01-23 09:40:48 -0800282
283LOCAL_C_INCLUDES := $(statsd_common_c_includes)
284
285LOCAL_CFLAGS := -Wall \
286 -Werror \
287 -Wno-unused-parameter \
288 -Wno-unused-variable \
289 -Wno-unused-function \
290
291# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
292LOCAL_CFLAGS += -Wno-varargs
293
294LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
295
296LOCAL_STATIC_LIBRARIES := \
Howard Rocb767f62018-06-19 19:58:05 -0700297 $(statsd_common_static_libraries) \
Howard Rocb767f62018-06-19 19:58:05 -0700298 libplatformprotos
Yao Chen48d75182018-01-23 09:40:48 -0800299
300LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800301 libgtest_prod \
302 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800303
Yao Chen48d75182018-01-23 09:40:48 -0800304LOCAL_MODULE_TAGS := eng tests
305
306include $(BUILD_NATIVE_BENCHMARK)
307
308
Yao Chend54f9dd2017-10-17 17:37:48 +0000309statsd_common_src:=
310statsd_common_aidl_includes:=
311statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800312statsd_common_static_libraries:=
313statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700314
Yao Chen1ff4f432017-11-16 17:01:40 -0800315
Yao Chenb19425e2018-03-08 14:38:12 -0800316include $(call all-makefiles-under,$(LOCAL_PATH))