profman: Change the default new min methods/classes percent change
for compilation to 20%.

Bug: 172490638
Test: run art_profman_tests
Change-Id: I771c8b99867fd11161ba3bdf5a2e3fa337abafa8
diff --git a/profman/profile_assistant.h b/profman/profile_assistant.h
index 60641cd..12233e7 100644
--- a/profman/profile_assistant.h
+++ b/profman/profile_assistant.h
@@ -43,8 +43,8 @@
    public:
     static constexpr bool kForceMergeDefault = false;
     static constexpr bool kBootImageMergeDefault = false;
-    static constexpr uint32_t kMinNewMethodsPercentChangeForCompilation = 2;
-    static constexpr uint32_t kMinNewClassesPercentChangeForCompilation = 2;
+    static constexpr uint32_t kMinNewMethodsPercentChangeForCompilation = 20;
+    static constexpr uint32_t kMinNewClassesPercentChangeForCompilation = 20;
 
     Options()
         : force_merge_(kForceMergeDefault),
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index 39a25e3..1fca494 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -561,25 +561,7 @@
 TEST_F(ProfileAssistantTest, DoNotAdviseCompilationMethodPercentage) {
   const uint16_t kNumberOfMethodsInRefProfile = 6000;
   const uint16_t kNumberOfMethodsInCurProfile = 6100;  // Threshold is 2%.
-  // We should not advise compilation.
-  ASSERT_EQ(ProfileAssistant::kSkipCompilation,
-            CheckCompilationMethodPercentChange(kNumberOfMethodsInCurProfile,
-                                                kNumberOfMethodsInRefProfile));
-}
-
-TEST_F(ProfileAssistantTest, ShouldAdviseCompilationMethodPercentage) {
-  const uint16_t kNumberOfMethodsInRefProfile = 6000;
-  const uint16_t kNumberOfMethodsInCurProfile = 6200;  // Threshold is 2%.
-  // We should advise compilation.
-  ASSERT_EQ(ProfileAssistant::kCompile,
-            CheckCompilationMethodPercentChange(kNumberOfMethodsInCurProfile,
-                                                kNumberOfMethodsInRefProfile));
-}
-
-TEST_F(ProfileAssistantTest, DoNotAdviseCompilationMethodPercentageWithNewMin) {
-  const uint16_t kNumberOfMethodsInRefProfile = 6000;
-  const uint16_t kNumberOfMethodsInCurProfile = 6200;  // Threshold is 20%.
-  std::vector<const std::string> extra_args({"--min-new-methods-percent-change=20"});
+  std::vector<const std::string> extra_args({"--min-new-methods-percent-change=2"});
 
   // We should not advise compilation.
   ASSERT_EQ(ProfileAssistant::kSkipCompilation,
@@ -588,28 +570,32 @@
                                                 extra_args));
 }
 
