Statsd cpu optimizaton

- cache the changed dimensions in condition tracker.
- avoid query condition wizard when unnecessary.
- avoid copy dimension keys in condition key generation.

Test: statsd tests.

BUG: b/73959649
Change-Id: I17d68e2a82643de3f421309841e75f84c6fd8f43
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index 605198f..7f0a26c 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -199,7 +199,9 @@
     tests/e2e/MetricConditionLink_e2e_test.cpp \
     tests/e2e/Attribution_e2e_test.cpp \
     tests/e2e/GaugeMetric_e2e_test.cpp \
-    tests/e2e/DimensionInCondition_e2e_test.cpp
+    tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
+    tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
+    tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp
 
 LOCAL_STATIC_LIBRARIES := \
     $(statsd_common_static_libraries) \
@@ -247,11 +249,32 @@
 LOCAL_MODULE := statsd_benchmark
 
 LOCAL_SRC_FILES := $(statsd_common_src) \
+                    src/atom_field_options.proto \
+                    src/atoms.proto \
+                    src/stats_log.proto \
                    benchmark/main.cpp \
                    benchmark/hello_world_benchmark.cpp \
                    benchmark/log_event_benchmark.cpp \
                    benchmark/stats_write_benchmark.cpp \
-                   benchmark/filter_value_benchmark.cpp
+                   benchmark/filter_value_benchmark.cpp \
+                   benchmark/get_dimensions_for_condition_benchmark.cpp \
+                   benchmark/metric_util.cpp \
+                   benchmark/duration_metric_benchmark.cpp
+
+LOCAL_STATIC_LIBRARIES := \
+    $(statsd_common_static_libraries)
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_PROTOC_FLAGS := \
+    -Iexternal/protobuf/src
+
+LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
+                        libprotobuf-cpp-full
+
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    platformprotoslite
 
 LOCAL_C_INCLUDES := $(statsd_common_c_includes)
 
@@ -285,4 +308,4 @@
 statsd_common_shared_libraries:=
 
 
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file