Index: tools/android-ll-prof.sh |
diff --git a/tools/check-static-initializers.sh b/tools/android-ll-prof.sh |
similarity index 53% |
copy from tools/check-static-initializers.sh |
copy to tools/android-ll-prof.sh |
index 1103a9778775dc86e8b59ee4f804670192533f70..78790ecb62baa25eb44a70fb278adfb5a2ebafef 100755 |
--- a/tools/check-static-initializers.sh |
+++ b/tools/android-ll-prof.sh |
@@ -26,38 +26,44 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-# Checks that the number of compilation units having at least one static |
-# initializer in d8 matches the one defined below. |
-# Note that the project must be built with SCons before running this script. |
- |
-# Allow: |
-# - _GLOBAL__I__ZN2v810LineEditor6first_E |
-# - _GLOBAL__I__ZN2v88internal32AtomicOps_Internalx86CPUFeaturesE |
-# - _GLOBAL__I__ZN2v88internal8ThreadId18highest_thread_id_E |
-expected_static_init_count=3 |
- |
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) |
- |
-if [ -n "$1" ] ; then |
- d8="${v8_root}/$1" |
-else |
- d8="${v8_root}/d8" |
-fi |
- |
-if [ ! -f "$d8" ]; then |
- echo "d8 binary not found: $d8" |
- exit 1 |
-fi |
- |
-static_inits=$(nm "$d8" | grep _GLOBAL_ | grep _I_ | awk '{ print $NF; }') |
- |
-static_init_count=$(echo "$static_inits" | wc -l) |
- |
-if [ $static_init_count -gt $expected_static_init_count ]; then |
- echo "Too many static initializers." |
- echo "$static_inits" |
- exit 1 |
-else |
- echo "Static initializer check passed ($static_init_count initializers)." |
- exit 0 |
-fi |
+# Runs d8 with the given arguments on the device under 'perf' and |
+# processes the profiler trace and v8 logs using ll_prof.py. |
+# |
+# Usage: |
+# > ./tools/android-ll-prof.sh (debug|release) "args to d8" "args to ll_prof.py" |
+# |
+# The script creates deploy directory deploy/data/local/tmp/v8, copies there |
+# the d8 binary either from out/android_arm.release or out/android_arm.debug, |
+# and then sync the deploy directory with /data/local/tmp/v8 on the device. |
+# You can put JS files in the deploy directory before running the script. |
+# Note: $ANDROID_NDK_ROOT must be set. |
+ |
+MODE=$1 |
+RUN_ARGS=$2 |
+LL_PROF_ARGS=$3 |
+ |
+BASE=`cd $(dirname "$0")/..; pwd` |
+DEPLOY="$BASE/deploy" |
+ |
+set +e |
+mkdir -p "$DEPLOY/data/local/tmp/v8" |
+ |
+cp "$BASE/out/android_arm.$MODE/d8" "$DEPLOY/data/local/tmp/v8/d8" |
+ |
+adb -p "$DEPLOY" sync data |
+ |
+adb shell "cd /data/local/tmp/v8;\ |
+ perf record -R -e cycles -c 10000 -f -i \ |
+ ./d8 --ll_prof --gc-fake-mmap=/data/local/tmp/__v8_gc__ $RUN_ARGS" |
+ |
+adb pull /data/local/tmp/v8/v8.log . |
+adb pull /data/local/tmp/v8/v8.log.ll . |
+adb pull /data/perf.data . |
+ |
+ARCH=arm-linux-androideabi-4.4.3 |
+TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/$ARCH/prebuilt/linux-x86/bin" |
+ |
+$BASE/tools/ll_prof.py --host-root="$BASE/deploy" \ |
+ --gc-fake-mmap=/data/local/tmp/__v8_gc__ \ |
+ --objdump="$TOOLCHAIN/arm-linux-androideabi-objdump" \ |
+ $LL_PROF_ARGS |