Posted by: kezhong | January 22, 2009

Test Disk Performance bash

#!/bin/bash

TIME_WRITE_START=$(date +%s)
dd if=/dev/zero of=test bs=1024 count=1000000
TIME_WRITE_END=$(date +%s)

TIME_READ_START=$(date +%s)
cat test > /dev/null
TIME_READ_END=$(date +%s)

rm test

echo “——————————————————–”
TIME_WRITE_USED=$(($TIME_WRITE_END – $TIME_WRITE_START))
echo -n “The write disk performance: ”
echo -n $((1024 / $TIME_WRITE_USED))
echo ” MB/sec”
TIME_READ_USED=$(($TIME_READ_END – $TIME_READ_START))
echo -n “The read disk performance: ”
echo -n $((1024 / $TIME_READ_USED))
echo ” MB/sec”


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: