bootchart: fix bootchart can not be triggered problem
bootchart uses a file on the data partition to decide if it should collect
data for bootchart, but the data partition will be mounted by the mount_all
command in the "on fs" section, and it will be only added into the action
queue when command "trigger fs" is executed, but that's after the
bootchart_init action (late_init).
This change makes bootchart_init a builtin command of init,
and make it executed as the first command of "on post-fs" section
which will be triggered after the "on fs" section.
This change also refactors the bootchart code to all be in bootchart.cpp.
Change-Id: Ia74aa34ca5b785f51fcffdd383075a549b2a99d9
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/init/README.BOOTCHART b/init/README.BOOTCHART
index 70cf2c3..245e452 100644
--- a/init/README.BOOTCHART
+++ b/init/README.BOOTCHART
@@ -1,37 +1,31 @@
This version of init contains code to perform "bootcharting", i.e. generating log
files that can be later processed by the tools provided by www.bootchart.org.
-To activate it, you need to define build 'init' with the INIT_BOOTCHART environment
-variable defined to 'true', for example:
-
- touch system/init/init.c
- m INIT_BOOTCHART=true
-
On the emulator, use the new -bootchart <timeout> option to boot with bootcharting
activated for <timeout> seconds.
Otherwise, flash your device, and start it. Then create a file on the /data partition
with a command like the following:
- adb shell 'echo $TIMEOUT > /data/bootchart-start'
+ adb shell 'echo $TIMEOUT > /data/bootchart/start'
Where the value of $TIMEOUT corresponds to the wanted bootcharted period in seconds;
for example, to bootchart for 2 minutes, do:
- adb shell 'echo 120 > /data/bootchart-start'
+ adb shell 'echo 120 > /data/bootchart/start'
Reboot your device, bootcharting will begin and stop after the period you gave.
You can also stop the bootcharting at any moment by doing the following:
- adb shell 'echo 1 > /data/bootchart-stop'
+ adb shell 'echo 1 > /data/bootchart/stop'
-Note that /data/bootchart-stop is deleted automatically by init at the end of the
-bootcharting. This is not the case of /data/bootchart-start, so don't forget to delete it
+Note that /data/bootchart/stop is deleted automatically by init at the end of the
+bootcharting. This is not the case of /data/bootchart/start, so don't forget to delete it
when you're done collecting data:
- adb shell rm /data/bootchart-start
+ adb shell rm /data/bootchart/start
-The log files are placed in /data/bootchart/. you must run the script tools/grab-bootchart.sh
+The log files are placed in /data/bootchart/. You must run the script tools/grab-bootchart.sh
which will use ADB to retrieve them and create a bootchart.tgz file that can be used with
the bootchart parser/renderer, or even uploaded directly to the form located at:
@@ -47,6 +41,6 @@
technical note:
-this implementation of bootcharting does use the 'bootchartd' script provided by
+This implementation of bootcharting does not use the 'bootchartd' script provided by
www.bootchart.org, but a C re-implementation that is directly compiled into our init
program.