포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 20MB 입니다.

코딩스타일을 보면 제가 짠게 아닌 것은 확실합니다만....


그냥 자료가 있는데 출처가 정말 애매하네요. 원본에 대한 것이....ㅠ.ㅠ


여하튼 참고 바랍니다.

-----------------------

#include <stdio.h>
#include <sys/time.h>


static struct timeval  __mclock_start;   // 기준 시작 시간
   
void mclock_init( void )
{
  gettimeofday( &__mclock_start, NULL );
}
   
long int mclock( void )
{
        struct timeval timecurrent;
        struct timeval timeresult;
       
        gettimeofday( &timecurrent, NULL );
       
        timeresult.tv_sec  = timecurrent.tv_sec  - __mclock_start.tv_sec;
        timeresult.tv_usec = timecurrent.tv_usec - __mclock_start.tv_usec;
   
        if( timeresult.tv_usec < 0 )
        {
            timeresult.tv_sec--;
            timeresult.tv_usec += 1000000;
        }
       
        return timeresult.tv_sec * 1000 + ( timeresult.tv_usec / 1000 );
}
   
void mclock_test( void )
{
        long int start_mclock;
        int lp;
   
        mclock_init();  // 프로그램 전체에서 한번만 설정해 주면 된다.
  
  start_mclock = mclock();
  
        for( lp = 0; lp < 0xFFFFFFF; lp++ )
        for( lp = 0; lp < 0xFFFFFFF; lp++ );
   
            printf( "mclokc : %ld m Sec n", mclock()-start_mclock );
       
}

int main()
{
 mclock_test();
 printf("test end...n");
 return 0;
}

"사람은 자기가 보고 싶은 현실만 볼 뿐이다." - Gaius Julius Caesar
엮인글 :
http://www.aesop.or.kr/index.php?mid=Board_Documents_Linux_Applications&document_srl=35613&act=trackback&key=e44
List of Articles
번호 제목 글쓴이 날짜 조회 수

Yocto project 소개자료 [2]

Yocto zynq howto - 예전자료

apache-1.3.33 arm porting by tssuk [3]

i2c scan하는 코드입니다.

dropbear ssh daemon 포팅하기 [1]

ffmpeg을 이용한 camera 영상 저장 file [1]

Linux application에서의 clock과 system timer설정

ffmpeg x86 compile & cross compile howto file

oss를 이용한 read, write, read/write program file [2]

GIT 사용법 (ProGIT) - 2.6. 태그(TAGS) 붙이기 [2]

GIT 사용법 (ProGIT) - 2.5. 원격 저장소의 사용 방법 [2]

GIT 사용법 (ProGIT) - 2.4. 작업의 취소 [1]

GIT 사용법 (ProGIT) - 2.3. 위탁 이력의 열람 file [1]

GIT 사용법 (ProGIT) - 2.2. GIT 저장소(Repository)에 기록 file [2]

GIT 사용법 (ProGIT) - 2.1. GIT 저장소(Repository)의 취득

GIT 사용법 (ProGIT) - 1.5. 최초 GIT의 환경 설정 [3]

GIT 사용법 (ProGIT) - 1.4. GIT 설치

GIT 사용법 (ProGIT) - 1.2. GIT 개발 역사 / 1.3. GIT 기본 ... file [3]

GIT 사용법 (ProGIT) - 1.1. 버전 관리 시스템의 개념 file [6]

I.MX Multimedia and Applications Framework 기술자료 ... file [2]

사용자 로그인