포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 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=be3
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
53 find 명령어 활용법 고현철 2009-01-30 6272
52 vi 사용법 - block 지정 고현철 2009-01-30 6303
51 유용한 ARM 어셈블리 (if, for, do_while, switch) 김재훈 2009-01-31 6332
50 우분투 리눅스 8.10 네트워크 수동 설정 방법 [2] 김재훈 2009-03-23 6367
49 Embedded Linux Debugging HowTo file 김재훈 2009-04-27 6396
48 iconv euckr_to_utf8 고현철 2009-01-30 6418
47 SDL tslib initialize 고현철 2009-04-09 6426
46 wxWidget hello unix example file 고도리 2008-07-18 6494
45 wxWidget odbc file 고도리 2008-07-18 6565
44 windows/linux에서 작업했던 tutorial입니다. file 고도리 2008-07-18 6626
43 펌웨어 프로그래밍 팁 - atoi() 함수 구현 김재훈 2009-01-31 6806
42 devcpp howto입니다.(devcpp/wxWidget/SDL) file 고도리 2008-07-18 6915
41 wxWidget sample program 올리기 - windows/linux file 고도리 2008-07-18 6935
40 Teach Yourself Shell Programming in 24 Hours file 김재훈 2009-05-17 7081
39 The GNU C Library Reference Manual (한글판) file [3] 김재훈 2009-04-19 7186
38 Linux C++ Programming HowTo file 김재훈 2009-04-26 7193
» Linux application에서의 clock과 system timer설정 고도리 2011-08-15 7383
36 ARM Developer Suiite (ADS) 메뉴얼 모음 file 김재훈 2009-03-31 7397
35 GStreamer On TI DaVinci and OMAP Platform 강좌 .... 장석원 2009-04-27 7416
34 wxDevcpp를 이용한 windows용 tutorial입니다. file 고도리 2008-07-18 7421

사용자 로그인