* Making [START|STOP]_TIMER work on architectures that support gethrtime()

Originally committed as revision 9998 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Roman Shaposhnik 2007-08-09 00:12:40 +00:00
parent 67c1b32f3d
commit b6c748edba
2 changed files with 9 additions and 2 deletions

2
configure vendored
View File

@ -687,6 +687,7 @@ HAVE_LIST="
malloc_h malloc_h
memalign memalign
mkstemp mkstemp
gethrtime
mlib mlib
ppc64 ppc64
sdl sdl
@ -1531,6 +1532,7 @@ fi
check_header byteswap.h check_header byteswap.h
check_func mkstemp check_func mkstemp
check_func gethrtime
check_header termios.h check_header termios.h
check_header conio.h check_header conio.h

View File

@ -268,6 +268,7 @@ static inline int ff_get_fourcc(const char *s){
} }
#if defined(ARCH_X86) || defined(ARCH_POWERPC) || defined(ARCH_BFIN) #if defined(ARCH_X86) || defined(ARCH_POWERPC) || defined(ARCH_BFIN)
#define AV_READ_TIME read_time
#if defined(ARCH_X86_64) #if defined(ARCH_X86_64)
static inline uint64_t read_time(void) static inline uint64_t read_time(void)
{ {
@ -319,13 +320,17 @@ static inline uint64_t read_time(void)
return (((uint64_t)tbu)<<32) | (uint64_t)tbl; return (((uint64_t)tbu)<<32) | (uint64_t)tbl;
} }
#endif #endif
#elif defined(HAVE_GETHRTIME)
#define AV_READ_TIME gethrtime
#endif
#ifdef AV_READ_TIME
#define START_TIMER \ #define START_TIMER \
uint64_t tend;\ uint64_t tend;\
uint64_t tstart= read_time();\ uint64_t tstart= AV_READ_TIME();\
#define STOP_TIMER(id) \ #define STOP_TIMER(id) \
tend= read_time();\ tend= AV_READ_TIME();\
{\ {\
static uint64_t tsum=0;\ static uint64_t tsum=0;\
static int tcount=0;\ static int tcount=0;\