วันพฤหัสบดีที่ 21 มกราคม พ.ศ. 2553

timer shell script

To measure performance, you might want to know how much does it take to complete the task.
Here are shell script to help you.

The following measure hard disk performance by creating 10 GB file.
#!/bin/bash
START=$(date +%s)
# do something
# start your script work here

dd if=/dev/zero of=/home/user/hd2/file.img bs=1M count=1000

# your logic ends here
END=$(date +%s)
DIFF=$(( $END - $START ))

echo "It took $DIFF seconds"

ไม่มีความคิดเห็น:

แสดงความคิดเห็น