ddn-ime-evaluation/benchmark/drop_caches.sh

22 lines
546 B
Bash
Executable File

#!/bin/bash
oscs=( $( find /proc/fs/lustre/osc -mindepth 1 -maxdepth 1 -type d ) )
#echo $oscs
while [ ! 0 -eq ${#oscs[@]} ]; do
sync
echo 3 > /proc/sys/vm/drop_caches
for i in ${!oscs[@]}; do
used_mb=$( grep -h used_mb ${oscs[$i]}/osc_cached_mb | cut -d" " -f 2 )
if [ 0 == $used_mb ]; then
#echo "remove from list ${oscs[$i]}, because cache is $used_mb MB"
unset oscs[$i]
else
echo "skip ${oscs[$i]}, cache is still $used_mb MB"
fi
done
sleep 1
done