summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-07-03 13:25:28 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2023-07-03 13:25:28 +0100
commit03b3e9dbad7ff6a27f279d153de2b8e2f465b020 (patch)
tree1ac3b9ecf5fa4b5f85348dab39ac8df1f73ad1be
parentbcdcbf79a1cf9fbe012298283be6ccaa23336600 (diff)
Add the perf inject commands in the art script.
Test: art script Change-Id: Icb3786a3fafcda6f93d1af1c16f4f1c1e439476e
-rw-r--r--compiler/jit/jit_logger.h2
-rwxr-xr-xtools/art9
2 files changed, 8 insertions, 3 deletions
diff --git a/compiler/jit/jit_logger.h b/compiler/jit/jit_logger.h
index 9d1f3073fa..79f47f817f 100644
--- a/compiler/jit/jit_logger.h
+++ b/compiler/jit/jit_logger.h
@@ -53,7 +53,7 @@ namespace jit {
//
// Command line Example:
// $ perf record -k mono dalvikvm -Xcompiler-option --generate-debug-info -cp <classpath> Test
-// $ perf inject -i perf.data -o perf.data.jitted
+// $ perf inject -j -i perf.data -o perf.data.jitted
// $ perf report -i perf.data.jitted
// $ perf annotate -i perf.data.jitted
// NOTE:
diff --git a/tools/art b/tools/art
index 9471c137c5..a811951a46 100755
--- a/tools/art
+++ b/tools/art
@@ -615,7 +615,8 @@ if [ "$DEX2OAT_BCP" != "" ]; then
fi
if [ "$PERF" != "" ]; then
- LAUNCH_WRAPPER="perf record -g --call-graph dwarf -F 10000 -o $ANDROID_DATA/perf.data -e cycles:u $LAUNCH_WRAPPER"
+ # -k is for supporting jitted code.
+ LAUNCH_WRAPPER="perf record -k 1 -g --call-graph dwarf -F 10000 -o $ANDROID_DATA/perf.data -e cycles:u $LAUNCH_WRAPPER"
DEX2OAT_FLAGS+=(--generate-debug-info)
fi
@@ -685,8 +686,12 @@ EXIT_STATUS=$?
if [ "$PERF" != "" ]; then
if [ "$PERF" = report ]; then
perf report -i $ANDROID_DATA/perf.data
+ else
+ # Inject jitted code in perf.data. Keep the old perf.data for debugging.
+ mv $ANDROID_DATA/perf.data $ANDROID_DATA/perf.data.old
+ perf inject -j -i $ANDROID_DATA/perf.data.old -o $ANDROID_DATA/perf.data
+ echo "Perf data saved in: $ANDROID_DATA/perf.data. Generated oat files not removed."
fi
- echo "Perf data saved in: $ANDROID_DATA/perf.data. Generated oat files not removed."
else
# Perf needs the odex files we generate for proper symbolization, so only remove them
# when not running with perf.