diff options
author | Jesse Wilson <jessewilson@google.com> | 2010-10-12 21:35:56 -0700 |
---|---|---|
committer | Jesse Wilson <jessewilson@google.com> | 2010-10-13 16:55:26 -0700 |
commit | eaca10e2d0a61c482b6a1799ca9f51d8f67482cb (patch) | |
tree | 0a8d7c05494fe42eacff02ead4a0275909763634 /tools/preload | |
parent | 844a6b3ccaff1ad1443ad985e4527b733ce97c0e (diff) | |
download | frameworks_base-eaca10e2d0a61c482b6a1799ca9f51d8f67482cb.zip frameworks_base-eaca10e2d0a61c482b6a1799ca9f51d8f67482cb.tar.gz frameworks_base-eaca10e2d0a61c482b6a1799ca9f51d8f67482cb.tar.bz2 |
Regenerate preloaded classes for Gingerbread.
Unlike previous releases where the set of classes-to-be-preloaded
was generated on a first-generation device (G1 and MyTouch 3G), this
round I used a second-generation device, a Nexus One. As a consequence,
class loading is faster (win) and fewer classes hit the 1250ms threshold.
Instead of sharing classes based on load time alone, classes are now shared
based on the number of applications loading them.
Change-Id: I18f7aa3e7e6258818871b3968b515c06314371b3
http://b/2546002
Diffstat (limited to 'tools/preload')
-rw-r--r-- | tools/preload/WritePreloadedClassFile.java | 13 | ||||
-rw-r--r-- | tools/preload/loadclass/Android.mk | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tools/preload/WritePreloadedClassFile.java b/tools/preload/WritePreloadedClassFile.java index 96c539b..b067bc2 100644 --- a/tools/preload/WritePreloadedClassFile.java +++ b/tools/preload/WritePreloadedClassFile.java @@ -34,6 +34,11 @@ public class WritePreloadedClassFile { */ static final int MIN_LOAD_TIME_MICROS = 1250; + /** + * Preload any class that was loaded by at least MIN_PROCESSES processes. + */ + static final int MIN_PROCESSES = 10; + public static void main(String[] args) throws IOException, ClassNotFoundException { if (args.length != 1) { @@ -58,6 +63,7 @@ public class WritePreloadedClassFile { out.write("# Automatically generated by frameworks/base/tools/preload/" + WritePreloadedClassFile.class.getSimpleName() + ".java.\n"); out.write("# MIN_LOAD_TIME_MICROS=" + MIN_LOAD_TIME_MICROS + "\n"); + out.write("# MIN_PROCESSES=" + MIN_PROCESSES + "\n"); /* * The set of classes to preload. We preload a class if: @@ -73,7 +79,12 @@ public class WritePreloadedClassFile { // the memory associated with these classes will be shared. for (LoadedClass loadedClass : root.loadedClasses.values()) { Set<String> names = loadedClass.processNames(); - if (shouldPreload(loadedClass) && names.size() > 1) { + if (!Policy.isPreloadable(loadedClass)) { + continue; + } + + if (names.size() >= MIN_PROCESSES || + (loadedClass.medianTimeMicros() > MIN_LOAD_TIME_MICROS && names.size() > 1)) { toPreload.add(loadedClass); } } diff --git a/tools/preload/loadclass/Android.mk b/tools/preload/loadclass/Android.mk index 435699d..65828be 100644 --- a/tools/preload/loadclass/Android.mk +++ b/tools/preload/loadclass/Android.mk @@ -2,6 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) +LOCAL_MODULE_TAGS := tests LOCAL_MODULE := loadclass |