blob: 5873942952e81ebc8ce5d0a1774bb75ee3a5f739 [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 Yue33bc3b2017-11-06 17:56:44 -080043 src/external/CpuTimePerUidPuller.cpp \
44 src/external/CpuTimePerUidFreqPuller.cpp \
Chenjie Yue72252b2018-02-01 13:19:35 -080045 src/external/KernelUidCpuActiveTimeReader.cpp \
46 src/external/KernelUidCpuClusterTimeReader.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080047 src/external/StatsPullerManagerImpl.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -080048 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070049 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070050 src/logd/LogListener.cpp \
51 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000052 src/matchers/CombinationLogMatchingTracker.cpp \
53 src/matchers/matcher_util.cpp \
54 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070055 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070056 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000057 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070058 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070059 src/metrics/duration_helper/OringDurationTracker.cpp \
60 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070061 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070062 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000063 src/metrics/MetricsManager.cpp \
64 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070065 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000066 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080067 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000068 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000069 src/StatsService.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080070 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080071 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080072 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080073 src/guardrail/MemoryLeakTrackUtil.cpp \
74 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070075
Yao Chend54f9dd2017-10-17 17:37:48 +000076statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070077 $(LOCAL_PATH)/src \
78 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070079
Yao Chend54f9dd2017-10-17 17:37:48 +000080statsd_common_aidl_includes := \
81 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070082
Joe Onorato62c220b2017-11-18 20:32:56 -080083statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080084 libhealthhalutils \
85 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080086
Yao Chend54f9dd2017-10-17 17:37:48 +000087statsd_common_shared_libraries := \
88 libbase \
89 libbinder \
90 libcutils \
91 libincident \
92 liblog \
93 libselinux \
94 libutils \
95 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070096 libprotoutil \
97 libstatslog \
98 libhardware \
99 libhardware_legacy \
100 libhidlbase \
101 libhidltransport \
102 libhwbinder \
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 \
Tej Singh40298312018-02-16 00:15:09 -0800106 android.hardware.thermal@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800107 libmemunreachable
Yao Chenab273e22017-09-06 12:53:50 -0700108
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700109# =========
110# statsd
111# =========
112
113include $(CLEAR_VARS)
114
115LOCAL_MODULE := statsd
116
117LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000118 $(statsd_common_src) \
119 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700120
121LOCAL_CFLAGS += \
122 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800123 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700124 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700125 -Wno-unused-parameter
126
127ifeq (debug,)
128 LOCAL_CFLAGS += \
129 -g -O0
130else
131 # optimize for size (protobuf glop can get big)
132 LOCAL_CFLAGS += \
133 -Os
134endif
Yao Chend54f9dd2017-10-17 17:37:48 +0000135LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700136
David Chen1481fe12017-10-16 13:16:34 -0700137LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000138LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700139
Joe Onorato62c220b2017-11-18 20:32:56 -0800140LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
141
David Chend6896892017-10-25 11:49:03 -0700142LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
143 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700144
145LOCAL_MODULE_CLASS := EXECUTABLES
146
yro9b979762018-01-29 16:23:13 -0800147LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700148
149include $(BUILD_EXECUTABLE)
150
Yao Chend54f9dd2017-10-17 17:37:48 +0000151
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700152# ==============
153# statsd_test
154# ==============
155
156include $(CLEAR_VARS)
157
158LOCAL_MODULE := statsd_test
159LOCAL_COMPATIBILITY_SUITE := device-tests
160LOCAL_MODULE_TAGS := tests
161
David Chen1481fe12017-10-16 13:16:34 -0700162LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000163LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700164
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700165LOCAL_CFLAGS += \
166 -Wall \
167 -Werror \
168 -Wno-missing-field-initializers \
169 -Wno-unused-variable \
170 -Wno-unused-function \
171 -Wno-unused-parameter
172
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700173LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000174 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800175 src/atom_field_options.proto \
176 src/atoms.proto \
177 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800178 tests/AlarmMonitor_test.cpp \
179 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700180 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700181 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800182 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700184 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000185 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800186 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000187 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800188 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700189 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800190 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800191 tests/condition/CombinationConditionTracker_test.cpp \
192 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen580ea3212018-02-26 14:21:54 -0800193 tests/condition/StateTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700194 tests/metrics/OringDurationTracker_test.cpp \
195 tests/metrics/MaxDurationTracker_test.cpp \
196 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800197 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800198 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800199 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800200 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800201 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800202 tests/metrics/metrics_test_helper.cpp \
203 tests/statsd_test_util.cpp \
204 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800205 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800206 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800207 tests/e2e/GaugeMetric_e2e_test.cpp \
208 tests/e2e/DimensionInCondition_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700209
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700210LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800211 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000212 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700213
Yao Chen9c1debe2018-02-19 14:39:19 -0800214LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000215
Yao Chen9c1debe2018-02-19 14:39:19 -0800216LOCAL_PROTOC_FLAGS := \
217 -Iexternal/protobuf/src
218
219LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
220 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000221
Joe Onorato62c220b2017-11-18 20:32:56 -0800222include $(BUILD_NATIVE_TEST)
223
Yao Chen459dee62018-01-10 16:47:05 -0800224##############################
225# stats proto static java lib
226##############################
227
228include $(CLEAR_VARS)
229LOCAL_MODULE := statsdprotolite
230
231LOCAL_SRC_FILES := \
232 src/stats_log.proto \
Yao Chen9c1debe2018-02-19 14:39:19 -0800233 src/stats_log_common.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800234 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000235 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800236 src/atoms.proto
237
238LOCAL_PROTOC_OPTIMIZE_TYPE := lite
239
240LOCAL_STATIC_JAVA_LIBRARIES := \
241 platformprotoslite
242
Yao Chen9c1debe2018-02-19 14:39:19 -0800243LOCAL_PROTOC_FLAGS := \
244 -Iexternal/protobuf/src
245
Yao Chen459dee62018-01-10 16:47:05 -0800246include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800247
Yao Chen48d75182018-01-23 09:40:48 -0800248##############################
249# statsd micro benchmark
250##############################
251
252include $(CLEAR_VARS)
253LOCAL_MODULE := statsd_benchmark
254
255LOCAL_SRC_FILES := $(statsd_common_src) \
256 benchmark/main.cpp \
257 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800258 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800259 benchmark/stats_write_benchmark.cpp \
260 benchmark/filter_value_benchmark.cpp
Yao Chen48d75182018-01-23 09:40:48 -0800261
262LOCAL_C_INCLUDES := $(statsd_common_c_includes)
263
264LOCAL_CFLAGS := -Wall \
265 -Werror \
266 -Wno-unused-parameter \
267 -Wno-unused-variable \
268 -Wno-unused-function \
269
270# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
271LOCAL_CFLAGS += -Wno-varargs
272
273LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
274
275LOCAL_STATIC_LIBRARIES := \
276 $(statsd_common_static_libraries)
277
278LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800279 libgtest_prod \
280 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800281
Yao Chen48d75182018-01-23 09:40:48 -0800282LOCAL_MODULE_TAGS := eng tests
283
284include $(BUILD_NATIVE_BENCHMARK)
285
286
Yao Chend54f9dd2017-10-17 17:37:48 +0000287statsd_common_src:=
288statsd_common_aidl_includes:=
289statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800290statsd_common_static_libraries:=
291statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700292
Yao Chen1ff4f432017-11-16 17:01:40 -0800293
Yao Chen459dee62018-01-10 16:47:05 -0800294include $(call all-makefiles-under,$(LOCAL_PATH))