/dt.d/Scripts/butterfly.ksh

# · Korn Shell · 31 lines · 7 code · 0 blank · 24 comment · 0 complexity · a4598a79f6bf4c2c3b5eca426af381f5 MD5 · raw file

  1. #!/bin/ksh
  2. #
  3. # Script: butterfly.ksh
  4. # Author: Robin T. Miller
  5. # Date: May 1st, 2008
  6. #
  7. # Description:
  8. # This script uses the data test (dt) program, to force I/O to be
  9. # like a butterfly, that is from front to back and visa versa.
  10. #
  11. # Please Note: The I/O pattern won't alternate every other I/O, due to
  12. # process scheduling, and possibly reordering by the I/O subsystem.
  13. #
  14. # Note: On Linux, block device special files (DSF's) should either be
  15. # bound to /dev/rawNN DSF's via raw(8) interface, or Direct I/O (DIO)
  16. # should be enabled to bypass the buffer cache and its' affects.
  17. #
  18. alias dt=/u/rtmiller/Tools/dt.d-WIP/linux2.6-x86/dt
  19. rm -f butterfly_slice[12].log
  20. #
  21. # Create two processes writing from each end of the disk to the middle.
  22. #
  23. dt of=/dev/sdc bs=256k flags=direct slices=2 slice=1 iodir=forward enable=debug pattern=0xaaaaaaaa log=butterfly_slice1.log &
  24. dt of=/dev/sdc bs=256k flags=direct slices=2 slice=2 iodir=reverse enable=debug pattern=0xbbbbbbbb log=butterfly_slice2.log &
  25. #
  26. # Keep it simple (for now), just wait for all jobs.
  27. # Note: Exit status should be gathered for each process.
  28. #
  29. set -m
  30. wait
  31. exit $?