diff options
Diffstat (limited to 'nureadahead-collect')
-rwxr-xr-x | nureadahead-collect | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/nureadahead-collect b/nureadahead-collect new file mode 100755 index 0000000..9cf17fe --- /dev/null +++ b/nureadahead-collect @@ -0,0 +1,36 @@ +#!/bin/sh + +usage() { + echo "usage: nureadahead-collect DEVICE TIMEOUT > file" >&2 +} + +case "$1" in + -*) usage; exit 1 +esac + +case "$#" in + 2) device=$1 timeout=$2;; + *) usage; exit 1 +esac + +awk_prog2=' +$1 <= end && $2 > end { + end = $2 +} +$1 > end && NR != 1 { + print start " " end +} +$1 > end { + start = $1 + end = $2 +} +END { + print start " " end +} +' + +blktrace -a read -d "$1" -w "$timeout" -o - \ + | blkparse -f "%a %d %e %n %S\n" -i - \ + | awk '$1 == "C" && $2 ~ /R/ && $2 !~ /A/ && $3 == 0 { print $5 " " $5 + $4 - 1 }' \ + | sort -n -k1,1 -k2,2 \ + | awk "$awk_prog2" |