본문 바로가기
3. 개발 관련/정리 :: issue 와 resovle

수행 시간 체크 스크립트? (read/write elapsed time check)

by kyuho.choi 2011. 8. 31.
728x90
반응형
정말 의미없는 작업일 수 잇으나...
가끔은 내가 수행한 프로그램이 얼마만큼의 시간이 걸렸는지 확인해야 할 때가 있슴미다...

그래서 간략한 스크립트로 떼워보려고 함미다.

여기서는 ext4 타입의 sdcard 스토리지를 마운트하여 $1에 해당하는 이미지파일등을 복사하는 데
얼마의 시간이 걸리나를 간략히 보고자 한것이며, 실제 Filesystem 의 Read/Write 속도라고 보시면 안됨미다. :)


=================================================================
 #!/bin/bash
mount -t ext4 /dev/sde2 /mnt/sdcard

echo 'write time test start!!'
START_TIME=`date +%s`
cp -a $1 /mnt/sdcard/
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"


echo 'read time test start!!'
START_TIME=`date +%s`
cp -a /mnt/sdcard/$1 ./
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"
=================================================================

위에서 처럼 써먹어 주면 어따 쓰느냐...?

우선 아래와 같이 비슷한 스크립트를 하나 더 작성했습니다.

=================================================================
 #!/bin/bash
mount -t yaffs2 /dev/mtdblock2 /mnt/flash

echo 'write time test start!!'
START_TIME=`date +%s`
cp -a $1 /mnt/flash
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"


echo 'read time test start!!'
START_TIME=`date +%s`
cp -a /mnt/flash/$1 ./
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds" 
=================================================================
 
이제 두 스크립트를 각각 돌려보면 됨미다.
요거는 실제로 nand 스토리지와 SDMMC 간에 RW 속도가 얼마 차이날까? 
라는 물음에 답하고자 야매로 비교할라고 작성했슴미다... 

위와 동일한 코드를 mount 및 read/write 하는 부분만 변경해주면 
다른 스토리지 타입에 대하여 동일 루틴을 수행하는 코드가 되므로 개략적인 비교는 됨미다. :)
728x90
반응형

댓글