blob: b46c5c1b6372a3270c80a03ef9053051687f86b1 [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 \
Yangster-macd19bcae42018-01-04 15:43:39 -080022 src/statsd_internal.proto \
Joe Onorato62c220b2017-11-18 20:32:56 -080023 src/atoms.proto \
Yangster-mac20877162017-12-22 17:19:39 -080024 src/field_util.cpp \
25 src/stats_log_util.cpp \
26 src/dimension.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070027 src/anomaly/AnomalyMonitor.cpp \
Yangster-mace2cd6d52017-11-09 20:38:30 -080028 src/anomaly/AnomalyTracker.cpp \
Bookatz857aaa52017-12-19 15:29:06 -080029 src/anomaly/DurationAnomalyTracker.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000030 src/condition/CombinationConditionTracker.cpp \
31 src/condition/condition_util.cpp \
32 src/condition/SimpleConditionTracker.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070033 src/condition/ConditionWizard.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 \
Chenjie Yue33bc3b2017-11-06 17:56:44 -080042 src/external/CpuTimePerUidPuller.cpp \
43 src/external/CpuTimePerUidFreqPuller.cpp \
Chenjie Yue72252b2018-02-01 13:19:35 -080044 src/external/KernelUidCpuActiveTimeReader.cpp \
45 src/external/KernelUidCpuClusterTimeReader.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080046 src/external/StatsPullerManagerImpl.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070047 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070048 src/logd/LogListener.cpp \
49 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000050 src/matchers/CombinationLogMatchingTracker.cpp \
51 src/matchers/matcher_util.cpp \
52 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070053 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070054 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000055 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070056 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070057 src/metrics/duration_helper/OringDurationTracker.cpp \
58 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070059 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070060 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000061 src/metrics/MetricsManager.cpp \
62 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070063 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000064 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080065 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000066 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000067 src/StatsService.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080068 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080069 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080070 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080071 src/guardrail/MemoryLeakTrackUtil.cpp \
72 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070073
Yao Chend54f9dd2017-10-17 17:37:48 +000074statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070075 $(LOCAL_PATH)/src \
76 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070077
Yao Chend54f9dd2017-10-17 17:37:48 +000078statsd_common_aidl_includes := \
79 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070080
Joe Onorato62c220b2017-11-18 20:32:56 -080081statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080082 libhealthhalutils \
83 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080084
Yao Chend54f9dd2017-10-17 17:37:48 +000085statsd_common_shared_libraries := \
86 libbase \
87 libbinder \
88 libcutils \
89 libincident \
90 liblog \
91 libselinux \
92 libutils \
93 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070094 libprotoutil \
95 libstatslog \
96 libhardware \
97 libhardware_legacy \
98 libhidlbase \
99 libhidltransport \
100 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -0800101 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -0700102 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800103 android.hardware.power@1.1 \
104 libmemunreachable
Yao Chenab273e22017-09-06 12:53:50 -0700105
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700106# =========
107# statsd
108# =========
109
110include $(CLEAR_VARS)
111
112LOCAL_MODULE := statsd
113
114LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000115 $(statsd_common_src) \
116 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700117
118LOCAL_CFLAGS += \
119 -Wall \
120 -Werror \
121 -Wno-missing-field-initializers \
122 -Wno-unused-variable \
123 -Wno-unused-function \
124 -Wno-unused-parameter
125
126ifeq (debug,)
127 LOCAL_CFLAGS += \
128 -g -O0
129else
130 # optimize for size (protobuf glop can get big)
131 LOCAL_CFLAGS += \
132 -Os
133endif
Yao Chend54f9dd2017-10-17 17:37:48 +0000134LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700135
David Chen1481fe12017-10-16 13:16:34 -0700136LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000137LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700138
Joe Onorato62c220b2017-11-18 20:32:56 -0800139LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
140
David Chend6896892017-10-25 11:49:03 -0700141LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
142 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700143
144LOCAL_MODULE_CLASS := EXECUTABLES
145
yro9b979762018-01-29 16:23:13 -0800146LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700147
148include $(BUILD_EXECUTABLE)
149
Yao Chend54f9dd2017-10-17 17:37:48 +0000150
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700151# ==============
152# statsd_test
153# ==============
154
155include $(CLEAR_VARS)
156
157LOCAL_MODULE := statsd_test
158LOCAL_COMPATIBILITY_SUITE := device-tests
159LOCAL_MODULE_TAGS := tests
160
David Chen1481fe12017-10-16 13:16:34 -0700161LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000162LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700163
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700164LOCAL_CFLAGS += \
165 -Wall \
166 -Werror \
167 -Wno-missing-field-initializers \
168 -Wno-unused-variable \
169 -Wno-unused-function \
170 -Wno-unused-parameter
171
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700172LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 $(statsd_common_src) \
Yangster-mac93694462018-01-22 20:49:31 -0800174 tests/dimension_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700175 tests/AnomalyMonitor_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700176 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700177 tests/ConfigManager_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700179 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800181 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800183 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700184 tests/UidMap_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800185 tests/condition/CombinationConditionTracker_test.cpp \
186 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700187 tests/metrics/OringDurationTracker_test.cpp \
188 tests/metrics/MaxDurationTracker_test.cpp \
189 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800190 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800191 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800192 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800193 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800194 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800195 tests/metrics/metrics_test_helper.cpp \
196 tests/statsd_test_util.cpp \
197 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800198 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800199 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800200 tests/e2e/GaugeMetric_e2e_test.cpp \
201 tests/e2e/DimensionInCondition_e2e_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 Chend54f9dd2017-10-17 17:37:48 +0000207LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
208
209LOCAL_PROTOC_OPTIMIZE_TYPE := lite
210
Joe Onorato62c220b2017-11-18 20:32:56 -0800211include $(BUILD_NATIVE_TEST)
212
Yao Chen459dee62018-01-10 16:47:05 -0800213##############################
214# stats proto static java lib
215##############################
216
217include $(CLEAR_VARS)
218LOCAL_MODULE := statsdprotolite
219
220LOCAL_SRC_FILES := \
221 src/stats_log.proto \
222 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000223 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800224 src/atoms.proto
225
226LOCAL_PROTOC_OPTIMIZE_TYPE := lite
227
228LOCAL_STATIC_JAVA_LIBRARIES := \
229 platformprotoslite
230
231include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800232
Yao Chen48d75182018-01-23 09:40:48 -0800233##############################
234# statsd micro benchmark
235##############################
236
237include $(CLEAR_VARS)
238LOCAL_MODULE := statsd_benchmark
239
240LOCAL_SRC_FILES := $(statsd_common_src) \
241 benchmark/main.cpp \
242 benchmark/hello_world_benchmark.cpp \
243 benchmark/log_event_benchmark.cpp
244
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) \
262 libgtest_prod
263
264LOCAL_PROTOC_OPTIMIZE_TYPE := lite
265
266LOCAL_MODULE_TAGS := eng tests
267
268include $(BUILD_NATIVE_BENCHMARK)
269
270
Yao Chend54f9dd2017-10-17 17:37:48 +0000271statsd_common_src:=
272statsd_common_aidl_includes:=
273statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800274statsd_common_static_libraries:=
275statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700276
Yao Chen1ff4f432017-11-16 17:01:40 -0800277
Yao Chen459dee62018-01-10 16:47:05 -0800278include $(call all-makefiles-under,$(LOCAL_PATH))