+TEST_F(ProfileAssistantTest, ShouldAdviseCompilationMethodPercentage) {
+  const uint16_t kNumberOfMethodsInRefProfile = 6000;
+  const uint16_t kNumberOfMethodsInCurProfile = 6200;  // Threshold is 2%.
+  std::vector<const std::string> extra_args({"--min-new-methods-percent-change=2"});
+
+  // We should advise compilation.
+  ASSERT_EQ(ProfileAssistant::kCompile,
+            CheckCompilationMethodPercentChange(kNumberOfMethodsInCurProfile,
+                                                kNumberOfMethodsInRefProfile,
+                                                extra_args));
+}
+
+TEST_F(ProfileAssistantTest, DoNotAdviseCompilationMethodPercentageWithNewMin) {
+  const uint16_t kNumberOfMethodsInRefProfile = 6000;
+  const uint16_t kNumberOfMethodsInCurProfile = 6200;  // Threshold is 20%.
+
+  // We should not advise compilation.
+  ASSERT_EQ(ProfileAssistant::kSkipCompilation,
+            CheckCompilationMethodPercentChange(kNumberOfMethodsInCurProfile,
+                                                kNumberOfMethodsInRefProfile));
+}
+
 TEST_F(ProfileAssistantTest, DoNotdviseCompilationClassPercentage) {
   const uint16_t kNumberOfClassesInRefProfile = 6000;
   const uint16_t kNumberOfClassesInCurProfile = 6110;  // Threshold is 2%.
-  // We should not advise compilation.
-  ASSERT_EQ(ProfileAssistant::kSkipCompilation,
-            CheckCompilationClassPercentChange(kNumberOfClassesInCurProfile,
-                                               kNumberOfClassesInRefProfile));
-}
-
-TEST_F(ProfileAssistantTest, ShouldAdviseCompilationClassPercentage) {
-  const uint16_t kNumberOfClassesInRefProfile = 6000;
-  const uint16_t kNumberOfClassesInCurProfile = 6120;  // Threshold is 2%.
-  // We should advise compilation.
-  ASSERT_EQ(ProfileAssistant::kCompile,
-            CheckCompilationClassPercentChange(kNumberOfClassesInCurProfile,
-                                               kNumberOfClassesInRefProfile));
-}
-
-TEST_F(ProfileAssistantTest, DoNotAdviseCompilationClassPercentageWithNewMin) {
-  const uint16_t kNumberOfClassesInRefProfile = 6000;
-  const uint16_t kNumberOfClassesInCurProfile = 6200;  // Threshold is 20%.
-  std::vector<const std::string> extra_args({"--min-new-classes-percent-change=20"});
+  std::vector<const std::string> extra_args({"--min-new-classes-percent-change=2"});
 
   // We should not advise compilation.
   ASSERT_EQ(ProfileAssistant::kSkipCompilation,
@@ -618,6 +604,28 @@
                                                extra_args));
 }
 
+TEST_F(ProfileAssistantTest, ShouldAdviseCompilationClassPercentage) {
+  const uint16_t kNumberOfClassesInRefProfile = 6000;
+  const uint16_t kNumberOfClassesInCurProfile = 6120;  // Threshold is 2%.
+  std::vector<const std::string> extra_args({"--min-new-classes-percent-change=2"});
+
+  // We should advise compilation.
+  ASSERT_EQ(ProfileAssistant::kCompile,
+            CheckCompilationClassPercentChange(kNumberOfClassesInCurProfile,
+                                               kNumberOfClassesInRefProfile,
+                                               extra_args));
+}
+
+TEST_F(ProfileAssistantTest, DoNotAdviseCompilationClassPercentageWithNewMin) {
+  const uint16_t kNumberOfClassesInRefProfile = 6000;
+  const uint16_t kNumberOfClassesInCurProfile = 6200;  // Threshold is 20%.
+
+  // We should not advise compilation.
+  ASSERT_EQ(ProfileAssistant::kSkipCompilation,
+            CheckCompilationClassPercentChange(kNumberOfClassesInCurProfile,
+                                               kNumberOfClassesInRefProfile));
+}
+
 TEST_F(ProfileAssistantTest, FailProcessingBecauseOfProfiles) {
   ScratchFile profile1;
   ScratchFile profile2;
diff --git a/profman/profman.cc b/profman/profman.cc
index f8e4184..b2fabb2 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -179,9 +179,9 @@
   UsageError("      In this case, the reference profile must have a boot profile version.");
   UsageError("  --force-merge: performs a forced merge, without analyzing if there is a");
   UsageError("      significant difference between the current profile and the reference profile.");
-  UsageError("  --min-new-methods-percent-change=percentage between 0 and 100");
+  UsageError("  --min-new-methods-percent-change=percentage between 0 and 100 (default 20)");
   UsageError("      the min percent of new methods to trigger a compilation.");
-  UsageError("  --min-new-classes-percent-change=percentage between 0 and 100");
+  UsageError("  --min-new-classes-percent-change=percentage between 0 and 100 (default 20)");
   UsageError("      the min percent of new classes to trigger a compilation.");
   UsageError("");