1#!/bin/sh
2#
3# This script is used to retrieve a bootchart log generated by init.
4# All options are passed to adb, for better or for worse.
5# See the readme in this directory for more on bootcharting.
6
7TMPDIR=/tmp/android-bootchart
8rm -rf $TMPDIR
9mkdir -p $TMPDIR
10
11LOGROOT=/data/bootchart
12TARBALL=bootchart.tgz
13
14FILES="header proc_stat.log proc_ps.log proc_diskstats.log"
15
16for f in $FILES; do
17    adb "${@}" pull $LOGROOT/$f $TMPDIR/$f 2>&1 > /dev/null
18done
19(cd $TMPDIR && tar -czf $TARBALL $FILES)
20bootchart ${TMPDIR}/${TARBALL}
21gnome-open ${TARBALL%.tgz}.png
22echo "Clean up ${TMPDIR}/ and ./${TARBALL%.tgz}.png when done"
23