Files
android_bootable_recovery/update_verifier/Android.mk
Tao Bao 160514bf2b Load-balancing update_verifier worker threads.
Prior to this CL, the block verification works were assigned based on
the pattern of the ranges, which could lead to unbalanced workloads. This
CL adds RangeSet::Split() and moves update_verifier over.

a) For the following care_map.txt on walleye:
system
20,0,347,348,540,556,32770,33084,98306,98620,163842,164156,229378,229692,294914,295228,524289,524291,524292,524348,529059
vendor
8,0,120,135,32770,32831,94564,98304,98306

Measured the time costs prior to and with this CL with the following
script.

$ cat test_update_verifier.sh
  #!/bin/sh

  adb shell stop
  adb shell "cp /data/local/tmp/care_map.txt /data/ota_package/"
  for i in $(seq 1 50)
  do
    echo "Iteration: $i"
    adb shell "bootctl set-active-boot-slot 0"
    adb shell "echo 3 > /proc/sys/vm/drop_caches"
    adb shell "time /data/local/tmp/update_verifier"
    sleep 3
  done

Without this CL, the average time cost is 5.66s, while with the CL it's
reduced to 3.2s.

b) For the following care_map.txt, measured the performance on marlin:
system
18,0,271,286,457,8350,32770,33022,98306,98558,163842,164094,196609,204800,229378,229630,294914,295166,501547
vendor
10,0,42,44,85,2408,32770,32806,32807,36902,74242

It takes 12.9s and 5.6s without and with the CL respectively.

Fixes: 68553827
Test: recovery_unit_test
Test: Flash new build and trigger update_verifier. Check the balanced
      block verification.
Change-Id: I5fa4bf09a84e6b9b0975ee5f522724464181333f
2017-11-08 23:04:28 -08:00

78 lines
1.8 KiB
Makefile

# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH := $(call my-dir)
# libupdate_verifier (static library)
# ===============================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
update_verifier.cpp
LOCAL_MODULE := libupdate_verifier
LOCAL_STATIC_LIBRARIES := \
libotautil
LOCAL_SHARED_LIBRARIES := \
libbase \
libcutils \
android.hardware.boot@1.0
LOCAL_CFLAGS := -Wall -Werror
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/include
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
LOCAL_CFLAGS += -DPRODUCT_SUPPORTS_VERITY=1
endif
ifeq ($(BOARD_AVB_ENABLE),true)
LOCAL_CFLAGS += -DBOARD_AVB_ENABLE=1
endif
include $(BUILD_STATIC_LIBRARY)
# update_verifier (executable)
# ===============================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
update_verifier_main.cpp
LOCAL_MODULE := update_verifier
LOCAL_STATIC_LIBRARIES := \
libupdate_verifier \
libotautil
LOCAL_SHARED_LIBRARIES := \
libbase \
libcutils \
libhardware \
liblog \
libutils \
libhidlbase \
android.hardware.boot@1.0
LOCAL_CFLAGS := -Wall -Werror
LOCAL_INIT_RC := update_verifier.rc
include $(BUILD_EXECUTABLE)