blob: b0019ac90708b58fb3e2fc16e68e4f55afbed45f [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 \
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 \
119 -Werror \
120 -Wno-missing-field-initializers \
121 -Wno-unused-variable \
122 -Wno-unused-function \
123 -Wno-unused-parameter
124
125ifeq (debug,)
126 LOCAL_CFLAGS += \
127 -g -O0
128else
129 # optimize for size (protobuf glop can get big)
130 LOCAL_CFLAGS += \
131 -Os
132endif
Yao Chend54f9dd2017-10-17 17:37:48 +0000133LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700134
David Chen1481fe12017-10-16 13:16:34 -0700135LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000136LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700137
Joe Onorato62c220b2017-11-18 20:32:56 -0800138LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
139
David Chend6896892017-10-25 11:49:03 -0700140LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
141 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700142
143LOCAL_MODULE_CLASS := EXECUTABLES
144
yro9b979762018-01-29 16:23:13 -0800145LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700146
147include $(BUILD_EXECUTABLE)
148
Yao Chend54f9dd2017-10-17 17:37:48 +0000149
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700150# ==============
151# statsd_test
152# ==============
153
154include $(CLEAR_VARS)
155
156LOCAL_MODULE := statsd_test
157LOCAL_COMPATIBILITY_SUITE := device-tests
158LOCAL_MODULE_TAGS := tests
159
David Chen1481fe12017-10-16 13:16:34 -0700160LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000161LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700162
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700163LOCAL_CFLAGS += \
164 -Wall \
165 -Werror \
166 -Wno-missing-field-initializers \
167 -Wno-unused-variable \
168 -Wno-unused-function \
169 -Wno-unused-parameter
170
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700171LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 $(statsd_common_src) \
Yangster-mac93694462018-01-22 20:49:31 -0800173 tests/dimension_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700174 tests/AnomalyMonitor_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700175 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700176 tests/ConfigManager_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 Chen967b2052017-11-07 16:36:43 -0800184 tests/condition/CombinationConditionTracker_test.cpp \
185 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700186 tests/metrics/OringDurationTracker_test.cpp \
187 tests/metrics/MaxDurationTracker_test.cpp \
188 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800189 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800190 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800191 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800192 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800193 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800194 tests/metrics/metrics_test_helper.cpp \
195 tests/statsd_test_util.cpp \
196 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800197 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800198 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800199 tests/e2e/GaugeMetric_e2e_test.cpp \
200 tests/e2e/DimensionInCondition_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700201
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700202LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800203 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000204 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700205
Yao Chend54f9dd2017-10-17 17:37:48 +0000206LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
207
208LOCAL_PROTOC_OPTIMIZE_TYPE := lite
209
Joe Onorato62c220b2017-11-18 20:32:56 -0800210include $(BUILD_NATIVE_TEST)
211
Yao Chen459dee62018-01-10 16:47:05 -0800212##############################
213# stats proto static java lib
214##############################
215
216include $(CLEAR_VARS)
217LOCAL_MODULE := statsdprotolite
218
219LOCAL_SRC_FILES := \
220 src/stats_log.proto \
221 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000222 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800223 src/atoms.proto
224
225LOCAL_PROTOC_OPTIMIZE_TYPE := lite
226
227LOCAL_STATIC_JAVA_LIBRARIES := \
228 platformprotoslite
229
230include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800231
Yao Chen48d75182018-01-23 09:40:48 -0800232##############################
233# statsd micro benchmark
234##############################
235
236include $(CLEAR_VARS)
237LOCAL_MODULE := statsd_benchmark
238
239LOCAL_SRC_FILES := $(statsd_common_src) \
240 benchmark/main.cpp \
241 benchmark/hello_world_benchmark.cpp \
242 benchmark/log_event_benchmark.cpp
243
244LOCAL_C_INCLUDES := $(statsd_common_c_includes)
245
246LOCAL_CFLAGS := -Wall \
247 -Werror \
248 -Wno-unused-parameter \
249 -Wno-unused-variable \
250 -Wno-unused-function \
251
252# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
253LOCAL_CFLAGS += -Wno-varargs
254
255LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
256
257LOCAL_STATIC_LIBRARIES := \
258 $(statsd_common_static_libraries)
259
260LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
261 libgtest_prod
262
263LOCAL_PROTOC_OPTIMIZE_TYPE := lite
264
265LOCAL_MODULE_TAGS := eng tests
266
267include $(BUILD_NATIVE_BENCHMARK)
268
269
Yao Chend54f9dd2017-10-17 17:37:48 +0000270statsd_common_src:=
271statsd_common_aidl_includes:=
272statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800273statsd_common_static_libraries:=
274statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700275
Yao Chen1ff4f432017-11-16 17:01:40 -0800276
Yao Chen459dee62018-01-10 16:47:05 -0800277include $(call all-makefiles-under,$(LOCAL_PATH))