blob: 7720112f5122c67b4e3f01dde748cf330eaa5608 [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 \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070033 src/config/ConfigKey.cpp \
34 src/config/ConfigListener.cpp \
35 src/config/ConfigManager.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000036 src/external/Perfetto.cpp \
Chenjie Yub038b702017-12-18 15:15:34 -080037 src/external/StatsPuller.cpp \
Chenjie Yu5305e1d2017-10-31 13:49:36 -070038 src/external/StatsCompanionServicePuller.cpp \
Chenjie Yuc8b7f222018-01-11 23:25:57 -080039 src/external/SubsystemSleepStatePuller.cpp \
Tej Singhbf972d92018-01-10 20:51:13 -080040 src/external/ResourceHealthManagerPuller.cpp \
Tej Singh40298312018-02-16 00:15:09 -080041 src/external/ResourceThermalManagerPuller.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 \
Chenjie Yu80f91122018-01-31 20:24:50 -080047 src/external/puller_util.cpp \
Joe Onoratoc4dfae52017-10-17 23:38:21 -070048 src/logd/LogEvent.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070049 src/logd/LogListener.cpp \
50 src/logd/LogReader.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000051 src/matchers/CombinationLogMatchingTracker.cpp \
52 src/matchers/matcher_util.cpp \
53 src/matchers/SimpleLogMatchingTracker.cpp \
Yao Chenb7041772017-10-20 16:59:25 -070054 src/metrics/MetricProducer.cpp \
Yao Chen5110bed2017-10-23 12:50:02 -070055 src/metrics/EventMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000056 src/metrics/CountMetricProducer.cpp \
Yao Chen729093d2017-10-16 10:33:26 -070057 src/metrics/DurationMetricProducer.cpp \
Yao Chen5154a372017-10-30 22:57:06 -070058 src/metrics/duration_helper/OringDurationTracker.cpp \
59 src/metrics/duration_helper/MaxDurationTracker.cpp \
Chenjie Yub3dda412017-10-24 13:41:59 -070060 src/metrics/ValueMetricProducer.cpp \
Yangster1d4d6862017-10-31 12:58:51 -070061 src/metrics/GaugeMetricProducer.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000062 src/metrics/MetricsManager.cpp \
63 src/metrics/metrics_manager_util.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -070064 src/packages/UidMap.cpp \
Primiano Tuccie4d44912018-01-10 12:14:50 +000065 src/perfetto/perfetto_config.proto \
yro947fbce2017-11-15 22:50:23 -080066 src/storage/StorageManager.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000067 src/StatsLogProcessor.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +000068 src/StatsService.cpp \
Yi Jinafb36062018-01-31 19:14:25 -080069 src/subscriber/IncidentdReporter.cpp \
Bookatzc6977972018-01-16 16:55:05 -080070 src/subscriber/SubscriberReporter.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -080071 src/HashableDimensionKey.cpp \
Yao Chenb3561512017-11-21 18:07:17 -080072 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 \
Yao Chen20e9e622018-02-28 11:18:51 -0800104 android.hardware.thermal@1.0
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 \
Yao Chen4c959cb2018-02-13 13:27:48 -0800120 -Wextra \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700121 -Werror \
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700122 -Wno-unused-parameter
123
124ifeq (debug,)
125 LOCAL_CFLAGS += \
126 -g -O0
127else
128 # optimize for size (protobuf glop can get big)
129 LOCAL_CFLAGS += \
130 -Os
131endif
Yao Chen20e9e622018-02-28 11:18:51 -0800132LOCAL_PROTOC_OPTIMIZE_TYPE := lite
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700133
David Chen1481fe12017-10-16 13:16:34 -0700134LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000135LOCAL_C_INCLUDES += $(statsd_common_c_includes)
Yao Chenab273e22017-09-06 12:53:50 -0700136
Joe Onorato62c220b2017-11-18 20:32:56 -0800137LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
138
David Chend6896892017-10-25 11:49:03 -0700139LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
140 libgtest_prod
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700141
142LOCAL_MODULE_CLASS := EXECUTABLES
143
yro9b979762018-01-29 16:23:13 -0800144LOCAL_INIT_RC := statsd.rc
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700145
146include $(BUILD_EXECUTABLE)
147
Yao Chend54f9dd2017-10-17 17:37:48 +0000148
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700149# ==============
150# statsd_test
151# ==============
152
153include $(CLEAR_VARS)
154
155LOCAL_MODULE := statsd_test
156LOCAL_COMPATIBILITY_SUITE := device-tests
157LOCAL_MODULE_TAGS := tests
158
David Chen1481fe12017-10-16 13:16:34 -0700159LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
Yao Chend54f9dd2017-10-17 17:37:48 +0000160LOCAL_C_INCLUDES += $(statsd_common_c_includes)
David Chendd896942017-09-26 11:44:40 -0700161
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700162LOCAL_CFLAGS += \
163 -Wall \
164 -Werror \
165 -Wno-missing-field-initializers \
166 -Wno-unused-variable \
167 -Wno-unused-function \
168 -Wno-unused-parameter
169
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700170LOCAL_SRC_FILES := \
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 $(statsd_common_src) \
Yao Chen9c1debe2018-02-19 14:39:19 -0800172 src/atom_field_options.proto \
173 src/atoms.proto \
174 src/stats_log.proto \
Yangster-mac932ecec2018-02-01 10:23:52 -0800175 tests/AlarmMonitor_test.cpp \
176 tests/anomaly/AlarmTracker_test.cpp \
Yang Lu3eba6212017-10-25 19:54:45 -0700177 tests/anomaly/AnomalyTracker_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700178 tests/ConfigManager_test.cpp \
Chenjie Yu80f91122018-01-31 20:24:50 -0800179 tests/external/puller_util_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 tests/indexed_priority_queue_test.cpp \
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700181 tests/LogEntryMatcher_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 tests/LogReader_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800183 tests/LogEvent_test.cpp \
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 tests/MetricsManager_test.cpp \
David Chend9269e22017-12-05 13:43:51 -0800185 tests/StatsLogProcessor_test.cpp \
Yao Chen5154a372017-10-30 22:57:06 -0700186 tests/UidMap_test.cpp \
Yao Chen8a8d16c2018-02-08 14:50:40 -0800187 tests/FieldValue_test.cpp \
Yao Chen967b2052017-11-07 16:36:43 -0800188 tests/condition/CombinationConditionTracker_test.cpp \
189 tests/condition/SimpleConditionTracker_test.cpp \
Yao Chen93fe3a32017-11-02 13:52:59 -0700190 tests/metrics/OringDurationTracker_test.cpp \
191 tests/metrics/MaxDurationTracker_test.cpp \
192 tests/metrics/CountMetricProducer_test.cpp \
Yangsterf2bee6f2017-11-29 12:01:05 -0800193 tests/metrics/DurationMetricProducer_test.cpp \
Chenjie Yu6736c892017-11-09 10:50:09 -0800194 tests/metrics/EventMetricProducer_test.cpp \
Yao Chenb3561512017-11-21 18:07:17 -0800195 tests/metrics/ValueMetricProducer_test.cpp \
Chenjie Yud9dfda72017-12-11 17:41:20 -0800196 tests/metrics/GaugeMetricProducer_test.cpp \
Yao Chend5aa01b32017-12-19 16:46:36 -0800197 tests/guardrail/StatsdStats_test.cpp \
Yangster-mac20877162017-12-22 17:19:39 -0800198 tests/metrics/metrics_test_helper.cpp \
199 tests/statsd_test_util.cpp \
200 tests/e2e/WakelockDuration_e2e_test.cpp \
Yangster-macb5bc7412018-01-06 23:17:45 -0800201 tests/e2e/MetricConditionLink_e2e_test.cpp \
Yangster-mac87718e22018-01-11 16:16:26 -0800202 tests/e2e/Attribution_e2e_test.cpp \
Yangster-mac93694462018-01-22 20:49:31 -0800203 tests/e2e/GaugeMetric_e2e_test.cpp \
204 tests/e2e/DimensionInCondition_e2e_test.cpp
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700205
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700206LOCAL_STATIC_LIBRARIES := \
Joe Onorato62c220b2017-11-18 20:32:56 -0800207 $(statsd_common_static_libraries) \
Yao Chend54f9dd2017-10-17 17:37:48 +0000208 libgmock
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700209
Yao Chen9c1debe2018-02-19 14:39:19 -0800210LOCAL_PROTOC_OPTIMIZE_TYPE := full
Yao Chend54f9dd2017-10-17 17:37:48 +0000211
Yao Chen9c1debe2018-02-19 14:39:19 -0800212LOCAL_PROTOC_FLAGS := \
213 -Iexternal/protobuf/src
214
215LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
216 libprotobuf-cpp-full
Yao Chend54f9dd2017-10-17 17:37:48 +0000217
Joe Onorato62c220b2017-11-18 20:32:56 -0800218include $(BUILD_NATIVE_TEST)
219
Yao Chen459dee62018-01-10 16:47:05 -0800220##############################
221# stats proto static java lib
222##############################
223
224include $(CLEAR_VARS)
225LOCAL_MODULE := statsdprotolite
226
227LOCAL_SRC_FILES := \
228 src/stats_log.proto \
Yao Chen9c1debe2018-02-19 14:39:19 -0800229 src/stats_log_common.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800230 src/statsd_config.proto \
Primiano Tuccie4d44912018-01-10 12:14:50 +0000231 src/perfetto/perfetto_config.proto \
Yao Chen459dee62018-01-10 16:47:05 -0800232 src/atoms.proto
233
234LOCAL_PROTOC_OPTIMIZE_TYPE := lite
235
236LOCAL_STATIC_JAVA_LIBRARIES := \
237 platformprotoslite
238
Yao Chen9c1debe2018-02-19 14:39:19 -0800239LOCAL_PROTOC_FLAGS := \
240 -Iexternal/protobuf/src
241
Yao Chen459dee62018-01-10 16:47:05 -0800242include $(BUILD_STATIC_JAVA_LIBRARY)
Joe Onorato62c220b2017-11-18 20:32:56 -0800243
Yao Chen48d75182018-01-23 09:40:48 -0800244##############################
245# statsd micro benchmark
246##############################
247
248include $(CLEAR_VARS)
249LOCAL_MODULE := statsd_benchmark
250
251LOCAL_SRC_FILES := $(statsd_common_src) \
252 benchmark/main.cpp \
253 benchmark/hello_world_benchmark.cpp \
Tej Singh34106342018-02-02 17:08:05 -0800254 benchmark/log_event_benchmark.cpp \
Yangster-macf5204922018-02-23 13:08:03 -0800255 benchmark/stats_write_benchmark.cpp \
256 benchmark/filter_value_benchmark.cpp
Yao Chen48d75182018-01-23 09:40:48 -0800257
258LOCAL_C_INCLUDES := $(statsd_common_c_includes)
259
260LOCAL_CFLAGS := -Wall \
261 -Werror \
262 -Wno-unused-parameter \
263 -Wno-unused-variable \
264 -Wno-unused-function \
265
266# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
267LOCAL_CFLAGS += -Wno-varargs
268
269LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
270
271LOCAL_STATIC_LIBRARIES := \
272 $(statsd_common_static_libraries)
273
274LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
Tej Singh34106342018-02-02 17:08:05 -0800275 libgtest_prod \
276 libstatslog
Yao Chen48d75182018-01-23 09:40:48 -0800277
Yao Chen48d75182018-01-23 09:40:48 -0800278LOCAL_MODULE_TAGS := eng tests
279
280include $(BUILD_NATIVE_BENCHMARK)
281
282
Yao Chend54f9dd2017-10-17 17:37:48 +0000283statsd_common_src:=
284statsd_common_aidl_includes:=
285statsd_common_c_includes:=
Joe Onorato62c220b2017-11-18 20:32:56 -0800286statsd_common_static_libraries:=
287statsd_common_shared_libraries:=
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700288
Yao Chen1ff4f432017-11-16 17:01:40 -0800289
Yao Chen459dee62018-01-10 16:47:05 -0800290include $(call all-makefiles-under,$(LOCAL_PATH))