Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-extras: Commit

system/extras


Commit MetaInfo

Revision24df0a87d1ea572091a6a0199c08f8481e8e35a3 (tree)
Time2017-09-22 06:55:59
Authorandroid-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Log Message

release-request-a84b3435-75fa-41e8-bd3c-ca0f4cbd5cc5-for-git_oc-m2-release-4352002 snap-temp-L88700000105039240

Change-Id: I841f4fce77b2dbe7bd35cfc699323ef1d2d78af6

Change Summary

Incremental Difference

--- 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
231231 static void free_blocks(struct block_group_info *bg, u32 block, u32 num_blocks)
232232 {
233233 unsigned int i;
234+
235+ if (num_blocks == 0)
236+ return;
234237 for (i = 0; i < num_blocks; i++, block--)
235238 bg->block_bitmap[block / 8] &= ~(1 << (block % 8));
236239 bg->free_blocks += num_blocks;
240+ block++;
237241 for (i = bg->chunk_count; i > 0 ;) {
238242 --i;
239243 if (bg->chunks[i].len >= num_blocks && bg->chunks[i].block <= block) {
240244 if (bg->chunks[i].block == block) {
241245 bg->chunks[i].block += num_blocks;
242246 bg->chunks[i].len -= num_blocks;
243- } else if (bg->chunks[i].block + bg->chunks[i].len - 1 == block + num_blocks) {
247+ } else if (bg->chunks[i].block + bg->chunks[i].len == block + num_blocks) {
244248 bg->chunks[i].len -= num_blocks;
245249 }
246250 break;
--- a/ioblame/README
+++ b/ioblame/README
@@ -13,6 +13,8 @@ What does the output from ioblame look like ?
1313 -------------------------------------------
1414 ioblame gives 2 different views.
1515
16+File view is the default.
17+
1618 1) File view : For each file, it gives a list of pids that are doing
1719 IO on that file (it also gives the amount of IO each pid does and
1820 the aggregate amount of IO done to the file by all pids).
@@ -40,8 +42,7 @@ File: /app/Gmail2Light/Gmail2Light.apk
4042
4143 And ditto for writes.
4244
43-2) PID view : For each pid actively doing IO, it dumps out the list of
44-files that the pid does IO to.
45+To enable PID view, use -v
4546
4647 PID: CrRendererMain
4748 /app/Chrome/Chrome.apk Reads: 17012 KB i_size: 71354 KB
@@ -80,6 +81,11 @@ PID: CrRendererMain
8081
8182 And ditto for writes.
8283
84+For the -p, writepages option, ioblame does not (and cannot) give you
85+the app/pid that did the original write (since the write most likely
86+happens from a flush thread or VM reclaim). In this mode, we only get
87+the pathname of the file and the amount of data written out.
88+
8389 Finally, it reports the total amount of file data IO done by pids and
8490 the total IO done to the block device. So we can look at IO overheads
8591 (eg block level prefetching, filesystem metadata overhead etc).
@@ -91,7 +97,9 @@ How do I run ioblame ?
9197 --------------------
9298 ioblame -r [ I am only interested in reads ]
9399 ioblame -w [ I am only interested in writes ]
94-ioblame -r -w [ I am only interested in reads and writes ]
100+ioblame -p [ I am only interested in writepage(s) - mmap'ed writes ]
101+ioblame -r -w -p [ I am only interested in reads, writes and writepages ]
102+and finally, -v adds the PID view
95103
96104 1) The most common way of running ioblame is to start ioblame, then go
97105 off and launch the app(s) of interest, do interesting stuff with the
@@ -102,7 +110,7 @@ dump out IO stats for the app.
102110
103111 example :
104112
105-srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w
113+srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w -p
106114 Found aosp_gobo Device
107115 OK to kill sleep when test is done
108116 ^Csignal INT received, killing streaming trace capture
@@ -198,3 +206,20 @@ Date: Mon Sep 19 17:33:50 2016 -0700
198206
199207 Change-Id: I26bd36f933108927d6903da04d8cb42fd9c3ef3d
200208 Signed-off-by: Mohan Srinivasan <srmohan@google.com>
209+
210+The -w (writepages) option requires this additional patch and
211+currently only with f2fs.
212+
213+commit c60bc59c6af4fbdeaf7bbeaebee6b55d9e488324 (HEAD ->
214+android-mtk-gobo-3.18)
215+Author: Mohan Srinivasan <srmohan@google.com>
216+Date: Fri Sep 8 13:53:01 2017 -0700
217+
218+ Tracepoints in f2fs data writepage(s).
219+
220+ Tracepoints f2fs writepage(s). This is experimental (for now).
221+ Allowing ioblame to track <pathname, amount of data written>
222+ for files.
223+
224+ Signed-off-by: Mohan Srinivasan <srmohan@google.com>
225+ Change-Id: I4c76c6f442e0a2c5872225f8113935f9f368cc64
--- a/ioblame/ioblame.sh
+++ b/ioblame/ioblame.sh
@@ -3,6 +3,8 @@
33 parseoptions() {
44 trace_reads=false
55 trace_writes=false
6+ trace_writepages=false
7+ pid_view=false
68
79 while [ $# -ge 1 ]
810 do
@@ -13,6 +15,12 @@ parseoptions() {
1315 -w)
1416 trace_writes=true
1517 ;;
18+ -p)
19+ trace_writepages=true
20+ ;;
21+ -v)
22+ pid_view=true
23+ ;;
1624 *)
1725 usage
1826 ;;
@@ -22,7 +30,7 @@ parseoptions() {
2230 }
2331
2432 usage() {
25- echo "Usage: $0 [-r|-w]"
33+ echo "Usage: $0 [-r|-w|-p|-v]"
2634 exit 1
2735 }
2836
@@ -33,7 +41,7 @@ getmodel() {
3341 echo Found $model Device
3442
3543 case $model in
36- aosp_gobo)
44+ aosp_gobo | gobo)
3745 get_go_devnames
3846 ;;
3947 marlin | sailfish)
@@ -87,32 +95,32 @@ get_angler_devnames () {
8795 disk_stats_before() {
8896 if [ $bdev_set == true ]; then
8997 DISKSTATS=`adb shell 'cat /proc/diskstats' | fgrep -w $block_device `
90- if [ $trace_reads == true ]; then
91- # Get BEFORE read stats for bdev
92- BEFORE_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
93- BEFORE_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
94- fi
95- if [ $trace_writes == true ]; then
96- # Get BEFORE write stats for bdev
97- BEFORE_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
98- BEFORE_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
99- fi
98+ # Get BEFORE read stats for bdev
99+ BEFORE_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
100+ BEFORE_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
101+ # Get BEFORE write stats for bdev
102+ BEFORE_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
103+ BEFORE_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
104+ fi
105+ if [ $f2fs_fs == 1 ] ; then
106+ adb shell 'mount -o remount,background_gc=off /data'
107+ F2FS_GC_SEGMENTS_BEFORE=`adb shell 'cat /sys/kernel/debug/f2fs/status' | grep segments | egrep 'data|node' | awk '{ segments += $5 } END { print segments }' `
100108 fi
101109 }
102110
103111 disk_stats_after() {
104112 if [ $bdev_set == true ]; then
105113 DISKSTATS=`adb shell 'cat /proc/diskstats' | fgrep -w $block_device `
106- if [ $trace_reads == true ]; then
107- # Get AFTER read stats for bdev
108- AFTER_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
109- AFTER_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
110- fi
111- if [ $trace_writes == true ]; then
112- # Get BEFORE write stats for bdev
113- AFTER_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
114- AFTER_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
115- fi
114+ # Get AFTER read stats for bdev
115+ AFTER_RD_IOS=`echo $DISKSTATS | awk '{ print $4 }' `
116+ AFTER_RD_SECTORS=`echo $DISKSTATS | awk '{ print $6 }' `
117+ # Get BEFORE write stats for bdev
118+ AFTER_WR_IOS=`echo $DISKSTATS | awk '{ print $8 }' `
119+ AFTER_WR_SECTORS=`echo $DISKSTATS | awk '{ print $10 }' `
120+ fi
121+ if [ $f2fs_fs == 1 ] ; then
122+ F2FS_GC_SEGMENTS_AFTER=`adb shell 'cat /sys/kernel/debug/f2fs/status' | grep segments | egrep 'data|node' | awk '{ segments += $5 } END { print segments }' `
123+ adb shell 'mount -o remount,background_gc=on /data'
116124 fi
117125 }
118126
@@ -135,11 +143,14 @@ disk_stats_delta_wr() {
135143 # Sectors to KB
136144 WRITE_KB=`expr $AFTER_WR_SECTORS - $BEFORE_WR_SECTORS`
137145 WRITE_KB=`expr $WRITE_KB / 2`
138- echo "Total (ALL) Write KB $block_device = "$WRITE_KB
139146 BLOCK_MINUS_FILE=`expr $WRITE_KB - $file_data_KB`
140147 echo "WRITE DELTA: Total Blockdev Writes KB - Total File Data Writes KB = "$BLOCK_MINUS_FILE KB
141148 echo "Total (ALL) Write IOs $block_device = "`expr $AFTER_WR_IOS - $BEFORE_WR_IOS`
142149 fi
150+ if [ $f2fs_fs == 1 ] ; then
151+ F2FS_GC_SEGMENTS_DELTA=`expr $F2FS_GC_SEGMENTS_AFTER - $F2FS_GC_SEGMENTS_BEFORE`
152+ F2FS_GC_KB_DELTA=`expr $F2FS_GC_SEGMENTS_DELTA \\* 2048`
153+ fi
143154 }
144155
145156 # For good measure clean up traces and reenable traces
@@ -155,11 +166,14 @@ clean_up_tracepoints() {
155166 adb shell 'echo 0 > /sys/kernel/debug/tracing/trace'
156167 if [ $trace_reads == true ]; then
157168 adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable'
158- adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_end/enable'
159169 fi
160170 if [ $trace_writes == true ]; then
161171 adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable'
162- adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_end/enable'
172+ fi
173+ if [ $f2fs_fs == 1 ] ; then
174+ if [ $trace_writepages == true ]; then
175+ adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable'
176+ fi
163177 fi
164178 adb shell 'echo 1 > /sys/kernel/debug/tracing/tracing_on'
165179 }
@@ -184,11 +198,14 @@ copyout_trace() {
184198 streamtrace_end
185199 if [ $trace_reads == true ]; then
186200 adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable'
187- adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_end/enable'
188201 fi
189202 if [ $trace_writes == true ]; then
190203 adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable'
191- adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_end/enable'
204+ fi
205+ if [ $f2fs_fs == 1 ] ; then
206+ if [ $trace_writepages == true ]; then
207+ adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable'
208+ fi
192209 fi
193210 adb shell 'echo 0 > /sys/kernel/debug/tracing/tracing_on'
194211 }
@@ -212,6 +229,15 @@ prep_tracefile_rd() {
212229 rm foo0
213230 }
214231
232+prep_tracefile_writepages() {
233+ prep_tracefile_common android_fs_writepages
234+ # Throw away everything up to and including android_fs_writepages_start:
235+ cat $infile | sed -n -e 's/^.*android_fs_writepages //p' > foo1
236+ mv foo1 $infile
237+ # At this stage, $infile should the following format :
238+ # entry_name <filename> bytes <bytes> ino <ino>
239+}
240+
215241 # Latencies not supported for Writes. 'Write End' is just when the data has been
216242 # written back to page cache.
217243 prep_tracefile_wr() {
@@ -225,7 +251,7 @@ prep_tracefile_wr() {
225251 rm foo0
226252 }
227253
228-get_unique_files() {
254+get_unique_files_rw() {
229255 # Sort first by filename, then by pid
230256 cat $infile | sed s/,//g | sort -d -k2,2 -k8,8 > foo1
231257 mv foo1 $infile
@@ -236,6 +262,16 @@ get_unique_files() {
236262 rm foo1
237263 }
238264
265+get_unique_files_writepages() {
266+ cat $infile | sed s/,//g | sort -d -k2,2 > foo1
267+ # $infile now contains lines sorted by <filename>
268+ mv foo1 $infile
269+ # How many unique files are there ?
270+ cat $infile | awk '{ print $2 }' > foo1
271+ cat foo1 | uniq > uniq_files
272+ rm foo1
273+}
274+
239275 get_unique_pids_byfile() {
240276 # How many unique pids are there reading this file ?
241277 cat $1 | awk '{ print $8 }' > foo1
@@ -286,40 +322,66 @@ do_something() {
286322 }
287323
288324 # Get the aggregate list of files read/written. For each file, break up the IOs by pid
289-process_files() {
325+process_files_rw() {
290326 read_write=$1
291- get_unique_files
292- list_of_files=`cat uniq_files`
293- # $list_of_files is a list of all the files involved in IO
294- #
327+ get_unique_files_rw
295328 # Loop over each file that was involved in IO
296329 # Find all the pids doing IO on that file
297330 # Aggregate the IO done by each pid on that file and dump it out
298- #
299331 grand_total_KB=0
300- for i in $list_of_files
332+ cp $infile tempfile
333+ for i in `cat uniq_files`
301334 do
302- echo "File: $i"
303- total_file_KB=0
304335 # Get just the tracepoints for this file
305- fgrep -w "$i" $infile > subtrace
306- # Get all the pids doing IO on this file
307- get_unique_pids_byfile subtrace
308- list_of_pids=`cat uniq_pids_byfile`
309- # $list_of_pids is a list of all the pids doing IO to file $i
310- for j in $list_of_pids
311- do
312- echo -n " $j $read_write: "
313- pid_KB=`fgrep -w "$j" subtrace | awk '{ bytes += $6 } END { print bytes }' `
314- pid_KB=`expr $pid_KB / 1024`
315- echo "$pid_KB KB"
316- total_file_KB=`expr $total_file_KB + $pid_KB`
317- done
318- i_size=`tail -n1 subtrace | awk '{ if ($12 > 1024) printf "%d KB", ($12/1024); else printf "%d bytes", $12; }' `
319- echo " Total $read_write: $total_file_KB KB i_size: $i_size"
320- grand_total_KB=`expr $grand_total_KB + $total_file_KB`
336+ fgrep -w "$i" tempfile > subtrace
337+ if [ -s subtrace ]; then
338+ echo "File: $i"
339+ total_file_KB=0
340+ # Remove the tracepoints we just picked up
341+ fgrep -v -w "$i" tempfile > foo
342+ mv foo tempfile
343+ # Get all the pids doing IO on this file
344+ get_unique_pids_byfile subtrace
345+ for j in `cat uniq_pids_byfile`
346+ do
347+ echo -n " $j $read_write: "
348+ pid_KB=`fgrep -w "$j" subtrace | awk '{ bytes += $6 } END { print bytes }' `
349+ pid_KB=`expr $pid_KB / 1024`
350+ echo "$pid_KB KB"
351+ total_file_KB=`expr $total_file_KB + $pid_KB`
352+ done
353+ i_size=`tail -n1 subtrace | awk '{ if ($12 > 1024) printf "%d KB", ($12/1024); else printf "%d bytes", $12; }' `
354+ echo " Total $read_write: $total_file_KB KB i_size: $i_size"
355+ grand_total_KB=`expr $grand_total_KB + $total_file_KB`
356+ fi
321357 done
322358 echo "Grand Total File DATA KB $read_write $grand_total_KB"
359+ rm tempfile
360+}
361+
362+process_files_writepages() {
363+ get_unique_files_writepages
364+ # Loop over each file that was involved in IO
365+ # Aggregate the IO done on that file and dump it out
366+ grand_total_KB=0
367+ cp $infile tempfile
368+ for i in `cat uniq_files`
369+ do
370+ # Get just the tracepoints for this file
371+ fgrep -w "$i" tempfile > subtrace
372+ if [ -s subtrace ]; then
373+ fgrep -v -w "$i" tempfile > foo
374+ mv foo tempfile
375+ total_file_KB=`cat subtrace | awk '{ bytes += $4 } END { print bytes }' `
376+ total_file_KB=`expr $total_file_KB / 1024`
377+ if [ $total_file_KB -gt 0 ]; then
378+ echo "File: $i Total $read_write: $total_file_KB KB"
379+ grand_total_KB=`expr $grand_total_KB + $total_file_KB`
380+ fi
381+ fi
382+ done
383+ echo "Grand Total File DATA KB Writepages $grand_total_KB"
384+ rm tempfile
323385 }
324386
325387 # Get the aggregate list of pids. For each pid, break up the IOs by file
@@ -371,6 +433,19 @@ parseoptions $@
371433 adb root && sleep 2
372434 getmodel
373435
436+found_f2fs=`adb shell 'mount | grep f2fs > /dev/null; echo $?' `
437+
438+if [ $found_f2fs == 0 ]; then
439+ f2fs_fs=1
440+else
441+ f2fs_fs=0
442+fi
443+
444+if [ $f2fs_fs == 0 ] && [ $trace_writepages == true ]; then
445+ echo "Writepages is only supported with f2fs, please use -r, -w"
446+ exit 1
447+fi
448+
374449 prep_to_do_something
375450
376451 clean_up_tracepoints
@@ -393,10 +468,12 @@ if [ $trace_reads == true ]; then
393468 prep_tracefile_rd
394469 # Get file specific stats - for each file, how many pids read that file ?
395470 echo "FILE VIEW:"
396- process_files Reads
397- # Get pid specific stats - for each pid, what files do they do IO on ?
398- echo "PID VIEW:"
399- process_pids Reads
471+ process_files_rw Reads
472+ if [ $pid_view == true ]; then
473+ # Get pid specific stats - for each pid, what files do they do IO on ?
474+ echo "PID VIEW:"
475+ process_pids Reads
476+ fi
400477 disk_stats_delta_rd $grand_total_KB
401478
402479 debug_FileKB_rd=`cat $infile | awk '{ bytes += $6 } END { printf "%d", bytes/1024 }' `
@@ -410,15 +487,35 @@ if [ $trace_writes == true ]; then
410487 echo
411488 prep_tracefile_wr
412489 # Get file specific stats - for each file, how many pids read that file ?
490+
491+ echo "FILE VIEW:"
492+ process_files_rw Writes
493+ if [ $pid_view == true ]; then
494+ # Get pid specific stats - for each pid, what files do they do IO on ?
495+ echo "PID VIEW:"
496+ process_pids Writes
497+ fi
498+ disk_stats_delta_wr $grand_total_KB
499+
500+ if [ $f2fs_fs == 1 ] ; then
501+ echo f2fs GC_KB delta = $F2FS_GC_KB_DELTA
502+ fi
503+fi
504+
505+if [ $f2fs_fs == 1 ] && [ $trace_writepages == true ] ; then
506+ echo
507+ echo "Writepages :"
508+ echo "__________"
509+ echo
510+ prep_tracefile_writepages
511+ # Get file specific stats - for each file, how much did we writepage ?
512+
413513 echo "FILE VIEW:"
414- process_files Writes
415- # Get pid specific stats - for each pid, what files do they do IO on ?
416- echo "PID VIEW:"
417- process_pids Writes
514+ process_files_writepages
515+
418516 disk_stats_delta_wr $grand_total_KB
419517
420- debug_FileKB_wr=`cat $infile | awk '{ bytes += $6 } END { printf "%d", bytes/1024 }' `
421- echo Debug Grand Total KB WRITTEN $debug_FileKB_wr
518+ echo f2fs GC_KB delta = $F2FS_GC_KB_DELTA
422519 fi
423520
424521 rm -rf tracefile* uniq_* subtrace trace_saved
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -16,6 +16,8 @@
1616
1717 #include <gtest/gtest.h>
1818
19+#include <stdio.h>
20+#include <stdlib.h>
1921 #include <unistd.h>
2022
2123 #include <android-base/file.h>
@@ -155,7 +157,31 @@ TEST(record_cmd, system_wide_fp_callchain_sampling) {
155157 TEST_IN_ROOT(ASSERT_TRUE(RunRecordCmd({"-a", "--call-graph", "fp"})));
156158 }
157159
160+bool IsInNativeAbi() {
161+ static int in_native_abi = -1;
162+ if (in_native_abi == -1) {
163+ FILE* fp = popen("uname -m", "re");
164+ char buf[40];
165+ memset(buf, '\0', sizeof(buf));
166+ fgets(buf, sizeof(buf), fp);
167+ pclose(fp);
168+ std::string s = buf;
169+ in_native_abi = 1;
170+ if (GetBuildArch() == ARCH_X86_32 || GetBuildArch() == ARCH_X86_64) {
171+ if (s.find("86") == std::string::npos) {
172+ in_native_abi = 0;
173+ }
174+ } else if (GetBuildArch() == ARCH_ARM || GetBuildArch() == ARCH_ARM64) {
175+ if (s.find("arm") == std::string::npos && s.find("aarch64") == std::string::npos) {
176+ in_native_abi = 0;
177+ }
178+ }
179+ }
180+ return in_native_abi == 1;
181+}
182+
158183 TEST(record_cmd, dwarf_callchain_sampling) {
184+ OMIT_TEST_ON_NON_NATIVE_ABIS();
159185 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
160186 std::vector<std::unique_ptr<Workload>> workloads;
161187 CreateProcesses(1, &workloads);
@@ -167,17 +193,20 @@ TEST(record_cmd, dwarf_callchain_sampling) {
167193 }
168194
169195 TEST(record_cmd, system_wide_dwarf_callchain_sampling) {
196+ OMIT_TEST_ON_NON_NATIVE_ABIS();
170197 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
171198 TEST_IN_ROOT(RunRecordCmd({"-a", "--call-graph", "dwarf"}));
172199 }
173200
174201 TEST(record_cmd, no_unwind_option) {
202+ OMIT_TEST_ON_NON_NATIVE_ABIS();
175203 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
176204 ASSERT_TRUE(RunRecordCmd({"--call-graph", "dwarf", "--no-unwind"}));
177205 ASSERT_FALSE(RunRecordCmd({"--no-unwind"}));
178206 }
179207
180208 TEST(record_cmd, post_unwind_option) {
209+ OMIT_TEST_ON_NON_NATIVE_ABIS();
181210 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
182211 std::vector<std::unique_ptr<Workload>> workloads;
183212 CreateProcesses(1, &workloads);
@@ -296,6 +325,7 @@ TEST(record_cmd, no_dump_symbols) {
296325 ASSERT_TRUE(RunRecordCmd({"--no-dump-symbols"}, tmpfile.path));
297326 CheckDsoSymbolRecords(tmpfile.path, false, &success);
298327 ASSERT_TRUE(success);
328+ OMIT_TEST_ON_NON_NATIVE_ABIS();
299329 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
300330 std::vector<std::unique_ptr<Workload>> workloads;
301331 CreateProcesses(1, &workloads);
@@ -431,6 +461,7 @@ TEST(record_cmd, cpu_clock_for_a_long_time) {
431461 }
432462
433463 TEST(record_cmd, dump_regs_for_tracepoint_events) {
464+ OMIT_TEST_ON_NON_NATIVE_ABIS();
434465 // Check if the kernel can dump registers for tracepoint events.
435466 // If not, probably a kernel patch below is missing:
436467 // "5b09a094f2 arm64: perf: Fix callchain parse error with kernel tracepoint events"
--- a/simpleperf/cmd_report_test.cpp
+++ b/simpleperf/cmd_report_test.cpp
@@ -479,6 +479,7 @@ static std::unique_ptr<Command> RecordCmd() {
479479 }
480480
481481 TEST_F(ReportCommandTest, dwarf_callgraph) {
482+ OMIT_TEST_ON_NON_NATIVE_ABIS();
482483 ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
483484 std::vector<std::unique_ptr<Workload>> workloads;
484485 CreateProcesses(1, &workloads);
--- a/simpleperf/test_util.h
+++ b/simpleperf/test_util.h
@@ -40,3 +40,13 @@ bool IsRoot();
4040 GTEST_LOG_(INFO) << "Didn't test \"" << #TestStatement << "\" requires root privileges"; \
4141 } \
4242 } while (0)
43+
44+bool IsInNativeAbi();
45+// Used to skip tests not supposed to run on non-native ABIs.
46+#define OMIT_TEST_ON_NON_NATIVE_ABIS() \
47+ do { \
48+ if (!IsInNativeAbi()) { \
49+ GTEST_LOG_(INFO) << "Skip this test as it only runs on native ABIs."; \
50+ return; \
51+ } \
52+ } while (0)
Show on old repository browser