summaryrefslogtreecommitdiff
path: root/tools/traceview
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2013-03-13 17:59:03 -0700
committerRaphael Moll <ralf@android.com>2013-03-13 20:24:22 -0700
commit2ecff7c9e52fb3fefa0311358fccbc668099cd7a (patch)
tree0ef5a71190e5533dffc8e58f7b176285cadac5b0 /tools/traceview
parent0ec5e15aa8418a24ccfdeae86c3036d96b3821c1 (diff)
downloaddevtools-2ecff7c9e52fb3fefa0311358fccbc668099cd7a.tar.gz
SDK prebuilts.
Based on: - tools/base: b9622727676552669cbc09fac40090df78c6e644 - tools/swt : 6f500b3cdc46f5991ea302b80b9527619f7817e1 Change-Id: I6349e370cb89e948e30d621755f6c79fe058e148
Diffstat (limited to 'tools/traceview')
-rwxr-xr-xtools/traceview108
1 files changed, 108 insertions, 0 deletions
diff --git a/tools/traceview b/tools/traceview
new file mode 100755
index 0000000..cd4a25f
--- /dev/null
+++ b/tools/traceview
@@ -0,0 +1,108 @@
+#!/bin/bash
+#
+# Copyright 2005-2006, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+progname=`basename "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/"${progname}"
+cd "${oldwd}"
+
+jarfile=traceview.jar
+frameworkdir="$progdir"
+libdir="$progdir"
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ frameworkdir=`dirname "$progdir"`/tools/lib
+ libdir=`dirname "$progdir"`/tools/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ frameworkdir=`dirname "$progdir"`/framework
+ libdir=`dirname "$progdir"`/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ echo "${progname}: can't find $jarfile"
+ exit 1
+fi
+
+javaCmd="java"
+
+os=`uname`
+if [ $os == 'Darwin' ]; then
+ javaOpts="-Xmx1600M -XstartOnFirstThread"
+else
+ javaOpts="-Xmx1600M"
+fi
+
+if [ `uname` = "Linux" ]; then
+ export GDK_NATIVE_WINDOWS=true
+fi
+
+while expr "x$1" : 'x-J' >/dev/null; do
+ opt=`expr "x$1" : 'x-J\(.*\)'`
+ javaOpts="${javaOpts} -${opt}"
+ shift
+done
+
+jarpath="$frameworkdir/$jarfile"
+
+# Figure out the path to the swt.jar for the current architecture.
+# if ANDROID_SWT is defined, then just use this.
+# else, if running in the Android source tree, then look for the correct swt folder in prebuilt
+# else, look for the correct swt folder in the SDK under tools/lib/
+swtpath=""
+if [ -n "$ANDROID_SWT" ]; then
+ swtpath="$ANDROID_SWT"
+else
+ vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
+ if [ -n "$ANDROID_BUILD_TOP" ]; then
+ osname=`uname -s | tr A-Z a-z`
+ swtpath="${ANDROID_BUILD_TOP}/prebuilts/tools/${osname}-${vmarch}/swt"
+ else
+ swtpath="${frameworkdir}/${vmarch}"
+ fi
+fi
+
+# Combine the swtpath and the framework dir path.
+if [ -d "$swtpath" ]; then
+ frameworkdir="${swtpath}:${frameworkdir}"
+else
+ echo "SWT folder '${swtpath}' does not exist."
+ echo "Please export ANDROID_SWT to point to the folder containing swt.jar for your platform."
+ exit 1
+fi
+
+if [ -x $progdir/monitor ]; then
+ echo "The standalone version of traceview is deprecated."
+ echo "Please use Android Device Monitor (tools/monitor) instead."
+fi
+exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.traceview.toolsdir="$progdir" -jar "$jarpath" "$@"