Revision 0775c88f

View differences:

libavcodec/common.h
456 456
}
457 457
#endif
458 458

  
459
#if defined(ARCH_X86) || defined(ARCH_X86_64)
459
#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_POWERPC)
460 460
#if defined(ARCH_X86_64)
461
static inline uint64_t rdtsc(void)
461
static inline uint64_t read_time(void)
462 462
{
463 463
	uint64_t a, d;
464 464
	asm volatile(	"rdtsc\n\t"
......
466 466
	);
467 467
	return (d << 32) | (a & 0xffffffff);
468 468
}
469
#else
470
static inline long long rdtsc(void)
469
#elif defined(ARCH_X86)
470
static inline long long read_time(void)
471 471
{
472 472
	long long l;
473 473
	asm volatile(	"rdtsc\n\t"
......
475 475
	);
476 476
	return l;
477 477
}
478
#else //FIXME check ppc64
479
static inline uint64_t read_time(void)
480
{
481
    uint32_t tbu, tbl, temp;
482

  
483
     /* from section 2.2.1 of the 32-bit PowerPC PEM */
484
     __asm__ __volatile__(
485
         "1:\n"
486
         "mftbu  %2\n"
487
         "mftb   %0\n"
488
         "mftbu  %1\n"
489
         "cmpw   %2,%1\n"
490
         "bne    1b\n"
491
     : "=r"(tbl), "=r"(tbu), "=r"(temp)
492
     :
493
     : "cc");
494

  
495
     return (((uint64_t)tbu)<<32) | (uint64_t)tbl;
496
}
478 497
#endif
479 498

  
480 499
#define START_TIMER \
481 500
uint64_t tend;\
482
uint64_t tstart= rdtsc();\
501
uint64_t tstart= read_time();\
483 502

  
484 503
#define STOP_TIMER(id) \
485
tend= rdtsc();\
504
tend= read_time();\
486 505
{\
487 506
  static uint64_t tsum=0;\
488 507
  static int tcount=0;\

Also available in: Unified diff