blob: 244fbce132ac9e8ca48a901eca96baf280b1d276 [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 \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070024 src/anomaly/AnomalyMonitor.cpp \
Yangster-mace2cd6d52017-11-09 20:38:30 -080025 src/anomaly/AnomalyTracker.cpp \
Bookatz857aaa52017-12-19 15:29:06 -080026 src/anomaly/DurationAnomalyTracker.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000027 src/condition/CombinationConditionTracker.cpp \
28 src/condition/condition_util.cpp \
29 src/condition/SimpleConditionTracker.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070030 src/condition/ConditionWizard.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070031 src/config/ConfigKey.cpp \
32 src/config/ConfigListener.cpp \
33 src/config/ConfigManager.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000034 src/external/Perfetto.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080035 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070036 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080037 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080038 src/external/ResourceHealthManagerPuller.cpp \
Chenjie Yue33bc3b2017-11-06 17:56:44 -080039 src/external/CpuTimePerUidPuller.cpp \
40 src/external/CpuTimePerUidFreqPuller.cpp \
Chenjie Yue72252b2018-02-01 13:19:35 -080041 src/external/KernelUidCpuActiveTimeReader.cpp \
42 src/external/KernelUidCpuClusterTimeReader.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -080043 src/external/StatsPullerManagerImpl.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -080044 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070045 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070046 src/logd/LogListener.cpp \
47 src/logd/LogReader.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 \
Primiano Tuccie4d44912018-01-10 12:14:50 +000062 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080063 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000064 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000065 src/StatsService.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 Chenb3561512017-11-21 18:07:17 -080069 src/guardrail/MemoryLeakTrackUtil.cpp \
70 src/guardrail/StatsdStats.cpp
Yao Chenab273e22017-09-06 12:53:50 -070071
Yao Chend54f9dd2017-10-17 17:37:48 +000072statsd_common_c_includes := \
David Chen1481fe12017-10-16 13:16:34 -070073 $(LOCAL_PATH)/src \
74 $(LOCAL_PATH)/../../libs/services/include
Yao Chenab273e22017-09-06 12:53:50 -070075
Yao Chend54f9dd2017-10-17 17:37:48 +000076statsd_common_aidl_includes := \
77 $(LOCAL_PATH)/../../core/java
Yao Chenab273e22017-09-06 12:53:50 -070078
Joe Onorato62c220b2017-11-18 20:32:56 -080079statsd_common_static_libraries := \
Tej Singhbf972d92018-01-10 20:51:13 -080080 libhealthhalutils \
81 libplatformprotos \
Joe Onorato62c220b2017-11-18 20:32:56 -080082
Yao Chend54f9dd2017-10-17 17:37:48 +000083statsd_common_shared_libraries := \
84 libbase \
85 libbinder \
86 libcutils \
87 libincident \
88 liblog \
89 libselinux \
90 libutils \
91 libservices \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070092 libprotoutil \
93 libstatslog \
94 libhardware \
95 libhardware_legacy \
96 libhidlbase \
97 libhidltransport \
98 libhwbinder \
Tej Singhbf972d92018-01-10 20:51:13 -080099 android.hardware.health@2.0 \
Chenjie Yu5305e1d2017-10-31 13:49:36 -0700100 android.hardware.power@1.0 \
Yao Chen8d9989b2017-11-18 18:54:50 -0800101 android.hardware.power@1.1 \
102 libmemunreachable
Yao Chenab273e22017-09-06 12:53:50 -0700103
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700104# =========
105# statsd
106# =========
107
108include $(CLEAR_VARS)
109
110LOCAL_MODULE := statsd
111
112LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000113 $(statsd_common_src) \
114 src/main.cpp
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700115
116LOCAL_CFLAGS += \
117 -Wall \
Yao Chen4c959cb2018-02-13 13:27:48 -0800118 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700119 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700120 -Wno-unused-parameter
121
122ifeq (debug,)
123 LOCAL_CFLAGS += \
124 -g -O0
125else
126 # optimize for size (protobuf glop can get big)
127 LOCAL_CFLAGS += \
128 -Os
129endif
Yao Chend54f9dd2017-10-17 17:37:48 +0000130LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700131
David Chen1481fe12017-10-16 13:16:34 -0700132LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000133LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700134
Joe Onorato62c220b2017-11-18 20:32:56 -0800135LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
136
David Chend6896892017-10-25 11:49:03 -0700137LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
138 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700139
140LOCAL_MODULE_CLASS := EXECUTABLES
141
yro9b979762018-01-29 16:23:13 -0800142LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700143
144include $(BUILD_EXECUTABLE)
145
Yao Chend54f9dd2017-10-17 17:37:48 +0000146
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700147# ==============
148# statsd_test
149# ==============
150
151include $(CLEAR_VARS)
152
153LOCAL_MODULE := statsd_test
154LOCAL_COMPATIBILITY_SUITE := device-tests
155LOCAL_MODULE_TAGS := tests
156
David Chen1481fe12017-10-16 13:16:34 -0700157LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000158LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700159
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700160LOCAL_CFLAGS += \
161 -Wall \
162 -Werror \
163 -Wno-missing-field-initializers \
164 -Wno-unused-variable \
165 -Wno-unused-function \
166 -Wno-unused-parameter
167
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700168LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000169 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800170 src/atom_field_options.proto \
171 src/atoms.proto \
172 src/stats_log.proto \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700173 tests/AnomalyMonitor_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700174 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700175 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800176 tests/external/puller_util_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 Chen8a8d16c2018-02-08 14:50:40 -0800184 tests/FieldValue_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 Chen9c1debe2018-02-19 14:39:19 -0800207LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000208
Yao Chen9c1debe2018-02-19 14:39:19 -0800209LOCAL_PROTOC_FLAGS := \
210 -Iexternal/protobuf/src
211
212LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
213 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000214
Joe Onorato62c220b2017-11-18 20:32:56 -0800215include $(BUILD_NATIVE_TEST)
216
Yao Chen459dee62018-01-10 16:47:05 -0800217##############################
218# stats proto static java lib
219##############################
220
221include $(CLEAR_VARS)
222LOCAL_MODULE := statsdprotolite
223
224LOCAL_SRC_FILES := \
225 src/stats_log.proto \
Yao Chen9c1debe2018-02-19 14:39:19 -0800226 src/stats_log_common.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800227 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000228 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800229 src/atoms.proto
230
231LOCAL_PROTOC_OPTIMIZE_TYPE := lite
232
233LOCAL_STATIC_JAVA_LIBRARIES := \
234 platformprotoslite
235
Yao Chen9c1debe2018-02-19 14:39:19 -0800236LOCAL_PROTOC_FLAGS := \
237 -Iexternal/protobuf/src
238
Yao Chen459dee62018-01-10 16:47:05 -0800239include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800240
Yao Chen48d75182018-01-23 09:40:48 -0800241##############################
242# statsd micro benchmark
243##############################
244
245include $(CLEAR_VARS)
246LOCAL_MODULE := statsd_benchmark
247
248LOCAL_SRC_FILES := $(statsd_common_src) \
249 benchmark/main.cpp \
250 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800251 benchmark/log_event_benchmark.cpp \
252 benchmark/stats_write_benchmark.cpp
Yao Chen48d75182018-01-23 09:40:48 -0800253
254LOCAL_C_INCLUDES := $(statsd_common_c_includes)
255
256LOCAL_CFLAGS := -Wall \
257 -Werror \
258 -Wno-unused-parameter \
259 -Wno-unused-variable \
260 -Wno-unused-function \
261
262# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
263LOCAL_CFLAGS += -Wno-varargs
264
265LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
266
267LOCAL_STATIC_LIBRARIES := \
268 $(statsd_common_static_libraries)
269
270LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800271 libgtest_prod \
272 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800273
Yao Chen48d75182018-01-23 09:40:48 -0800274LOCAL_MODULE_TAGS := eng tests
275
276include $(BUILD_NATIVE_BENCHMARK)
277
278
Yao Chend54f9dd2017-10-17 17:37:48 +0000279statsd_common_src:=
280statsd_common_aidl_includes:=
281statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800282statsd_common_static_libraries:=
283statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700284
Yao Chen1ff4f432017-11-16 17:01:40 -0800285
Yao Chen459dee62018-01-10 16:47:05 -0800286include $(call all-makefiles-under,$(LOCAL_PATH))