Don't know of an easier way off hand, but this bash snippet might help you with parsing out what you need from iotop:
iotop --batch --pid 1 > log
line_num=0
while read line; do
line_num=$(($line_n+1))
if [[ $(($line_num % 3)) -eq 0 ]]; then
#print Column 3
echo $line | awk '{print $3}'
fi
done < log > processed_file
#Get total of column three:
cat processed_file | (tr '\n' +; echo 0) | bc
Actually, Might be easier to read /proc/$PID/io every x seconds:
val=0
total=0
counter=0
pid=2323
while [[ $counter < 100 ]]; do
counter=$(($counter +1 ))
#Change the sed number for different line, 5 is read_bytes
val=$(cat /proc/$pid/io | sed -n '5p' | awk '{ print $2 }')
total=$(($total + $val))
echo $total
sleep 1
done
Actually, looks like the above script is wrong, because it seems like /proc/<pid>/io
is just the total, so really, just grab it once, wait however long, grab it again, find the differnce and there is your answer. You might want to look at the source code and find out its data type to see if it eventually wraps around. Probably not a problem for a little tablet though.