Guest User

ddBench v1.01

a guest
Sep 23rd, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.71 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # ddBench v1.01 - A simple SSD/HDD sequential read/write Benchmark
  4. #
  5. # Notes and Features:
  6. # 1. Run this script as sudo, for 'sync' and 'drop_caches'
  7. #    to be properly performed before each cycle and at the end of the benchmark.
  8. # 2. If you have smartmontools installed, and you're not running off a virtual machine,
  9. #    then search for "UNCOMMENT THE TWO LINES BELOW ME:" inside this script and
  10. #    uncomment the two lines, for added functionality.
  11. #    This *should* enable ddBench to list the total number of hours which you disk has
  12. #    been up and running.
  13. # 3. The file which this test generates (testfile.test) will be erased after each cycle.
  14. #
  15. # Changelog:
  16. # v1.01 - Added HDD/SSD Model and Firmware output.
  17. #         Added HDD/SSD total uptime output.
  18. # v1.00 - Initial release
  19. #
  20. echo
  21. echo "ddBench v1.01 - A simple SSD/HDD sequential read/write Benchmark"
  22. echo "Starting now, paste your results starting below this line:"
  23. echo
  24. cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )
  25. cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
  26. freq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
  27. tram=$( free -m | awk 'NR==2 {print $2}' )
  28. swap=$( free -m | awk 'NR==4 {print $2}' )
  29. up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')
  30. echo "CPU model : $cname"
  31. echo "Number of cores : $cores"
  32. echo "CPU frequency : $freq MHz"
  33. echo "Total amount of RAM : $tram MB"
  34. echo "Total amount of Swap : $swap MB"
  35. echo "System uptime : $up"
  36. echo "Listing installed and detected HDD/SSD drives:"
  37. hdparm -I /dev/sd? | grep -e Model -e Firmware
  38.  
  39. # UNCOMMENT THE TWO LINES BELOW ME:
  40. #echo "Listing installed HDD/SSD drives' total uptime:
  41. #smartctl -a /dev/sda | grep Power_On
  42.  
  43. echo
  44. sync && echo 3 > /proc/sys/vm/drop_caches
  45. echo "4KB x 262,144 times"
  46. dd if=/dev/zero of=testfile.test conv=fdatasync bs=4k count=262144
  47. rm testfile.test
  48. sync && echo 3 > /proc/sys/vm/drop_caches
  49. echo
  50. echo "8KB x 131,072 times"
  51. dd if=/dev/zero of=testfile.test conv=fdatasync bs=8k count=131072
  52. rm testfile.test
  53. sync && echo 3 > /proc/sys/vm/drop_caches
  54. echo
  55. echo "16KB x 65,536 times"
  56. dd if=/dev/zero of=testfile.test conv=fdatasync bs=16k count=65536
  57. rm testfile.test
  58. sync && echo 3 > /proc/sys/vm/drop_caches
  59. echo
  60. echo "32KB x 32,768 times"
  61. dd if=/dev/zero of=testfile.test conv=fdatasync bs=32k count=32768
  62. rm testfile.test
  63. sync && echo 3 > /proc/sys/vm/drop_caches
  64. echo
  65. echo "64KB x 16,384 times"
  66. dd if=/dev/zero of=testfile.test conv=fdatasync bs=64k count=16384
  67. rm testfile.test
  68. sync && echo 3 > /proc/sys/vm/drop_caches
  69. echo
  70. echo "128KB x 8,192 times"
  71. dd if=/dev/zero of=testfile.test conv=fdatasync bs=128k count=8192
  72. rm testfile.test
  73. sync && echo 3 > /proc/sys/vm/drop_caches
  74. echo
  75. echo "256KB x 4,096 times"
  76. dd if=/dev/zero of=testfile.test conv=fdatasync bs=256k count=4096
  77. rm testfile.test
  78. sync && echo 3 > /proc/sys/vm/drop_caches
  79. echo
  80. echo "512KB x 2,048 times"
  81. dd if=/dev/zero of=testfile.test conv=fdatasync bs=512k count=2048
  82. rm testfile.test
  83. sync && echo 3 > /proc/sys/vm/drop_caches
  84. echo
  85. echo "1,024KB x 1,024 times"
  86. dd if=/dev/zero of=testfile.test conv=fdatasync bs=1024k count=1024
  87. rm testfile.test
  88. echo
  89. echo "2,048KB x 512 times"
  90. dd if=/dev/zero of=testfile.test conv=fdatasync bs=2048k count=512
  91. rm testfile.test
  92. echo
  93. echo "4,096KB x 256 times"
  94. dd if=/dev/zero of=testfile.test conv=fdatasync bs=4096k count=256
  95. rm testfile.test
  96. sync && echo 3 > /proc/sys/vm/drop_caches
  97. echo
  98. echo "8,192KB x 128 times"
  99. dd if=/dev/zero of=testfile.test conv=fdatasync bs=8192k count=128
  100. rm testfile.test
  101. sync && echo 3 > /proc/sys/vm/drop_caches
  102. echo
  103. echo "Done. Paste your results above this line."
  104. echo
Advertisement
Add Comment
Please, Sign In to add comment