system/extras
Revision | 24df0a87d1ea572091a6a0199c08f8481e8e35a3 (tree) |
---|---|
Time | 2017-09-22 06:55:59 |
Author | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
release-request-a84b3435-75fa-41e8-bd3c-ca0f4cbd5cc5-for-git_oc-m2-release-4352002 snap-temp-L88700000105039240
Change-Id: I841f4fce77b2dbe7bd35cfc699323ef1d2d78af6
@@ -231,16 +231,20 @@ static int reserve_blocks(struct block_group_info *bg, u32 bg_num, u32 start, u3 | ||
231 | 231 | static void free_blocks(struct block_group_info *bg, u32 block, u32 num_blocks) |
232 | 232 | { |
233 | 233 | unsigned int i; |
234 | + | |
235 | + if (num_blocks == 0) | |
236 | + return; | |
234 | 237 | for (i = 0; i < num_blocks; i++, block--) |
235 | 238 | bg->block_bitmap[block / 8] &= ~(1 << (block % 8)); |
236 | 239 | bg->free_blocks += num_blocks; |
240 | + block++; | |
237 | 241 | for (i = bg->chunk_count; i > 0 ;) { |
238 | 242 | --i; |
239 | 243 | if (bg->chunks[i].len >= num_blocks && bg->chunks[i].block <= block) { |
240 | 244 | if (bg->chunks[i].block == block) { |
241 | 245 | bg->chunks[i].block += num_blocks; |
242 | 246 | 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) { | |
244 | 248 | bg->chunks[i].len -= num_blocks; |
245 | 249 | } |
246 | 250 | break; |
@@ -13,6 +13,8 @@ What does the output from ioblame look like ? | ||
13 | 13 | ------------------------------------------- |
14 | 14 | ioblame gives 2 different views. |
15 | 15 | |
16 | +File view is the default. | |
17 | + | |
16 | 18 | 1) File view : For each file, it gives a list of pids that are doing |
17 | 19 | IO on that file (it also gives the amount of IO each pid does and |
18 | 20 | the aggregate amount of IO done to the file by all pids). |
@@ -40,8 +42,7 @@ File: /app/Gmail2Light/Gmail2Light.apk | ||
40 | 42 | |
41 | 43 | And ditto for writes. |
42 | 44 | |
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 | |
45 | 46 | |
46 | 47 | PID: CrRendererMain |
47 | 48 | /app/Chrome/Chrome.apk Reads: 17012 KB i_size: 71354 KB |
@@ -80,6 +81,11 @@ PID: CrRendererMain | ||
80 | 81 | |
81 | 82 | And ditto for writes. |
82 | 83 | |
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 | + | |
83 | 89 | Finally, it reports the total amount of file data IO done by pids and |
84 | 90 | the total IO done to the block device. So we can look at IO overheads |
85 | 91 | (eg block level prefetching, filesystem metadata overhead etc). |
@@ -91,7 +97,9 @@ How do I run ioblame ? | ||
91 | 97 | -------------------- |
92 | 98 | ioblame -r [ I am only interested in reads ] |
93 | 99 | 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 | |
95 | 103 | |
96 | 104 | 1) The most common way of running ioblame is to start ioblame, then go |
97 | 105 | off and launch the app(s) of interest, do interesting stuff with the |
@@ -102,7 +110,7 @@ dump out IO stats for the app. | ||
102 | 110 | |
103 | 111 | example : |
104 | 112 | |
105 | -srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w | |
113 | +srmohan0.mtv.corp.google.com> sh ioblame.sh -r -w -p | |
106 | 114 | Found aosp_gobo Device |
107 | 115 | OK to kill sleep when test is done |
108 | 116 | ^Csignal INT received, killing streaming trace capture |
@@ -198,3 +206,20 @@ Date: Mon Sep 19 17:33:50 2016 -0700 | ||
198 | 206 | |
199 | 207 | Change-Id: I26bd36f933108927d6903da04d8cb42fd9c3ef3d |
200 | 208 | 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 |
@@ -3,6 +3,8 @@ | ||
3 | 3 | parseoptions() { |
4 | 4 | trace_reads=false |
5 | 5 | trace_writes=false |
6 | + trace_writepages=false | |
7 | + pid_view=false | |
6 | 8 | |
7 | 9 | while [ $# -ge 1 ] |
8 | 10 | do |
@@ -13,6 +15,12 @@ parseoptions() { | ||
13 | 15 | -w) |
14 | 16 | trace_writes=true |
15 | 17 | ;; |
18 | + -p) | |
19 | + trace_writepages=true | |
20 | + ;; | |
21 | + -v) | |
22 | + pid_view=true | |
23 | + ;; | |
16 | 24 | *) |
17 | 25 | usage |
18 | 26 | ;; |
@@ -22,7 +30,7 @@ parseoptions() { | ||
22 | 30 | } |
23 | 31 | |
24 | 32 | usage() { |
25 | - echo "Usage: $0 [-r|-w]" | |
33 | + echo "Usage: $0 [-r|-w|-p|-v]" | |
26 | 34 | exit 1 |
27 | 35 | } |
28 | 36 |
@@ -33,7 +41,7 @@ getmodel() { | ||
33 | 41 | echo Found $model Device |
34 | 42 | |
35 | 43 | case $model in |
36 | - aosp_gobo) | |
44 | + aosp_gobo | gobo) | |
37 | 45 | get_go_devnames |
38 | 46 | ;; |
39 | 47 | marlin | sailfish) |
@@ -87,32 +95,32 @@ get_angler_devnames () { | ||
87 | 95 | disk_stats_before() { |
88 | 96 | if [ $bdev_set == true ]; then |
89 | 97 | 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 }' ` | |
100 | 108 | fi |
101 | 109 | } |
102 | 110 | |
103 | 111 | disk_stats_after() { |
104 | 112 | if [ $bdev_set == true ]; then |
105 | 113 | 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' | |
116 | 124 | fi |
117 | 125 | } |
118 | 126 |
@@ -135,11 +143,14 @@ disk_stats_delta_wr() { | ||
135 | 143 | # Sectors to KB |
136 | 144 | WRITE_KB=`expr $AFTER_WR_SECTORS - $BEFORE_WR_SECTORS` |
137 | 145 | WRITE_KB=`expr $WRITE_KB / 2` |
138 | - echo "Total (ALL) Write KB $block_device = "$WRITE_KB | |
139 | 146 | BLOCK_MINUS_FILE=`expr $WRITE_KB - $file_data_KB` |
140 | 147 | echo "WRITE DELTA: Total Blockdev Writes KB - Total File Data Writes KB = "$BLOCK_MINUS_FILE KB |
141 | 148 | echo "Total (ALL) Write IOs $block_device = "`expr $AFTER_WR_IOS - $BEFORE_WR_IOS` |
142 | 149 | 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 | |
143 | 154 | } |
144 | 155 | |
145 | 156 | # For good measure clean up traces and reenable traces |
@@ -155,11 +166,14 @@ clean_up_tracepoints() { | ||
155 | 166 | adb shell 'echo 0 > /sys/kernel/debug/tracing/trace' |
156 | 167 | if [ $trace_reads == true ]; then |
157 | 168 | 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' | |
159 | 169 | fi |
160 | 170 | if [ $trace_writes == true ]; then |
161 | 171 | 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 | |
163 | 177 | fi |
164 | 178 | adb shell 'echo 1 > /sys/kernel/debug/tracing/tracing_on' |
165 | 179 | } |
@@ -184,11 +198,14 @@ copyout_trace() { | ||
184 | 198 | streamtrace_end |
185 | 199 | if [ $trace_reads == true ]; then |
186 | 200 | 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' | |
188 | 201 | fi |
189 | 202 | if [ $trace_writes == true ]; then |
190 | 203 | 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 | |
192 | 209 | fi |
193 | 210 | adb shell 'echo 0 > /sys/kernel/debug/tracing/tracing_on' |
194 | 211 | } |
@@ -212,6 +229,15 @@ prep_tracefile_rd() { | ||
212 | 229 | rm foo0 |
213 | 230 | } |
214 | 231 | |
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 | + | |
215 | 241 | # Latencies not supported for Writes. 'Write End' is just when the data has been |
216 | 242 | # written back to page cache. |
217 | 243 | prep_tracefile_wr() { |
@@ -225,7 +251,7 @@ prep_tracefile_wr() { | ||
225 | 251 | rm foo0 |
226 | 252 | } |
227 | 253 | |
228 | -get_unique_files() { | |
254 | +get_unique_files_rw() { | |
229 | 255 | # Sort first by filename, then by pid |
230 | 256 | cat $infile | sed s/,//g | sort -d -k2,2 -k8,8 > foo1 |
231 | 257 | mv foo1 $infile |
@@ -236,6 +262,16 @@ get_unique_files() { | ||
236 | 262 | rm foo1 |
237 | 263 | } |
238 | 264 | |
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 | + | |
239 | 275 | get_unique_pids_byfile() { |
240 | 276 | # How many unique pids are there reading this file ? |
241 | 277 | cat $1 | awk '{ print $8 }' > foo1 |
@@ -286,40 +322,66 @@ do_something() { | ||
286 | 322 | } |
287 | 323 | |
288 | 324 | # Get the aggregate list of files read/written. For each file, break up the IOs by pid |
289 | -process_files() { | |
325 | +process_files_rw() { | |
290 | 326 | 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 | |
295 | 328 | # Loop over each file that was involved in IO |
296 | 329 | # Find all the pids doing IO on that file |
297 | 330 | # Aggregate the IO done by each pid on that file and dump it out |
298 | - # | |
299 | 331 | grand_total_KB=0 |
300 | - for i in $list_of_files | |
332 | + cp $infile tempfile | |
333 | + for i in `cat uniq_files` | |
301 | 334 | do |
302 | - echo "File: $i" | |
303 | - total_file_KB=0 | |
304 | 335 | # 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 | |
321 | 357 | done |
322 | 358 | 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 | |
323 | 385 | } |
324 | 386 | |
325 | 387 | # Get the aggregate list of pids. For each pid, break up the IOs by file |
@@ -371,6 +433,19 @@ parseoptions $@ | ||
371 | 433 | adb root && sleep 2 |
372 | 434 | getmodel |
373 | 435 | |
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 | + | |
374 | 449 | prep_to_do_something |
375 | 450 | |
376 | 451 | clean_up_tracepoints |
@@ -393,10 +468,12 @@ if [ $trace_reads == true ]; then | ||
393 | 468 | prep_tracefile_rd |
394 | 469 | # Get file specific stats - for each file, how many pids read that file ? |
395 | 470 | 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 | |
400 | 477 | disk_stats_delta_rd $grand_total_KB |
401 | 478 | |
402 | 479 | debug_FileKB_rd=`cat $infile | awk '{ bytes += $6 } END { printf "%d", bytes/1024 }' ` |
@@ -410,15 +487,35 @@ if [ $trace_writes == true ]; then | ||
410 | 487 | echo |
411 | 488 | prep_tracefile_wr |
412 | 489 | # 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 | + | |
413 | 513 | 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 | + | |
418 | 516 | disk_stats_delta_wr $grand_total_KB |
419 | 517 | |
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 | |
422 | 519 | fi |
423 | 520 | |
424 | 521 | rm -rf tracefile* uniq_* subtrace trace_saved |
@@ -16,6 +16,8 @@ | ||
16 | 16 | |
17 | 17 | #include <gtest/gtest.h> |
18 | 18 | |
19 | +#include <stdio.h> | |
20 | +#include <stdlib.h> | |
19 | 21 | #include <unistd.h> |
20 | 22 | |
21 | 23 | #include <android-base/file.h> |
@@ -155,7 +157,31 @@ TEST(record_cmd, system_wide_fp_callchain_sampling) { | ||
155 | 157 | TEST_IN_ROOT(ASSERT_TRUE(RunRecordCmd({"-a", "--call-graph", "fp"}))); |
156 | 158 | } |
157 | 159 | |
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 | + | |
158 | 183 | TEST(record_cmd, dwarf_callchain_sampling) { |
184 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
159 | 185 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
160 | 186 | std::vector<std::unique_ptr<Workload>> workloads; |
161 | 187 | CreateProcesses(1, &workloads); |
@@ -167,17 +193,20 @@ TEST(record_cmd, dwarf_callchain_sampling) { | ||
167 | 193 | } |
168 | 194 | |
169 | 195 | TEST(record_cmd, system_wide_dwarf_callchain_sampling) { |
196 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
170 | 197 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
171 | 198 | TEST_IN_ROOT(RunRecordCmd({"-a", "--call-graph", "dwarf"})); |
172 | 199 | } |
173 | 200 | |
174 | 201 | TEST(record_cmd, no_unwind_option) { |
202 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
175 | 203 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
176 | 204 | ASSERT_TRUE(RunRecordCmd({"--call-graph", "dwarf", "--no-unwind"})); |
177 | 205 | ASSERT_FALSE(RunRecordCmd({"--no-unwind"})); |
178 | 206 | } |
179 | 207 | |
180 | 208 | TEST(record_cmd, post_unwind_option) { |
209 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
181 | 210 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
182 | 211 | std::vector<std::unique_ptr<Workload>> workloads; |
183 | 212 | CreateProcesses(1, &workloads); |
@@ -296,6 +325,7 @@ TEST(record_cmd, no_dump_symbols) { | ||
296 | 325 | ASSERT_TRUE(RunRecordCmd({"--no-dump-symbols"}, tmpfile.path)); |
297 | 326 | CheckDsoSymbolRecords(tmpfile.path, false, &success); |
298 | 327 | ASSERT_TRUE(success); |
328 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
299 | 329 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
300 | 330 | std::vector<std::unique_ptr<Workload>> workloads; |
301 | 331 | CreateProcesses(1, &workloads); |
@@ -431,6 +461,7 @@ TEST(record_cmd, cpu_clock_for_a_long_time) { | ||
431 | 461 | } |
432 | 462 | |
433 | 463 | TEST(record_cmd, dump_regs_for_tracepoint_events) { |
464 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
434 | 465 | // Check if the kernel can dump registers for tracepoint events. |
435 | 466 | // If not, probably a kernel patch below is missing: |
436 | 467 | // "5b09a094f2 arm64: perf: Fix callchain parse error with kernel tracepoint events" |
@@ -479,6 +479,7 @@ static std::unique_ptr<Command> RecordCmd() { | ||
479 | 479 | } |
480 | 480 | |
481 | 481 | TEST_F(ReportCommandTest, dwarf_callgraph) { |
482 | + OMIT_TEST_ON_NON_NATIVE_ABIS(); | |
482 | 483 | ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); |
483 | 484 | std::vector<std::unique_ptr<Workload>> workloads; |
484 | 485 | CreateProcesses(1, &workloads); |
@@ -40,3 +40,13 @@ bool IsRoot(); | ||
40 | 40 | GTEST_LOG_(INFO) << "Didn't test \"" << #TestStatement << "\" requires root privileges"; \ |
41 | 41 | } \ |
42 | 42 | } 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) |