summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-11-28 23:26:46 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-11-28 23:26:46 +0000
commite563ed1bca5ea0421f654eef82d758ec25c10bdd (patch)
tree63e61a4796b350148cc1cd81d985d6942fa72885
parent1af0c23c7455a8ca5a992c9d5d8e09fa795cf5f3 (diff)
parent7b6c0c3b1354c09ccdb4b21648a3ce6dea588301 (diff)
downloadextras-oreo-m3-release.tar.gz
Change-Id: Id633fb23985f5fd6aea76c23edac7d35991e122f
-rw-r--r--ext4_utils/allocate.c6
-rwxr-xr-xext4_utils/mkuserimg_mke2fs.sh35
-rw-r--r--ioblame/README33
-rwxr-xr-xioblame/ioblame.sh223
-rw-r--r--simpleperf/cmd_record_test.cpp31
-rw-r--r--simpleperf/cmd_report_test.cpp1
-rw-r--r--simpleperf/test_util.h10
-rw-r--r--tests/kernel.config/Android.mk2
8 files changed, 267 insertions, 74 deletions
diff --git a/ext4_utils/allocate.c b/ext4_utils/allocate.c
index 28fc8e50..6bd77fa5 100644
--- a/ext4_utils/allocate.c
+++ b/ext4_utils/allocate.c
@@ -231,16 +231,20 @@ static int reserve_blocks(struct block_group_info *bg, u32 bg_num, u32 start, u3
static void free_blocks(struct block_group_info *bg, u32 block, u32 num_blocks)
{
unsigned int i;
+
+ if (num_blocks == 0)
+ return;
for (i = 0; i < num_blocks; i++, block--)
bg->block_bitmap[block / 8] &= ~(1 << (block % 8));
bg->free_blocks += num_blocks;
+ block++;
for (i = bg->chunk_count; i > 0 ;) {
--i;
if (bg->chunks[i].len >= num_blocks && bg->chunks[i].block <= block) {
if (bg->chunks[i].block == block) {
bg->chunks[i].block += num_blocks;
bg->chunks[i].len -= num_blocks;
- } else if (bg->chunks[i].block + bg->chunks[i].len - 1 == block + num_blocks) {
+ } else if (bg->chunks[i].block + bg->chunks[i].len == block + num_blocks) {
bg->chunks[i].len -= num_blocks;
}
break;
diff --git a/ext4_utils/mkuserimg_mke2fs.sh b/ext4_utils/mkuserimg_mke2fs.sh
index 64b1fe3f..ea73ff70 100755
--- a/ext4_utils/mkuserimg_mke2fs.sh
+++ b/ext4_utils/mkuserimg_mke2fs.sh
@@ -8,7 +8,8 @@ Usage:
mkuserimg.sh [-s] SRC_DIR OUTPUT_FILE EXT_VARIANT MOUNT_POINT SIZE [-j <journal_size>]
[-T TIMESTAMP] [-C FS_CONFIG] [-D PRODUCT_OUT] [-B BLOCK_LIST_FILE]
[-d BASE_ALLOC_FILE_IN ] [-A BASE_ALLOC_FILE_OUT ] [-L LABEL]
- [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE] [FILE_CONTEXTS]
+ [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE]
+ [-U MKE2FS_UUID] [-S MKE2FS_HASH_SEED] [FILE_CONTEXTS]
EOT
}
@@ -17,6 +18,7 @@ BLOCKSIZE=4096
MKE2FS_OPTS=""
MKE2FS_EXTENDED_OPTS=""
E2FSDROID_OPTS=""
+E2FSPROGS_FAKE_TIME=""
if [ "$1" = "-s" ]; then
MKE2FS_EXTENDED_OPTS+="android_sparse"
@@ -53,6 +55,7 @@ fi
if [[ "$1" == "-T" ]]; then
E2FSDROID_OPTS+=" -T $2"
+ E2FSPROGS_FAKE_TIME=$2
shift; shift
fi
@@ -108,6 +111,19 @@ if [[ "$1" == "-o" ]]; then
shift; shift
fi
+if [[ "$1" == "-U" ]]; then
+ MKE2FS_OPTS+=" -U $2"
+ shift; shift
+fi
+
+if [[ "$1" == "-S" ]]; then
+ if [[ $MKE2FS_EXTENDED_OPTS ]]; then
+ MKE2FS_EXTENDED_OPTS+=","
+ fi
+ MKE2FS_EXTENDED_OPTS+="hash_seed=$2"
+ shift; shift
+fi
+
if [[ $MKE2FS_EXTENDED_OPTS ]]; then
MKE2FS_OPTS+=" -E $MKE2FS_EXTENDED_OPTS"
fi
@@ -141,16 +157,25 @@ SIZE=$((SIZE / BLOCKSIZE))
# truncate output file since mke2fs will keep verity section in existing file
cat /dev/null >$OUTPUT_FILE
+MAKE_EXT4FS_ENV="MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf"
+if [[ $E2FSPROGS_FAKE_TIME ]]; then
+ MAKE_EXT4FS_ENV+=" E2FSPROGS_FAKE_TIME=$E2FSPROGS_FAKE_TIME"
+fi
+
MAKE_EXT4FS_CMD="mke2fs $MKE2FS_OPTS -t $EXT_VARIANT -b $BLOCKSIZE $OUTPUT_FILE $SIZE"
-echo $MAKE_EXT4FS_CMD
-MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf $MAKE_EXT4FS_CMD
+echo $MAKE_EXT4FS_ENV $MAKE_EXT4FS_CMD
+env $MAKE_EXT4FS_ENV $MAKE_EXT4FS_CMD
if [ $? -ne 0 ]; then
exit 4
fi
+if [[ $E2FSPROGS_FAKE_TIME ]]; then
+ E2FSDROID_ENV="E2FSPROGS_FAKE_TIME=$E2FSPROGS_FAKE_TIME"
+fi
+
E2FSDROID_CMD="e2fsdroid $E2FSDROID_OPTS -f $SRC_DIR -a $MOUNT_POINT $OUTPUT_FILE"
-echo $E2FSDROID_CMD
-$E2FSDROID_CMD
+echo $E2FSDROID_ENV $E2FSDROID_CMD
+env $E2FSDROID_ENV $E2FSDROID_CMD
if [ $? -ne 0 ]; then
rm -f $OUTPUT_FILE
exit 4
diff --git a/ioblame/README b/ioblame/README
index ebe80605..0813ff2b 100644
--- a/ioblame/README
+++ b/ioblame/README
@@ -13,6 +13,8 @@ What does the output from ioblame look like ?
-------------------------------------------
ioblame gives 2 different views.
+File view is the default.
+
1) File view : For each file, it gives a list of pids that are doing
IO on that file (it also gives the amount of IO each pid does and
the aggregate amount of IO done to the file by all pids).
@@ -40,8 +42,7 @@ File: /app/Gmail2Light/Gmail2Light.apk
And ditto for writes.
-2) PID view : For each pid actively doing IO, it dumps out the list of
-files that the pid does IO to.
+To enable PID view, use -v
PID: CrRendererMain
/app/Chrome/Chrome.apk Reads: 17012 KB i_size: 71354 KB
@@ -80,6 +81,11 @@ PID: CrRendererMain
And ditto for writes.
+For the -p, writepages option, ioblame does not (and cannot) give you
+the app/pid that did the original write (since the write most likely
+happens from a flush thread or VM reclaim). In this mode, we only get
+the pathname of the file and the amount of data written out.
+
Finally, it reports the total amount of file data IO done by pids and
the total IO done to the block device. So we can look at IO overheads
(eg block level prefetching, filesystem metadata overhead etc).
@@ -91,7 +97,9 @@ How do I run ioblame ?
--------------------
ioblame -r [ I am only interested in reads ]
ioblame -w [ I am only interested in writes ]
-ioblame -r -w [ I am only interested in reads and writes ]
+ioblame -p [ I am only interested in writepage(s) - mmap'ed writes ]
+ioblame -r -w -p [ I am only interested in reads, writes and writepages ]
+and finally, -v adds the PID view
1) The most common way of running ioblame is to start ioblame, then go
off and launch the app(s) of interest, do interesting stuff with the
@@ -102,7 +110,7 @@ dump out IO stats for the app.
example :
-srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w
+srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w -p
Found aosp_gobo Device
OK to kill sleep when test is done
^Csignal INT received, killing streaming trace capture
@@ -198,3 +206,20 @@ Date: Mon Sep 19 17:33:50 2016 -0700
Change-Id: I26bd36f933108927d6903da04d8cb42fd9c3ef3d
Signed-off-by: Mohan Srinivasan <srmohan@google.com>
+
+The -w (writepages) option requires this additional patch and
+currently only with f2fs.
+
+commit c60bc59c6af4fbdeaf7bbeaebee6b55d9e488324 (HEAD ->
+android-mtk-gobo-3.18)
+Author: Mohan Srinivasan <srmohan@google.com>
+Date: Fri Sep 8 13:53:01 2017 -0700
+
+ Tracepoints in f2fs data writepage(s).
+
+ Tracepoints f2fs writepage(s). This is experimental (for now).
+ Allowing ioblame to track <pathname, amount of data written>
+ for files.
+
+ Signed-off-by: Mohan Srinivasan <srmohan@google.com>
+ Change-Id: I4c76c6f442e0a2c5872225f8113935f9f368cc64
diff --git a/ioblame/ioblame.sh b/ioblame/ioblame.sh
index ec907abb..cdd1d30c 100755
--- a/ioblame/ioblame.sh
+++ b/ioblame/ioblame.sh
@@ -3,6 +3,8 @@
parseoptions() {
trace_reads=false
trace_writes=false
+ trace_writepages=false
+ pid_view=false
while [ $# -ge 1 ]
do
@@ -13,6 +15,12 @@ parseoptions() {
-w)
trace_writes=true
;;
+ -p)
+ trace_writepages=true
+ ;;
+ -v)
+ pid_view=true
+ ;;
*)
usage
;;
@@ -22,7 +30,7 @@ parseoptions() {
}
usage() {
- echo "Usage: $0 [-r|-w]"
+ echo "Usage: $0 [-r|-w|-p|-v]"
exit 1
}
@@ -33,7 +41,7 @@ getmodel() {
echo Found $model Device
case $model in
- aosp_gobo)
+ aosp_gobo | gobo)
get_go_devnames
;;
marlin | sailfish)
@@ -87,32 +95,32 @@ get_angler_devnames () {
disk_stats_before() {
if [ $bdev_set == true ]; then
DISKSTATS=`adb shell 'cat /proc/diskstats' | fgrep -w $block_device `
- if [ $trace_reads == true ]; then
- # Get BEFORE read stats for bdev
- BEFORE_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
- BEFORE_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
- fi
- if [ $trace_writes == true ]; then
- # Get BEFORE write stats for bdev
- BEFORE_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
- BEFORE_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
- fi
+ # Get BEFORE read stats for bdev
+ BEFORE_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
+ BEFORE_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
+ # Get BEFORE write stats for bdev
+ BEFORE_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
+ BEFORE_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
+ fi
+ if [ $f2fs_fs == 1 ] ; then
+ adb shell 'mount -o remount,background_gc=off /data'
+ F2FS_GC_SEGMENTS_BEFORE=`adb shell 'cat /sys/kernel/debug/f2fs/status' | grep segments | egrep 'data|node' | awk '{ segments += $5 } END { print segments }' `
fi
}
disk_stats_after() {
if [ $bdev_set == true ]; then
DISKSTATS=`adb shell 'cat /proc/diskstats' | fgrep -w $block_device `
- if [ $trace_reads == true ]; then
- # Get AFTER read stats for bdev
- AFTER_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
- AFTER_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
- fi
- if [ $trace_writes == true ]; then
- # Get BEFORE write stats for bdev
- AFTER_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
- AFTER_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
- fi
+ # Get AFTER read stats for bdev
+ AFTER_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
+ AFTER_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
+ # Get BEFORE write stats for bdev
+ AFTER_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
+ AFTER_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
+ fi
+ if [ $f2fs_fs == 1 ] ; then
+ F2FS_GC_SEGMENTS_AFTER=`adb shell 'cat /sys/kernel/debug/f2fs/status' | grep segments | egrep 'data|node' | awk '{ segments += $5 } END { print segments }' `
+ adb shell 'mount -o remount,background_gc=on /data'
fi
}
@@ -135,11 +143,14 @@ disk_stats_delta_wr() {
# Sectors to KB
WRITE_KB=`expr $AFTER_WR_SECTORS - $BEFORE_WR_SECTORS`
WRITE_KB=`expr $WRITE_KB / 2`
- echo "Total (ALL) Write KB $block_device = "$WRITE_KB
BLOCK_MINUS_FILE=`expr $WRITE_KB - $file_data_KB`
echo "WRITE DELTA: Total Blockdev Writes KB - Total File Data Writes KB = "$BLOCK_MINUS_FILE KB
echo "Total (ALL) Write IOs $block_device = "`expr $AFTER_WR_IOS - $BEFORE_WR_IOS`
fi
+ if [ $f2fs_fs == 1 ] ; then
+ F2FS_GC_SEGMENTS_DELTA=`expr $F2FS_GC_SEGMENTS_AFTER - $F2FS_GC_SEGMENTS_BEFORE`
+ F2FS_GC_KB_DELTA=`expr $F2FS_GC_SEGMENTS_DELTA \\* 2048`
+ fi
}
# For good measure clean up traces and reenable traces
@@ -155,11 +166,14 @@ clean_up_tracepoints() {
adb shell 'echo 0 > /sys/kernel/debug/tracing/trace'
if [ $trace_reads == true ]; then
adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable'
- adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_end/enable'
fi
if [ $trace_writes == true ]; then
adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable'
- adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_end/enable'
+ fi
+ if [ $f2fs_fs == 1 ] ; then
+ if [ $trace_writepages == true ]; then
+ adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable'
+ fi
fi
adb shell 'echo 1 > /sys/kernel/debug/tracing/tracing_on'
}
@@ -184,11 +198,14 @@ copyout_trace() {
streamtrace_end
if [ $trace_reads == true ]; then
adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable'
- adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_end/enable'
fi
if [ $trace_writes == true ]; then
adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable'
- adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_end/enable'
+ fi
+ if [ $f2fs_fs == 1 ] ; then
+ if [ $trace_writepages == true ]; then
+ adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable'
+ fi
fi
adb shell 'echo 0 > /sys/kernel/debug/tracing/tracing_on'
}
@@ -212,6 +229,15 @@ prep_tracefile_rd() {
rm foo0
}
+prep_tracefile_writepages() {
+ prep_tracefile_common android_fs_writepages
+ # Throw away everything up to and including android_fs_writepages_start:
+ cat $infile | sed -n -e 's/^.*android_fs_writepages //p' > foo1
+ mv foo1 $infile
+ # At this stage, $infile should the following format :
+ # entry_name <filename> bytes <bytes> ino <ino>
+}
+
# Latencies not supported for Writes. 'Write End' is just when the data has been
# written back to page cache.
prep_tracefile_wr() {
@@ -225,7 +251,7 @@ prep_tracefile_wr() {
rm foo0
}
-get_unique_files() {
+get_unique_files_rw() {
# Sort first by filename, then by pid
cat $infile | sed s/,//g | sort -d -k2,2 -k8,8 > foo1
mv foo1 $infile
@@ -236,6 +262,16 @@ get_unique_files() {
rm foo1
}
+get_unique_files_writepages() {
+ cat $infile | sed s/,//g | sort -d -k2,2 > foo1
+ # $infile now contains lines sorted by <filename>
+ mv foo1 $infile
+ # How many unique files are there ?
+ cat $infile | awk '{ print $2 }' > foo1
+ cat foo1 | uniq > uniq_files
+ rm foo1
+}
+
get_unique_pids_byfile() {
# How many unique pids are there reading this file ?
cat $1 | awk '{ print $8 }' > foo1
@@ -286,40 +322,66 @@ do_something() {
}
# Get the aggregate list of files read/written. For each file, break up the IOs by pid
-process_files() {
+process_files_rw() {
read_write=$1
- get_unique_files
- list_of_files=`cat uniq_files`
- # $list_of_files is a list of all the files involved in IO
- #
+ get_unique_files_rw
# Loop over each file that was involved in IO
# Find all the pids doing IO on that file
# Aggregate the IO done by each pid on that file and dump it out
- #
grand_total_KB=0
- for i in $list_of_files
+ cp $infile tempfile
+ for i in `cat uniq_files`
do
- echo "File: $i"
- total_file_KB=0
# Get just the tracepoints for this file
- fgrep -w "$i" $infile > subtrace
- # Get all the pids doing IO on this file
- get_unique_pids_byfile subtrace
- list_of_pids=`cat uniq_pids_byfile`
- # $list_of_pids is a list of all the pids doing IO to file $i
- for j in $list_of_pids
- do
- echo -n " $j $read_write: "
- pid_KB=`fgrep -w "$j" subtrace | awk '{ bytes += $6 } END { print bytes }' `
- pid_KB=`expr $pid_KB / 1024`
- echo "$pid_KB KB"
- total_file_KB=`expr $total_file_KB + $pid_KB`
- done
- i_size=`tail -n1 subtrace | awk '{ if ($12 > 1024) printf "%d KB", ($12/1024); else printf "%d bytes", $12; }' `
- echo " Total $read_write: $total_file_KB KB i_size: $i_size"
- grand_total_KB=`expr $grand_total_KB + $total_file_KB`
+ fgrep -w "$i" tempfile > subtrace
+ if [ -s subtrace ]; then
+ echo "File: $i"
+ total_file_KB=0
+ # Remove the tracepoints we just picked up
+ fgrep -v -w "$i" tempfile > foo
+ mv foo tempfile
+ # Get all the pids doing IO on this file
+ get_unique_pids_byfile subtrace
+ for j in `cat uniq_pids_byfile`
+ do
+ echo -n " $j $read_write: "
+ pid_KB=`fgrep -w "$j" subtrace | awk '{ bytes += $6 } END { print bytes }' `
+ pid_KB=`expr $pid_KB / 1024`
+ echo "$pid_KB KB"
+ total_file_KB=`expr $total_file_KB + $pid_KB`
+ done
+ i_size=`tail -n1 subtrace | awk '{ if ($12 > 1024) printf "%d KB", ($12/1024); else printf "%d bytes", $12; }' `
+ echo " Total $read_write: $total_file_KB KB i_size: $i_size"
+ grand_total_KB=`expr $grand_total_KB + $total_file_KB`
+ fi
done
echo "Grand Total File DATA KB $read_write $grand_total_KB"
+ rm tempfile
+}
+
+process_files_writepages() {
+ get_unique_files_writepages
+ # Loop over each file that was involved in IO
+ # Aggregate the IO done on that file and dump it out
+ grand_total_KB=0
+ cp $infile tempfile
+ for i in `cat uniq_files`
+ do
+ # Get just the tracepoints for this file
+ fgrep -w "$i" tempfile > subtrace
+ if [ -s subtrace ]; then
+ fgrep -v -w "$i" tempfile > foo
+ mv foo tempfile
+ total_file_KB=`cat subtrace | awk '{ bytes += $4 } END { print bytes }' `
+ total_file_KB=`expr $total_file_KB / 1024`
+ if [ $total_file_KB -gt 0 ]; then
+ echo "File: $i Total $read_write: $total_file_KB KB"
+ grand_total_KB=`expr $grand_total_KB + $total_file_KB`
+ fi
+ fi
+ done
+ echo "Grand Total File DATA KB Writepages $grand_total_KB"
+ rm tempfile
}
# Get the aggregate list of pids. For each pid, break up the IOs by file
@@ -371,6 +433,19 @@ parseoptions $@
adb root && sleep 2
getmodel
+found_f2fs=`adb shell 'mount | grep f2fs > /dev/null; echo $?' `
+
+if [ $found_f2fs == 0 ]; then
+ f2fs_fs=1
+else
+ f2fs_fs=0
+fi
+
+if [ $f2fs_fs == 0 ] && [ $trace_writepages == true ]; then
+ echo "Writepages is only supported with f2fs, please use -r, -w"
+ exit 1
+fi
+
prep_to_do_something
clean_up_tracepoints
@@ -393,10 +468,12 @@ if [ $trace_reads == true ]; then
prep_tracefile_rd
# Get file specific stats - for each file, how many pids read that file ?
echo "FILE VIEW:"
- process_files Reads
- # Get pid specific stats - for each pid, what files do they do IO on ?
- echo "PID VIEW:"
- process_pids Reads
+ process_files_rw Reads
+ if [ $pid_view == true ]; then
+ # Get pid specific stats - for each pid, what files do they do IO on ?
+ echo "PID VIEW:"
+ process_pids Reads
+ fi
disk_stats_delta_rd $grand_total_KB
debug_FileKB_rd=`cat $infile | awk '{ bytes += $6 } END { printf "%d", bytes/1024 }' `
@@ -410,15 +487,35 @@ if [ $trace_writes == true ]; then
echo
prep_tracefile_wr
# Get file specific stats - for each file, how many pids read that file ?
+
+ echo "FILE VIEW:"
+ process_files_rw Writes
+ if [ $pid_view == true ]; then
+ # Get pid specific stats - for each pid, what files do they do IO on ?
+ echo "PID VIEW:"
+ process_pids Writes
+ fi
+ disk_stats_delta_wr $grand_total_KB
+
+ if [ $f2fs_fs == 1 ] ; then
+ echo f2fs GC_KB delta = $F2FS_GC_KB_DELTA
+ fi
+fi
+
+if [ $f2fs_fs == 1 ] && [ $trace_writepages == true ] ; then
+ echo
+ echo "Writepages :"
+ echo "__________"
+ echo
+ prep_tracefile_writepages
+ # Get file specific stats - for each file, how much did we writepage ?
+
echo "FILE VIEW:"
- process_files Writes
- # Get pid specific stats - for each pid, what files do they do IO on ?
- echo "PID VIEW:"
- process_pids Writes
+ process_files_writepages
+
disk_stats_delta_wr $grand_total_KB
- debug_FileKB_wr=`cat $infile | awk '{ bytes += $6 } END { printf "%d", bytes/1024 }' `
- echo Debug Grand Total KB WRITTEN $debug_FileKB_wr
+ echo f2fs GC_KB delta = $F2FS_GC_KB_DELTA
fi
rm -rf tracefile* uniq_* subtrace trace_saved
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 8b70fcd2..c3f9cb40 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -16,6 +16,8 @@
#include <gtest/gtest.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <android-base/file.h>
@@ -155,7 +157,31 @@ TEST(record_cmd, system_wide_fp_callchain_sampling) {
TEST_IN_ROOT(ASSERT_TRUE(RunRecordCmd({"-a", "--call-graph", "fp"})));
}
+bool IsInNativeAbi() {
+ static int in_native_abi = -1;
+ if (in_native_abi == -1) {
+ FILE* fp = popen("uname -m", "re");
+ char buf[40];
+ memset(buf, '\0', sizeof(buf));
+ fgets(buf, sizeof(buf), fp);
+ pclose(fp);
+ std::string s = buf;
+ in_native_abi = 1;
+ if (GetBuildArch() == ARCH_X86_32 || GetBuildArch() == ARCH_X86_64) {
+ if (s.find("86") == std::string::npos) {
+ in_native_abi = 0;
+ }
+ } else if (GetBuildArch() == ARCH_ARM || GetBuildArch() == ARCH_ARM64) {
+ if (s.find("arm") == std::string::npos && s.find("aarch64") == std::string::npos) {
+ in_native_abi = 0;
+ }
+ }
+ }
+ return in_native_abi == 1;
+}
+
TEST(record_cmd, dwarf_callchain_sampling) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
std::vector<std::unique_ptr<Workload>> workloads;
CreateProcesses(1, &workloads);
@@ -167,17 +193,20 @@ TEST(record_cmd, dwarf_callchain_sampling) {
}
TEST(record_cmd, system_wide_dwarf_callchain_sampling) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
TEST_IN_ROOT(RunRecordCmd({"-a", "--call-graph", "dwarf"}));
}
TEST(record_cmd, no_unwind_option) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
ASSERT_TRUE(RunRecordCmd({"--call-graph", "dwarf", "--no-unwind"}));
ASSERT_FALSE(RunRecordCmd({"--no-unwind"}));
}
TEST(record_cmd, post_unwind_option) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
std::vector<std::unique_ptr<Workload>> workloads;
CreateProcesses(1, &workloads);
@@ -296,6 +325,7 @@ TEST(record_cmd, no_dump_symbols) {
ASSERT_TRUE(RunRecordCmd({"--no-dump-symbols"}, tmpfile.path));
CheckDsoSymbolRecords(tmpfile.path, false, &success);
ASSERT_TRUE(success);
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
std::vector<std::unique_ptr<Workload>> workloads;
CreateProcesses(1, &workloads);
@@ -431,6 +461,7 @@ TEST(record_cmd, cpu_clock_for_a_long_time) {
}
TEST(record_cmd, dump_regs_for_tracepoint_events) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
// Check if the kernel can dump registers for tracepoint events.
// If not, probably a kernel patch below is missing:
// "5b09a094f2 arm64: perf: Fix callchain parse error with kernel tracepoint events"
diff --git a/simpleperf/cmd_report_test.cpp b/simpleperf/cmd_report_test.cpp
index f1f5b1fc..e146876b 100644
--- a/simpleperf/cmd_report_test.cpp
+++ b/simpleperf/cmd_report_test.cpp
@@ -479,6 +479,7 @@ static std::unique_ptr<Command> RecordCmd() {
}
TEST_F(ReportCommandTest, dwarf_callgraph) {
+ OMIT_TEST_ON_NON_NATIVE_ABIS();
ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
std::vector<std::unique_ptr<Workload>> workloads;
CreateProcesses(1, &workloads);
diff --git a/simpleperf/test_util.h b/simpleperf/test_util.h
index f242c896..5d214269 100644
--- a/simpleperf/test_util.h
+++ b/simpleperf/test_util.h
@@ -40,3 +40,13 @@ bool IsRoot();
GTEST_LOG_(INFO) << "Didn't test \"" << #TestStatement << "\" requires root privileges"; \
} \
} while (0)
+
+bool IsInNativeAbi();
+// Used to skip tests not supposed to run on non-native ABIs.
+#define OMIT_TEST_ON_NON_NATIVE_ABIS() \
+ do { \
+ if (!IsInNativeAbi()) { \
+ GTEST_LOG_(INFO) << "Skip this test as it only runs on native ABIs."; \
+ return; \
+ } \
+ } while (0)
diff --git a/tests/kernel.config/Android.mk b/tests/kernel.config/Android.mk
index 44d7931f..a9def5e3 100644
--- a/tests/kernel.config/Android.mk
+++ b/tests/kernel.config/Android.mk
@@ -18,7 +18,6 @@ cts_src_files := \
logger_test.cpp \
multicast_test.cpp \
nfs_test.cpp \
- pstore_test.cpp \
sysvipc_test.cpp \
# Required plus Recommended Tests
@@ -28,6 +27,7 @@ test_src_files := \
aslr_test.cpp \
aslr_rec_test.cpp \
mmc_max_speed_test.cpp \
+ pstore_test.cpp \
include $(CLEAR_VARS)
LOCAL_MODULE := kernel-config-unit-tests