#!/bin/sh

# flush memory with use-once page cache reads

# lru_lock coverage
# 1781926	____pagevec_lru_add
#  736056	shrink_inactive_list

. ./hw_vars

for i in `seq 1 $nr_task`
do
	create_sparse_file $SPARSE_FILE-$i $((ROTATE_BYTES / nr_task))
	timeout --foreground -s INT ${runtime:-600} dd bs=4k if=$SPARSE_FILE-$i of=/dev/null > $TMPFS_MNT/dd-output-$i 2>&1 &
done

wait
sleep 1

for file in $TMPFS_MNT/dd-output-*
do
	[ -s "$file" ] || {
		echo "dd output file empty: $file" >&2
	}
	cat $file
	rm  $file
done

rm `seq -f $SPARSE_FILE-%g 1 $nr_task`
