blob: dbcc888399dcbb9c5f3f679b8fc082953408073b [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 \
20 src/stats_log.proto \
21 src/statsd_config.proto \
Joe Onorato62c220b2017-11-18 20:32:56 -080022 src/atoms.proto \
Yao Chen8a8d16c2018-02-08 14:50:40 -080023 src/FieldValue.cpp \
Yangster-mac20877162017-12-22 17:19:39 -080024 src/stats_log_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070025 src/anomaly/AnomalyMonitor.cpp \
Yangster-mace2cd6d52017-11-09 20:38:30 -080026 src/anomaly/AnomalyTracker.cpp \
Bookatz857aaa52017-12-19 15:29:06 -080027 src/anomaly/DurationAnomalyTracker.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 \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070032 src/config/ConfigKey.cpp \
33 src/config/ConfigListener.cpp \
34 src/config/ConfigManager.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000035 src/external/Perfetto.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080036 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070037 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080038 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080039 src/external/ResourceHealthManagerPuller.cpp \
Chenjie Yue33bc3b2017-11-06 17:56:44 -080040 src/external/CpuTimePerUidPuller.cpp \
41 src/external/CpuTimePerUidFreqPuller.cpp \
Chenjie Yue72252b2018-02-01 13:19:35 -080042 src/external/KernelUidCpuActiveTimeReader.cpp \
43 src/external/KernelUidCpuClusterTimeReader.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080044 src/external/StatsPullerManagerImpl.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 \
48 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000049 src/matchers/CombinationLogMatchingTracker.cpp \
50 src/matchers/matcher_util.cpp \
51 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070052 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070053 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000054 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070055 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070056 src/metrics/duration_helper/OringDurationTracker.cpp \
57 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070058 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070059 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000060 src/metrics/MetricsManager.cpp \
61 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070062 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000063 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080064 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000065 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000066 src/StatsService.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080067 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080068 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080069 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080070 src/guardrail/MemoryLeakTrackUtil.cpp \
71 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070072
Yao Chend54f9dd2017-10-17 17:37:48 +000073statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070074 $(LOCAL_PATH)/src \
75 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070076
Yao Chend54f9dd2017-10-17 17:37:48 +000077statsd_common_aidl_includes := \
78 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070079
Joe Onorato62c220b2017-11-18 20:32:56 -080080statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080081 libhealthhalutils \
82 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080083
Yao Chend54f9dd2017-10-17 17:37:48 +000084statsd_common_shared_libraries := \
85 libbase \
86 libbinder \
87 libcutils \
88 libincident \
89 liblog \
90 libselinux \
91 libutils \
92 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070093 libprotoutil \
94 libstatslog \
95 libhardware \
96 libhardware_legacy \
97 libhidlbase \
98 libhidltransport \
99 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -0800100 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -0700101 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800102 android.hardware.power@1.1 \
103 libmemunreachable
Yao Chenab273e22017-09-06 12:53:50 -0700104
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700105# =========
106# statsd
107# =========
108
109include $(CLEAR_VARS)
110
111LOCAL_MODULE := statsd
112
113LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000114 $(statsd_common_src) \
115 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700116
117LOCAL_CFLAGS += \
118 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800119 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700120 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700121 -Wno-unused-parameter
122
123ifeq (debug,)
124 LOCAL_CFLAGS += \
125 -g -O0
126else
127 # optimize for size (protobuf glop can get big)
128 LOCAL_CFLAGS += \
129 -Os
130endif
Yao Chend54f9dd2017-10-17 17:37:48 +0000131LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700132
David Chen1481fe12017-10-16 13:16:34 -0700133LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000134LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700135
Joe Onorato62c220b2017-11-18 20:32:56 -0800136LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
137
David Chend6896892017-10-25 11:49:03 -0700138LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
139 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700140
141LOCAL_MODULE_CLASS := EXECUTABLES
142
yro9b979762018-01-29 16:23:13 -0800143LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700144
145include $(BUILD_EXECUTABLE)
146
Yao Chend54f9dd2017-10-17 17:37:48 +0000147
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700148# ==============
149# statsd_test
150# ==============
151
152include $(CLEAR_VARS)
153
154LOCAL_MODULE := statsd_test
155LOCAL_COMPATIBILITY_SUITE := device-tests
156LOCAL_MODULE_TAGS := tests
157
David Chen1481fe12017-10-16 13:16:34 -0700158LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000159LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700160
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700161LOCAL_CFLAGS += \
162 -Wall \
163 -Werror \
164 -Wno-missing-field-initializers \
165 -Wno-unused-variable \
166 -Wno-unused-function \
167 -Wno-unused-parameter
168
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700169LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 $(statsd_common_src) \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700171 tests/AnomalyMonitor_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 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-mac93694462018-01-22 20:49:31 -0800198 tests/e2e/GaugeMetric_e2e_test.cpp \
199 tests/e2e/DimensionInCondition_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700200
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700201LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800202 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000203 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700204
Yao Chend54f9dd2017-10-17 17:37:48 +0000205LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
206
207LOCAL_PROTOC_OPTIMIZE_TYPE := lite
208
Joe Onorato62c220b2017-11-18 20:32:56 -0800209include $(BUILD_NATIVE_TEST)
210
Yao Chen459dee62018-01-10 16:47:05 -0800211##############################
212# stats proto static java lib
213##############################
214
215include $(CLEAR_VARS)
216LOCAL_MODULE := statsdprotolite
217
218LOCAL_SRC_FILES := \
219 src/stats_log.proto \
220 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000221 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800222 src/atoms.proto
223
224LOCAL_PROTOC_OPTIMIZE_TYPE := lite
225
226LOCAL_STATIC_JAVA_LIBRARIES := \
227 platformprotoslite
228
229include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800230
Yao Chen48d75182018-01-23 09:40:48 -0800231##############################
232# statsd micro benchmark
233##############################
234
235include $(CLEAR_VARS)
236LOCAL_MODULE := statsd_benchmark
237
238LOCAL_SRC_FILES := $(statsd_common_src) \
239 benchmark/main.cpp \
240 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800241 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800242 benchmark/stats_write_benchmark.cpp \
243 benchmark/filter_value_benchmark.cpp
Yao Chen48d75182018-01-23 09:40:48 -0800244
245LOCAL_C_INCLUDES := $(statsd_common_c_includes)
246
247LOCAL_CFLAGS := -Wall \
248 -Werror \
249 -Wno-unused-parameter \
250 -Wno-unused-variable \
251 -Wno-unused-function \
252
253# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
254LOCAL_CFLAGS += -Wno-varargs
255
256LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
257
258LOCAL_STATIC_LIBRARIES := \
259 $(statsd_common_static_libraries)
260
261LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800262 libgtest_prod \
263 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800264
265LOCAL_PROTOC_OPTIMIZE_TYPE := lite
266
267LOCAL_MODULE_TAGS := eng tests
268
269include $(BUILD_NATIVE_BENCHMARK)
270
271
Yao Chend54f9dd2017-10-17 17:37:48 +0000272statsd_common_src:=
273statsd_common_aidl_includes:=
274statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800275statsd_common_static_libraries:=
276statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700277
Yao Chen1ff4f432017-11-16 17:01:40 -0800278
Yao Chen459dee62018-01-10 16:47:05 -0800279include $(call all-makefiles-under,$(LOCAL_PATH))