diff --git a/init/bootchart.cpp b/init/bootchart.cpp index 03c8b300acf34b84efa2746dd1a75bdbfc1a75a1..95687cbd0022e7b6a105b9d555669d9a6a1ea6a4 100644 --- a/init/bootchart.cpp +++ b/init/bootchart.cpp @@ -195,13 +195,8 @@ static int bootchart_init() { } // Create kernel process accounting file. - { - int fd = open( LOG_ACCT, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC,0644); - if (fd >= 0) { - close(fd); - acct( LOG_ACCT ); - } - } + close(open(LOG_ACCT, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644)); + acct(LOG_ACCT); log_header(); return count; @@ -210,11 +205,12 @@ static int bootchart_init() { int do_bootchart_init(int nargs, char** args) { g_remaining_samples = bootchart_init(); if (g_remaining_samples < 0) { - ERROR("bootcharting init failure: %s\n", strerror(errno)); + ERROR("Bootcharting init failure: %s\n", strerror(errno)); } else if (g_remaining_samples > 0) { - NOTICE("bootcharting started (will run for %d ms)\n", g_remaining_samples*BOOTCHART_POLLING_MS); + NOTICE("Bootcharting started (will run for %d s).\n", + (g_remaining_samples * BOOTCHART_POLLING_MS) / 1000); } else { - NOTICE("bootcharting ignored\n"); + NOTICE("Not bootcharting.\n"); } return 0; } diff --git a/init/readme.txt b/init/readme.txt index 4c8d0d3485765c8b9556925e45c4a1f2a6022afd..630dd034c812867aa4034dde3851bc101294773b 100644 --- a/init/readme.txt +++ b/init/readme.txt @@ -323,12 +323,11 @@ init.svc. Bootcharting ------------ - This version of init contains code to perform "bootcharting": generating log files that can be later processed by the tools provided by www.bootchart.org. -On the emulator, use the new -bootchart option to boot with -bootcharting activated for seconds. +On the emulator, use the -bootchart option to boot with bootcharting +activated for seconds. On a device, create /data/bootchart/start with a command like the following: @@ -349,9 +348,13 @@ retrieve them and create a bootchart.tgz file that can be used with the bootchart command-line utility: sudo apt-get install pybootchartgui - ANDROID_SERIAL= + # grab-bootchart.sh uses $ANDROID_SERIAL. $ANDROID_BUILD_TOP/system/core/init/grab-bootchart.sh +One thing to watch for is that the bootchart will show init as if it started +running at 0s. You'll have to look at dmesg to work out when the kernel +actually started init. + Debugging init --------------