platform_build/common/math.mk

271 lines
10 KiB
Makefile
Raw Normal View History

#
# Copyright (C) 2017 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.
#
###########################################################
# Basic math functions for non-negative integers <= 100
#
# (SDK versions for example)
###########################################################
__MATH_POS_NUMBERS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
__MATH_NUMBERS := 0 $(__MATH_POS_NUMBERS)
math-error = $(call pretty-error,$(1))
math-expect :=
math-expect-true :=
math-expect :=
math-expect-error :=
# Run the math tests with:
# make -f ${ANDROID_BUILD_TOP}/build/make/core/math.mk RUN_MATH_TESTS=true
# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/core/math.mk RUN_MATH_TESTS=true
ifdef RUN_MATH_TESTS
MATH_TEST_FAILURE :=
MATH_TEST_ERROR :=
math-error = $(if $(MATH_TEST_ERROR),,$(eval MATH_TEST_ERROR:=$(1)))
define math-expect
$(eval got:=$$$1) \
$(if $(subst $(got),,$(2))$(subst $(2),,$(got))$(MATH_TEST_ERROR), \
$(if $(MATH_TEST_ERROR),$(warning $(MATH_TEST_ERROR)),$(warning $$$1 '$(got)' != '$(2)')) \
$(eval MATH_TEST_FAILURE := true)) \
$(eval MATH_TEST_ERROR :=) \
$(eval got:=)
endef
math-expect-true = $(call math-expect,$(1),true)
math-expect-false = $(call math-expect,$(1),)
define math-expect-error
$(eval got:=$$$1) \
$(if $(subst $(MATH_TEST_ERROR),,$(2))$(subst $(2),,$(MATH_TEST_ERROR)), \
$(warning '$(MATH_TEST_ERROR)' != '$(2)') \
$(eval MATH_TEST_FAILURE := true)) \
$(eval MATH_TEST_ERROR :=) \
$(eval got:=)
endef
endif
# Returns true if $(1) is a non-negative integer <= 100, otherwise returns nothing.
define math_is_number
$(strip \
$(if $(1),,$(call math-error,Argument missing)) \
$(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
$(if $(filter $(1),$(__MATH_NUMBERS)),true))
endef
define math_is_zero
$(strip \
$(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
$(if $(filter 0,$(1)),true))
endef
$(call math-expect-true,(call math_is_number,0))
$(call math-expect-true,(call math_is_number,2))
$(call math-expect-false,(call math_is_number,foo))
$(call math-expect-false,(call math_is_number,-1))
$(call math-expect-error,(call math_is_number,1 2),Multiple words in a single argument: 1 2)
$(call math-expect-error,(call math_is_number,no 2),Multiple words in a single argument: no 2)
$(call math-expect-true,(call math_is_zero,0))
$(call math-expect-false,(call math_is_zero,1))
$(call math-expect-false,(call math_is_zero,foo))
$(call math-expect-error,(call math_is_zero,1 2),Multiple words in a single argument: 1 2)
$(call math-expect-error,(call math_is_zero,no 2),Multiple words in a single argument: no 2)
define _math_check_valid
$(if $(call math_is_number,$(1)),,$(call math-error,Only non-negative integers <= 100 are supported (not $(1))))
endef
$(call math-expect,(call _math_check_valid,0))
$(call math-expect,(call _math_check_valid,1))
$(call math-expect,(call _math_check_valid,100))
$(call math-expect-error,(call _math_check_valid,-1),Only non-negative integers <= 100 are supported (not -1))
$(call math-expect-error,(call _math_check_valid,101),Only non-negative integers <= 100 are supported (not 101))
$(call math-expect-error,(call _math_check_valid,),Argument missing)
$(call math-expect-error,(call _math_check_valid,1 2),Multiple words in a single argument: 1 2)
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
# return a list containing integers ranging from [$(1),$(2)]
define int_range_list
$(strip \
$(call _math_check_valid,$(1))$(call _math_check_valid,$(2)) \
$(if $(call math_is_zero,$(1)),0)\
$(wordlist $(if $(call math_is_zero,$(1)),1,$(1)),$(2),$(__MATH_POS_NUMBERS)))
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
endef
$(call math-expect,(call int_range_list,0,1),0 1)
$(call math-expect,(call int_range_list,1,1),1)
$(call math-expect,(call int_range_list,1,2),1 2)
$(call math-expect,(call int_range_list,2,1),)
$(call math-expect-error,(call int_range_list,1,101),Only non-negative integers <= 100 are supported (not 101))
# Returns the greater of $1 or $2.
# If $1 or $2 is not a positive integer <= 100, then an error is generated.
define math_max
$(strip $(call _math_check_valid,$(1)) $(call _math_check_valid,$(2)) \
$(lastword $(filter $(1) $(2),$(__MATH_NUMBERS))))
endef
$(call math-expect-error,(call math_max),Argument missing)
$(call math-expect-error,(call math_max,1),Argument missing)
$(call math-expect-error,(call math_max,1 2,3),Multiple words in a single argument: 1 2)
$(call math-expect,(call math_max,0,1),1)
$(call math-expect,(call math_max,1,0),1)
$(call math-expect,(call math_max,1,1),1)
$(call math-expect,(call math_max,5,42),42)
$(call math-expect,(call math_max,42,5),42)
define math_gt_or_eq
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
endef
define math_lt
$(if $(call math_gt_or_eq,$(1),$(2)),,true)
endef
$(call math-expect-true,(call math_gt_or_eq, 2, 1))
$(call math-expect-true,(call math_gt_or_eq, 1, 1))
$(call math-expect-false,(call math_gt_or_eq, 1, 2))
# $1 is the variable name to increment
define inc_and_print
$(strip $(eval $(1) := $($(1)) .)$(words $($(1))))
endef
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
ifdef RUN_MATH_TESTS
a :=
$(call math-expect,(call inc_and_print,a),1)
$(call math-expect,(call inc_and_print,a),2)
$(call math-expect,(call inc_and_print,a),3)
$(call math-expect,(call inc_and_print,a),4)
endif
# Returns the words in $2 that are numbers and are less than $1
define numbers_less_than
$(strip \
$(foreach n,$2, \
$(if $(call math_is_number,$(n)), \
$(if $(call math_lt,$(n),$(1)), \
$(n)))))
endef
$(call math-expect,(call numbers_less_than,0,0 1 2 3),)
$(call math-expect,(call numbers_less_than,1,0 2 1 3),0)
$(call math-expect,(call numbers_less_than,2,0 2 1 3),0 1)
$(call math-expect,(call numbers_less_than,3,0 2 1 3),0 2 1)
$(call math-expect,(call numbers_less_than,4,0 2 1 3),0 2 1 3)
$(call math-expect,(call numbers_less_than,3,0 2 1 3 2),0 2 1 2)
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
_INT_LIMIT_WORDS := $(foreach a,x x,$(foreach b,x x x x x x x x x x x x x x x x,\
$(foreach c,x x x x x x x x x x x x x x x x,x x x x x x x x x x x x x x x x)))
define _int_encode
$(if $(filter $(words x $(_INT_LIMIT_WORDS)),$(words $(wordlist 1,$(1),x $(_INT_LIMIT_WORDS)))),\
$(call math-error,integer greater than $(words $(_INT_LIMIT_WORDS)) is not supported!),\
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
$(wordlist 1,$(1),$(_INT_LIMIT_WORDS)))
endef
# _int_max returns the maximum of the two arguments
# input: two (x) lists; output: one (x) list
# integer cannot be passed in directly. It has to be converted using _int_encode.
define _int_max
$(subst xx,x,$(join $(1),$(2)))
endef
# first argument is greater than second argument
# output: non-empty if true
# integer cannot be passed in directly. It has to be converted using _int_encode.
define _int_greater-than
$(filter-out $(words $(2)),$(words $(call _int_max,$(1),$(2))))
endef
# first argument equals to second argument
# output: non-empty if true
# integer cannot be passed in directly. It has to be converted using _int_encode.
define _int_equal
$(filter $(words $(1)),$(words $(2)))
endef
# first argument is greater than or equal to second argument
# output: non-empty if true
# integer cannot be passed in directly. It has to be converted using _int_encode.
define _int_greater-or-equal
$(call _int_greater-than,$(1),$(2))$(call _int_equal,$(1),$(2))
endef
define int_plus
$(words $(call _int_encode,$(1)) $(call _int_encode,$(2)))
endef
$(call math-expect,(call int_plus,0,0),0)
$(call math-expect,(call int_plus,0,1),1)
$(call math-expect,(call int_plus,1,0),1)
$(call math-expect,(call int_plus,1,100),101)
$(call math-expect,(call int_plus,100,100),200)
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
define int_subtract
$(strip \
$(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))),\
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
$(words $(filter-out xx,$(join $(call _int_encode,$(1)),$(call _int_encode,$(2))))),\
$(call math-error,subtract underflow $(1) - $(2))))
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
endef
$(call math-expect,(call int_subtract,0,0),0)
$(call math-expect,(call int_subtract,1,0),1)
$(call math-expect,(call int_subtract,1,1),0)
$(call math-expect,(call int_subtract,100,1),99)
$(call math-expect,(call int_subtract,200,100),100)
$(call math-expect-error,(call int_subtract,0,1),subtract underflow 0 - 1)
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
define int_multiply
$(words $(foreach a,$(call _int_encode,$(1)),$(call _int_encode,$(2))))
endef
$(call math-expect,(call int_multiply,0,0),0)
$(call math-expect,(call int_multiply,1,0),0)
$(call math-expect,(call int_multiply,1,1),1)
$(call math-expect,(call int_multiply,100,1),100)
$(call math-expect,(call int_multiply,1,100),100)
$(call math-expect,(call int_multiply,4,100),400)
$(call math-expect,(call int_multiply,100,4),400)
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
define int_divide
$(if $(filter 0,$(2)),$(call math-error,division by zero is not allowed!),$(strip \
Support java compilation sharding for target side. Add "LOCAL_JAVAC_SHARD_SIZE" to represent the number of java source path entries in each shard. Sharding is not allowed when "LOCAL_JAVAC_SHARD_SIZE" and "LOCAL_JAR_PROCESSORS" are both enabled. Limitation: 1. 0 <= LOCAL_JAVAC_SHARD_SIZE <= 8192 1. 0 < NUM(java_sources) <= 8192 2. 0 <= NUM(shards) <= 100 Performance Compare: <Unsharded Build------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 1m2.720s user 5m26.604s sys 0m39.552s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar real 0m37.586s user 5m47.804s sys 0m50.388s <Sharded Build--------------------------------------------------> 1. Build from clean state rm -r -f out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/ && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50----real 1m10.163s user 25m59.008s sys 1m58.460s Javac Shard Size: 100---real 1m2.115s user 21m3.600s sys 1m15.964s Javac Shard Size: 150---real 0m59.520s user 18m10.544s sys 1m12.628s Javac Shard Size: 200---real 0m56.894s user 15m39.244s sys 1m11.608s Javac Shard Size: 250---real 0m55.991s user 14m38.716s sys 1m2.292s Javac Shard Size: 300---real 0m55.114s user 13m6.568s sys 1m8.200s Javac Shard Size: 350---real 0m53.144s user 12m7.740s sys 1m3.836s Javac Shard Size: 400---real 0m54.929s user 12m9.324s sys 1m4.340s Javac Shard Size: 450---real 1m30.194s user 25m31.468s sys 1m52.416s Javac Shard Size: 500---real 0m53.976s user 10m35.500s sys 0m55.160s 2. Incremental build m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar && touch frameworks/base/core/java/android/net/http/HttpResponseCache.java && time m out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar Javac Shard Size: 50-----real 0m16.322s user 1m8.648s sys 0m31.700s Javac Shard Size: 100----real 0m16.163s user 1m22.932s sys 0m29.440s Javac Shard Size: 150----real 0m16.611s user 1m37.828s sys 0m21.168s Javac Shard Size: 200----real 0m16.936s user 1m49.248s sys 0m28.636s Javac Shard Size: 250----real 0m17.509s user 1m54.944s sys 0m32.768s Javac Shard Size: 300----real 0m18.868s user 1m54.088s sys 0m28.824s Javac Shard Size: 350----real 0m17.629s user 1m54.108s sys 0m31.056s Javac Shard Size: 400----real 0m18.658s user 2m7.712s sys 0m30.636s Javac Shard Size: 450----real 0m18.874s user 2m8.808s sys 0m33.540s Javac Shard Size: 500----real 0m19.432s user 2m24.400s sys 0m30.368s time m nothing: real 0m5.799s user 0m7.236s sys 0m3.068s Test: m clean && m -j checkbuild Bug: b/67424047 Change-Id: Id0766d2b7de7c4546d29bbc7f8a0dd0e4b9ad45b
2017-10-05 00:26:06 +08:00
$(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))), \
$(call int_plus,$(call int_divide,$(call int_subtract,$(1),$(2)),$(2)),1),0)))
endef
$(call math-expect,(call int_divide,1,1),1)
$(call math-expect,(call int_divide,200,1),200)
$(call math-expect,(call int_divide,200,3),66)
$(call math-expect,(call int_divide,1,2),0)
$(call math-expect-error,(call int_divide,0,0),division by zero is not allowed!)
$(call math-expect-error,(call int_divide,1,0),division by zero is not allowed!)
ifdef RUN_MATH_TESTS
ifdef MATH_TEST_FAILURE
math-tests:
@echo FAIL
@false
else
math-tests:
@echo PASS
endif
.PHONY: math-tests
endif