summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2015-11-05 01:41:42 +0000
committerRicardo Cerqueira <ricardo@cyngn.com>2015-11-05 01:41:42 +0000
commit1cdd1b5ad204cb319174f86b522fcb0dc7968ed6 (patch)
tree208c78f58721f44168992cf88ae8d2b821f090de /cmds
parent5e78568dab3b1bbddd1cbc0dd2004d9c2ddbdfeb (diff)
parent3492a21877f93b2240dc823392b7e8adb2e1809e (diff)
downloadframeworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.zip
frameworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.tar.gz
frameworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.tar.bz2
Merge tag 'android-6.0.0_r26' into HEAD
Android 6.0.0 release 26 Conflicts: include/android/input.h Change-Id: Ifa374c6d3055be3b8a5d60967f8b4c0043da739b
Diffstat (limited to 'cmds')
-rw-r--r--cmds/atrace/atrace.cpp24
-rw-r--r--cmds/dumpstate/dumpstate.c28
-rw-r--r--cmds/installd/commands.cpp48
-rw-r--r--cmds/installd/installd.cpp6
-rw-r--r--cmds/installd/installd.h2
5 files changed, 75 insertions, 33 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 9def406..26c5b4a 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -264,9 +264,27 @@ static bool appendStr(const char* filename, const char* str)
static void writeClockSyncMarker()
{
char buffer[128];
+ int len = 0;
+ int fd = open(k_traceMarkerPath, O_WRONLY);
+ if (fd == -1) {
+ fprintf(stderr, "error opening %s: %s (%d)\n", k_traceMarkerPath,
+ strerror(errno), errno);
+ return;
+ }
float now_in_seconds = systemTime(CLOCK_MONOTONIC) / 1000000000.0f;
- snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
- writeStr(k_traceMarkerPath, buffer);
+
+ len = snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
+ if (write(fd, buffer, len) != len) {
+ fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno);
+ }
+
+ int64_t realtime_in_ms = systemTime(CLOCK_REALTIME) / 1000000;
+ len = snprintf(buffer, 128, "trace_event_clock_sync: realtime_ts=%" PRId64 "\n", realtime_in_ms);
+ if (write(fd, buffer, len) != len) {
+ fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno);
+ }
+
+ close(fd);
}
// Enable or disable a kernel option by writing a "1" or a "0" into a /sys
@@ -646,7 +664,6 @@ static bool startTrace()
// Disable tracing in the kernel.
static void stopTrace()
{
- writeClockSyncMarker();
setTracingEnabled(false);
}
@@ -940,6 +957,7 @@ int main(int argc, char **argv)
// another.
ok = clearTrace();
+ writeClockSyncMarker();
if (ok && !async) {
// Sleep to allow the trace to be captured.
struct timespec timeLeft;
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index ef8db06..792f015 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -434,8 +434,6 @@ static void dumpstate() {
run_command("ARP CACHE", 10, "ip", "-4", "neigh", "show", NULL);
run_command("IPv6 ND CACHE", 10, "ip", "-6", "neigh", "show", NULL);
- run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);
-
run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL);
run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL);
run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-nvx", NULL);
@@ -447,25 +445,29 @@ static void dumpstate() {
SU_PATH, "root", "wpa_cli", "IFNAME=wlan0", "list_networks", NULL);
#ifdef FWDUMP_bcmdhd
- run_command("DUMP WIFI INTERNAL COUNTERS", 20,
+ run_command("ND OFFLOAD TABLE", 5,
+ SU_PATH, "root", "wlutil", "nd_hostip", NULL);
+
+ run_command("DUMP WIFI INTERNAL COUNTERS (1)", 20,
SU_PATH, "root", "wlutil", "counters", NULL);
+
+ run_command("ND OFFLOAD STATUS (1)", 5,
+ SU_PATH, "root", "wlutil", "nd_status", NULL);
+
#endif
dump_file("INTERRUPTS (1)", "/proc/interrupts");
- property_get("dhcp.wlan0.gateway", network, "");
- if (network[0])
- run_command("PING GATEWAY", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
- property_get("dhcp.wlan0.dns1", network, "");
- if (network[0])
- run_command("PING DNS1", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
- property_get("dhcp.wlan0.dns2", network, "");
- if (network[0])
- run_command("PING DNS2", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
+ run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);
+
#ifdef FWDUMP_bcmdhd
run_command("DUMP WIFI STATUS", 20,
SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL);
- run_command("DUMP WIFI INTERNAL COUNTERS", 20,
+
+ run_command("DUMP WIFI INTERNAL COUNTERS (2)", 20,
SU_PATH, "root", "wlutil", "counters", NULL);
+
+ run_command("ND OFFLOAD STATUS (2)", 5,
+ SU_PATH, "root", "wlutil", "nd_status", NULL);
#endif
dump_file("INTERRUPTS (2)", "/proc/interrupts");
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index eb7e4e5..55cdabc 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -746,7 +746,7 @@ static bool check_boolean_property(const char* property_name, bool default_value
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
- bool vm_safe_mode, bool debuggable)
+ bool vm_safe_mode, bool debuggable, bool post_bootcomplete)
{
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
@@ -770,8 +770,24 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
dex2oat_compiler_filter_flag, NULL) > 0;
char dex2oat_threads_buf[PROPERTY_VALUE_MAX];
- bool have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads", dex2oat_threads_buf,
- NULL) > 0;
+ bool have_dex2oat_threads_flag = false;
+ if (!post_bootcomplete) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.boot-dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ // If there's no boot property, fall back to the image property.
+ if (!have_dex2oat_threads_flag) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.image-dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ }
+ // If there's neither, fall back to the default property.
+ }
+ if (!have_dex2oat_threads_flag) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ }
char dex2oat_threads_arg[PROPERTY_VALUE_MAX + 2];
if (have_dex2oat_threads_flag) {
sprintf(dex2oat_threads_arg, "-j%s", dex2oat_threads_buf);
@@ -1065,9 +1081,22 @@ static bool calculate_odex_file_path(char path[PKG_PATH_MAX],
return true;
}
+static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) {
+ if (set_to_bg) {
+ if (set_sched_policy(0, SP_BACKGROUND) < 0) {
+ ALOGE("set_sched_policy failed: %s\n", strerror(errno));
+ exit(70);
+ }
+ if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
+ ALOGE("setpriority failed: %s\n", strerror(errno));
+ exit(71);
+ }
+ }
+}
+
int dexopt(const char *apk_path, uid_t uid, bool is_public,
const char *pkgname, const char *instruction_set, int dexopt_needed,
- bool vm_safe_mode, bool debuggable, const char* oat_dir)
+ bool vm_safe_mode, bool debuggable, const char* oat_dir, bool boot_complete)
{
struct utimbuf ut;
struct stat input_stat;
@@ -1198,14 +1227,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
ALOGE("capset failed: %s\n", strerror(errno));
exit(66);
}
- if (set_sched_policy(0, SP_BACKGROUND) < 0) {
- ALOGE("set_sched_policy failed: %s\n", strerror(errno));
- exit(70);
- }
- if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
- ALOGE("setpriority failed: %s\n", strerror(errno));
- exit(71);
- }
+ SetDex2OatAndPatchOatScheduling(boot_complete);
if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67);
@@ -1222,7 +1244,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
input_file_name++;
}
run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname,
- instruction_set, vm_safe_mode, debuggable);
+ instruction_set, vm_safe_mode, debuggable, boot_complete);
} else {
ALOGE("Invalid dexopt needed: %d\n", dexopt_needed);
exit(73);
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index 37425aa..d0e1747 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -48,9 +48,9 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused)
static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
{
/* apk_path, uid, is_public, pkgname, instruction_set,
- * dexopt_needed, vm_safe_mode, debuggable, oat_dir */
+ * dexopt_needed, vm_safe_mode, debuggable, oat_dir, boot_complete */
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]),
- atoi(arg[6]), atoi(arg[7]), arg[8]);
+ atoi(arg[6]), atoi(arg[7]), arg[8], atoi(arg[9]));
}
static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused)
@@ -204,7 +204,7 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
{ "install", 5, do_install },
- { "dexopt", 9, do_dexopt },
+ { "dexopt", 10, do_dexopt },
{ "markbootcomplete", 1, do_mark_boot_complete },
{ "movedex", 3, do_move_dex },
{ "rmdex", 2, do_rm_dex },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 1f70181..2745ba0 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -243,7 +243,7 @@ int get_size(const char *uuid, const char *pkgname, int userid,
int free_cache(const char *uuid, int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
const char *instruction_set, int dexopt_needed, bool vm_safe_mode,
- bool debuggable, const char* oat_dir);
+ bool debuggable, const char* oat_dir, bool boot_complete);
int mark_boot_complete(const char *instruction_set);
int movefiles();
int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId);