Reduce boot profile data usage
- remove inline caches from boot profiles (they are not used)
- remove some flags that will not provide much value.
Test: profile tests
Bug: 139884006
Change-Id: I063ff339e266637c987e05cdb16e18935f6c1e15
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index 2e49adc..05a01d6 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -705,7 +705,11 @@
return true;
}
- // Add inline caches.
+ // Add inline caches. Do this only for regular profiles. The boot image profiles don't use
+ // them and they take up useless space.
+ if (IsForBootImage()) {
+ return true; // early success return.
+ }
InlineCacheMap* inline_cache = data->FindOrAddHotMethod(pmi.ref.index);
DCHECK(inline_cache != nullptr);
@@ -2056,17 +2060,16 @@
static_assert(ProfileCompilationInfo::MethodHotness::kFlagStartup == 1 << 1);
static_assert(ProfileCompilationInfo::MethodHotness::kFlagPostStartup == 1 << 2);
static_assert(ProfileCompilationInfo::MethodHotness::kFlagLastRegular == 1 << 2);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagAmStartup == 1 << 3);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagAmPostStartup == 1 << 4);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagBoot == 1 << 5);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagPostBoot == 1 << 6);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagForeground == 1 << 7);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagBackground == 1 << 8);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlag32bit == 1 << 9);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlag64bit == 1 << 10);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagStartupBin == 1 << 11);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagStartupMaxBin == 1 << 18);
-static_assert(ProfileCompilationInfo::MethodHotness::kFlagLastBoot == 1 << 18);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlag32bit == 1 << 3);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlag64bit == 1 << 4);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagSensitiveThread == 1 << 5);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagAmStartup == 1 << 6);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagAmPostStartup == 1 << 7);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagBoot == 1 << 8);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagPostBoot == 1 << 9);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagStartupBin == 1 << 10);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagStartupMaxBin == 1 << 15);
+static_assert(ProfileCompilationInfo::MethodHotness::kFlagLastBoot == 1 << 15);
size_t ProfileCompilationInfo::DexFileData::MethodFlagBitmapIndex(
MethodHotness::Flag flag, size_t method_index) const {
diff --git a/libprofile/profile/profile_compilation_info.h b/libprofile/profile/profile_compilation_info.h
index 90bf069..5fe9fa6 100644
--- a/libprofile/profile/profile_compilation_info.h
+++ b/libprofile/profile/profile_compilation_info.h
@@ -206,32 +206,31 @@
kFlagPostStartup = 1 << 2,
// Marker flag used to simplify iterations.
kFlagLastRegular = 1 << 2,
- // Executed during the app startup as determined by the framework (equivalent to am start).
- kFlagAmStartup = 1 << 3,
- // Executed after the app startup as determined by the framework (equivalent to am start).
- kFlagAmPostStartup = 1 << 4,
- // Executed during system boot.
- kFlagBoot = 1 << 5,
- // Executed after the system has booted.
- kFlagPostBoot = 1 << 6,
- // Executed while the app is in foreground.
- kFlagForeground = 1 << 7,
- // Executed while the app is in background.
- kFlagBackground = 1 << 8,
// Executed by a 32bit process.
- kFlag32bit = 1 << 9,
+ kFlag32bit = 1 << 3,
// Executed by a 64bit process.
- kFlag64bit = 1 << 10,
- // The startup bins captured the relative order of when a method become hot. There are 8
+ kFlag64bit = 1 << 4,
+ // Executed on sensitive thread (e.g. UI).
+ kFlagSensitiveThread = 1 << 5,
+ // Executed during the app startup as determined by the framework (equivalent to am start).
+ kFlagAmStartup = 1 << 6,
+ // Executed after the app startup as determined by the framework (equivalent to am start).
+ kFlagAmPostStartup = 1 << 7,
+ // Executed during system boot.
+ kFlagBoot = 1 << 8,
+ // Executed after the system has booted.
+ kFlagPostBoot = 1 << 9,
+
+ // The startup bins captured the relative order of when a method become hot. There are 6
// total bins supported and each hot method will have at least one bit set. If the profile was
// merged multiple times more than one bit may be set as a given method may become hot at
// various times during subsequent executions.
// The granularity of the bins is unspecified (i.e. the runtime is free to change the
// values it uses - this may be 100ms, 200ms etc...).
- kFlagStartupBin = 1 << 11,
- kFlagStartupMaxBin = 1 << 18,
+ kFlagStartupBin = 1 << 10,
+ kFlagStartupMaxBin = 1 << 15,
// Marker flag used to simplify iterations.
- kFlagLastBoot = 1 << 18,
+ kFlagLastBoot = 1 << 15,
};
bool IsHot() const {