Merge "Read "dalvik.vm.usejitprofiles" for package compile command" into nyc-dev

am: bed38b9

* commit 'bed38b9fd4e5cd1014871ee247b130afd53ff63c':
  Read "dalvik.vm.usejitprofiles" for package compile command
This commit is contained in:
Calin Juravle
2016-03-28 15:54:26 +00:00
committed by android-build-merger

View File

@@ -44,6 +44,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ShellCommand; import android.os.ShellCommand;
import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.PrintWriterPrinter; import android.util.PrintWriterPrinter;
@@ -249,31 +250,34 @@ class PackageManagerShellCommand extends ShellCommand {
private int runCompile() throws RemoteException { private int runCompile() throws RemoteException {
final PrintWriter pw = getOutPrintWriter(); final PrintWriter pw = getOutPrintWriter();
boolean useJitProfiles = false; boolean checkProfiles = SystemProperties.getBoolean("dalvik.vm.usejitprofiles", false);
boolean forceCompilation = false; boolean forceCompilation = false;
boolean allPackages = false; boolean allPackages = false;
boolean clearProfileData = false; boolean clearProfileData = false;
String compilerFilter = null; String compilerFilter = null;
String compilationReason = null; String compilationReason = null;
String checkProfilesRaw = null;
if (peekNextArg() == null) { if (peekNextArg() == null) {
// No arguments, show help. // No arguments, show help.
pw.println("Usage: cmd package compile [-c] [-f] [--reset] [-m mode] " + pw.println("Usage: cmd package compile [-c] [-f] [--reset] [-m mode] " +
"[-r reason] [-a|pkg]"); "[-r reason] [-a|pkg]");
pw.println(); pw.println();
pw.println(" -c Clear profile data"); pw.println(" -c Clear profile data");
pw.println(" -f Force compilation"); pw.println(" -f Force compilation");
pw.println(" --reset Reset package"); pw.println(" --check-prof val Look at profiles when doing dexopt.");
pw.println(" -m mode Compilation mode, one of the dex2oat compiler filters"); pw.println(" Overrides dalvik.vm.usejitprofiles to true of false");
pw.println(" verify-none"); pw.println(" --reset Reset package");
pw.println(" verify-at-runtime"); pw.println(" -m mode Compilation mode, one of the dex2oat compiler filters");
pw.println(" verify-profile"); pw.println(" verify-none");
pw.println(" interpret-only"); pw.println(" verify-at-runtime");
pw.println(" space-profile"); pw.println(" verify-profile");
pw.println(" space"); pw.println(" interpret-only");
pw.println(" speed-profile"); pw.println(" space-profile");
pw.println(" speed"); pw.println(" space");
pw.println(" everything"); pw.println(" speed-profile");
pw.println(" speed");
pw.println(" everything");
pw.println(" -r reason Compiler reason, one of the package manager reasons"); pw.println(" -r reason Compiler reason, one of the package manager reasons");
for (int i = 0; i < PackageManagerServiceCompilerMapping.REASON_STRINGS.length; i++) { for (int i = 0; i < PackageManagerServiceCompilerMapping.REASON_STRINGS.length; i++) {
pw.println(" " + pw.println(" " +
@@ -301,6 +305,9 @@ class PackageManagerShellCommand extends ShellCommand {
case "-r": case "-r":
compilationReason = getNextArgRequired(); compilationReason = getNextArgRequired();
break; break;
case "-check-prof":
checkProfilesRaw = getNextArgRequired();
break;
case "--reset": case "--reset":
forceCompilation = true; forceCompilation = true;
clearProfileData = true; clearProfileData = true;
@@ -312,6 +319,17 @@ class PackageManagerShellCommand extends ShellCommand {
} }
} }
if (checkProfilesRaw != null) {
if ("true".equals(checkProfilesRaw)) {
checkProfiles = true;
} else if ("false".equals(checkProfilesRaw)) {
checkProfiles = false;
} else {
pw.println("Invalid value for \"--check-prof\". Expected \"true\" or \"false\".");
return 1;
}
}
if (compilerFilter != null && compilationReason != null) { if (compilerFilter != null && compilationReason != null) {
pw.println("Cannot use compilation filter (\"-m\") and compilation reason (\"-r\") " + pw.println("Cannot use compilation filter (\"-m\") and compilation reason (\"-r\") " +
"at the same time"); "at the same time");
@@ -381,7 +399,7 @@ class PackageManagerShellCommand extends ShellCommand {
} }
boolean result = mInterface.performDexOptMode(packageName, null /* instructionSet */, boolean result = mInterface.performDexOptMode(packageName, null /* instructionSet */,
useJitProfiles, targetCompilerFilter, forceCompilation); checkProfiles, targetCompilerFilter, forceCompilation);
if (!result) { if (!result) {
failedPackages.add(packageName); failedPackages.add(packageName);
} }