Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1.  
  2. iops_simple() {
  3. local _dir="$1"
  4. [[ -d "$_dir" ]] || return
  5. local _output=$(mktemp fio_XXXX)
  6. local _size="2G"
  7. local -i _jobs=8
  8. local _engine="vsync"
  9. local -i _files=$((_jobs * 4))
  10. local -i _depth=$((_jobs * 8))
  11. [[ "${OSTYPE:0:5}" = "linux" ]] && _engine="libaio"
  12.  
  13. local -i _version=0
  14. _version=$(fio -v |& sed -e 's/^[a-z\-]*//' -e 's/\..*$//')
  15. local -i _r_column=8
  16. local -i _w_column=49
  17.  
  18. if [[ "$_version" == "1" ]] ; then
  19. _r_column=6
  20. _w_column=26
  21. fi
  22.  
  23. sudo fio \
  24. --output="$_output" \
  25. --thread \
  26. --name="Simple IOPS Test" \
  27. --directory="$_dir" \
  28. --readwrite=randrw \
  29. --ioengine=$_engine \
  30. --iodepth=$_depth \
  31. --size=$_size \
  32. --blocksize=4k \
  33. --nrfiles=$_files \
  34. --numjobs=$_jobs \
  35. --file_service_type=random \
  36. --direct=1 \
  37. --overwrite=1 \
  38. --runtime=180 \
  39. --unlink=1 \
  40. --gtod_reduce=1 \
  41. --minimal
  42.  
  43. local _r
  44. _r=`grep IOPS "$_output" | cut -f $_r_column -d ';' | tr '\n' '+' | sed -e 's/^/(/' -e 's/\+$/\)/'`
  45. _r=`echo "$_r" | bc`
  46.  
  47. local _w
  48. _w=`grep IOPS "$_output" | cut -f $_w_column -d ';' | tr '\n' '+' | sed -e 's/^/(/' -e 's/\+$/\)/'`
  49. _w=`echo "$_w" | bc`
  50.  
  51. local _rw
  52. _rw=`echo "( $_r + $_w ) / 2"`
  53. _rw=`echo "$_rw" | bc`
  54.  
  55. rm -f "$_output"
  56.  
  57. echo "[IOPS] READ: $_r WRITE: $_w AVG: $_rw "
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement