Revert^2 "Increase threshold for profile compilation"
Increase threshold for profile compilation
Threshold to trigger compilation based on profiles has been increase
to avoid re-compilation too frequenctly.
Now compilation will take place if methods/classes in the new profile exceeds
by maximum of the following:
- 2% methods/classes in the existing profile.
- 100 methods or 50 classes.
Context for above numbers:
I analyzed profiles on my local device. Average number of methods and classes
in the profiles were 8000 and 2500 respectively.
Also added tests for the same.
Bug: 66732454
Test: test-art-[host|target]-gtest-profile_assistant_test
This reverts commit a660171d8fbf907def7720b2af5e045081f11094.
Change-Id: I5c5f8d76a32900c42cda21052636a8588d28e521
diff --git a/profman/profile_assistant.cc b/profman/profile_assistant.cc
index c238f0d..ff02b5d 100644
--- a/profman/profile_assistant.cc
+++ b/profman/profile_assistant.cc
@@ -23,8 +23,11 @@
// Minimum number of new methods/classes that profiles
// must contain to enable recompilation.
-static constexpr const uint32_t kMinNewMethodsForCompilation = 10;
-static constexpr const uint32_t kMinNewClassesForCompilation = 10;
+static constexpr const uint32_t kMinNewMethodsForCompilation = 100;
+static constexpr const uint32_t kMinNewMethodsPercentChangeForCompilation = 2;
+static constexpr const uint32_t kMinNewClassesForCompilation = 50;
+static constexpr const uint32_t kMinNewClassesPercentChangeForCompilation = 2;
+
ProfileAssistant::ProcessingResult ProfileAssistant::ProcessProfilesInternal(
const std::vector<ScopedFlock>& profile_files,
@@ -55,9 +58,16 @@
}
}
+ uint32_t min_change_in_methods_for_compilation = std::max(
+ (kMinNewMethodsPercentChangeForCompilation * number_of_methods) / 100,
+ kMinNewMethodsForCompilation);
+ uint32_t min_change_in_classes_for_compilation = std::max(
+ (kMinNewClassesPercentChangeForCompilation * number_of_classes) / 100,
+ kMinNewClassesForCompilation);
// Check if there is enough new information added by the current profiles.
- if (((info.GetNumberOfMethods() - number_of_methods) < kMinNewMethodsForCompilation) &&
- ((info.GetNumberOfResolvedClasses() - number_of_classes) < kMinNewClassesForCompilation)) {
+ if (((info.GetNumberOfMethods() - number_of_methods) < min_change_in_methods_for_compilation) &&
+ ((info.GetNumberOfResolvedClasses() - number_of_classes)
+ < min_change_in_classes_for_compilation)) {
return kSkipCompilation;
}