Loading cmds/app_process/app_main.cpp +46 −0 Original line number Original line Diff line number Diff line Loading @@ -188,6 +188,16 @@ int main(int argc, char* const argv[]) LOG_ALWAYS_FATAL("PR_SET_NO_NEW_PRIVS failed: %s", strerror(errno)); LOG_ALWAYS_FATAL("PR_SET_NO_NEW_PRIVS failed: %s", strerror(errno)); } } if (!LOG_NDEBUG) { String8 argv_String; for (int i = 0; i < argc; ++i) { argv_String.append("\""); argv_String.append(argv[i]); argv_String.append("\" "); } ALOGV("app_process main with argv: %s", argv_String.string()); } AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv)); AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv)); // Process command line arguments // Process command line arguments // ignore argv[0] // ignore argv[0] Loading Loading @@ -216,9 +226,31 @@ int main(int argc, char* const argv[]) // // // Note that we must copy argument string values since we will rewrite the // Note that we must copy argument string values since we will rewrite the // entire argument block when we apply the nice name to argv0. // entire argument block when we apply the nice name to argv0. // // As an exception to the above rule, anything in "spaced commands" // goes to the vm even though it has a space in it. const char* spaced_commands[] = { "-cp", "-classpath" }; // Allow "spaced commands" to be succeeded by exactly 1 argument (regardless of -s). bool known_command = false; int i; int i; for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) { if (known_command == true) { runtime.addOption(strdup(argv[i])); ALOGV("app_process main add known option '%s'", argv[i]); known_command = false; continue; } for (int j = 0; j < static_cast<int>(sizeof(spaced_commands) / sizeof(spaced_commands[0])); ++j) { if (strcmp(argv[i], spaced_commands[j]) == 0) { known_command = true; ALOGV("app_process main found known command '%s'", argv[i]); } } if (argv[i][0] != '-') { if (argv[i][0] != '-') { break; break; } } Loading @@ -226,7 +258,9 @@ int main(int argc, char* const argv[]) ++i; // Skip --. ++i; // Skip --. break; break; } } runtime.addOption(strdup(argv[i])); runtime.addOption(strdup(argv[i])); ALOGV("app_process main add option '%s'", argv[i]); } } // Parse runtime arguments. Stop at first unrecognized option. // Parse runtime arguments. Stop at first unrecognized option. Loading Loading @@ -266,6 +300,18 @@ int main(int argc, char* const argv[]) // copies of them before we overwrite them with the process name. // copies of them before we overwrite them with the process name. args.add(application ? String8("application") : String8("tool")); args.add(application ? String8("application") : String8("tool")); runtime.setClassNameAndArgs(className, argc - i, argv + i); runtime.setClassNameAndArgs(className, argc - i, argv + i); if (!LOG_NDEBUG) { String8 restOfArgs; char* const* argv_new = argv + i; int argc_new = argc - i; for (int k = 0; k < argc_new; ++k) { restOfArgs.append("\""); restOfArgs.append(argv_new[k]); restOfArgs.append("\" "); } ALOGV("Class name = %s, args = %s", className.string(), restOfArgs.string()); } } else { } else { // We're in zygote mode. // We're in zygote mode. maybeCreateDalvikCache(); maybeCreateDalvikCache(); Loading core/tests/benchmarks/README +18 −1 Original line number Original line Diff line number Diff line Loading @@ -5,4 +5,21 @@ run on a remote device using Vogar: http://code.google.com/p/caliper/ http://code.google.com/p/caliper/ http://code.google.com/p/vogar/ http://code.google.com/p/vogar/ $ vogar --benchmark path/to/Benchmark.java ------------------------- Quick Command Line Reference: # Build vogar and dependencies. $> mmma -j32 external/vogar # First make sure art has permissions to dalvik-cache, otherwise it will run slower with interpreter. $> adb root # Run vogar in benchmark mode, telling it to use app_process (not dalvikvm which is default) # Otherwise you will likely crash with UnsatisfiedLinkError despite having correct JNI code. $> vogar --mode app_process --benchmark path/to/Benchmark.java # Sometimes your benchmarks might time out, if so increase the timeout: # (--timeout goes to vogar, and --time-limit goes to caliper) $> vogar --timeout 1000 --mode app_process --benchmark path/to/Benchmark -- --time-limit 9999s Loading
cmds/app_process/app_main.cpp +46 −0 Original line number Original line Diff line number Diff line Loading @@ -188,6 +188,16 @@ int main(int argc, char* const argv[]) LOG_ALWAYS_FATAL("PR_SET_NO_NEW_PRIVS failed: %s", strerror(errno)); LOG_ALWAYS_FATAL("PR_SET_NO_NEW_PRIVS failed: %s", strerror(errno)); } } if (!LOG_NDEBUG) { String8 argv_String; for (int i = 0; i < argc; ++i) { argv_String.append("\""); argv_String.append(argv[i]); argv_String.append("\" "); } ALOGV("app_process main with argv: %s", argv_String.string()); } AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv)); AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv)); // Process command line arguments // Process command line arguments // ignore argv[0] // ignore argv[0] Loading Loading @@ -216,9 +226,31 @@ int main(int argc, char* const argv[]) // // // Note that we must copy argument string values since we will rewrite the // Note that we must copy argument string values since we will rewrite the // entire argument block when we apply the nice name to argv0. // entire argument block when we apply the nice name to argv0. // // As an exception to the above rule, anything in "spaced commands" // goes to the vm even though it has a space in it. const char* spaced_commands[] = { "-cp", "-classpath" }; // Allow "spaced commands" to be succeeded by exactly 1 argument (regardless of -s). bool known_command = false; int i; int i; for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) { if (known_command == true) { runtime.addOption(strdup(argv[i])); ALOGV("app_process main add known option '%s'", argv[i]); known_command = false; continue; } for (int j = 0; j < static_cast<int>(sizeof(spaced_commands) / sizeof(spaced_commands[0])); ++j) { if (strcmp(argv[i], spaced_commands[j]) == 0) { known_command = true; ALOGV("app_process main found known command '%s'", argv[i]); } } if (argv[i][0] != '-') { if (argv[i][0] != '-') { break; break; } } Loading @@ -226,7 +258,9 @@ int main(int argc, char* const argv[]) ++i; // Skip --. ++i; // Skip --. break; break; } } runtime.addOption(strdup(argv[i])); runtime.addOption(strdup(argv[i])); ALOGV("app_process main add option '%s'", argv[i]); } } // Parse runtime arguments. Stop at first unrecognized option. // Parse runtime arguments. Stop at first unrecognized option. Loading Loading @@ -266,6 +300,18 @@ int main(int argc, char* const argv[]) // copies of them before we overwrite them with the process name. // copies of them before we overwrite them with the process name. args.add(application ? String8("application") : String8("tool")); args.add(application ? String8("application") : String8("tool")); runtime.setClassNameAndArgs(className, argc - i, argv + i); runtime.setClassNameAndArgs(className, argc - i, argv + i); if (!LOG_NDEBUG) { String8 restOfArgs; char* const* argv_new = argv + i; int argc_new = argc - i; for (int k = 0; k < argc_new; ++k) { restOfArgs.append("\""); restOfArgs.append(argv_new[k]); restOfArgs.append("\" "); } ALOGV("Class name = %s, args = %s", className.string(), restOfArgs.string()); } } else { } else { // We're in zygote mode. // We're in zygote mode. maybeCreateDalvikCache(); maybeCreateDalvikCache(); Loading
core/tests/benchmarks/README +18 −1 Original line number Original line Diff line number Diff line Loading @@ -5,4 +5,21 @@ run on a remote device using Vogar: http://code.google.com/p/caliper/ http://code.google.com/p/caliper/ http://code.google.com/p/vogar/ http://code.google.com/p/vogar/ $ vogar --benchmark path/to/Benchmark.java ------------------------- Quick Command Line Reference: # Build vogar and dependencies. $> mmma -j32 external/vogar # First make sure art has permissions to dalvik-cache, otherwise it will run slower with interpreter. $> adb root # Run vogar in benchmark mode, telling it to use app_process (not dalvikvm which is default) # Otherwise you will likely crash with UnsatisfiedLinkError despite having correct JNI code. $> vogar --mode app_process --benchmark path/to/Benchmark.java # Sometimes your benchmarks might time out, if so increase the timeout: # (--timeout goes to vogar, and --time-limit goes to caliper) $> vogar --timeout 1000 --mode app_process --benchmark path/to/Benchmark -- --time-limit 9999s