Replace a renaming in a third-party file with a #define
Our use of the clock-cycle counter from FFTW involved a rename of its type ticks to our type CycleCounterTicks. This unnaturally bulks up the diff from upstream, so undo it and use a simple #define to achieve the same effect, as seen by our code. Task-number: QTBUG-126080 Change-Id: Icbe9c413b73dd9213b95f183b71585f4a9c38de1 Reviewed-by: Kai Köhne <kai.koehne@qt.io> (cherry picked from commit ed7becd9cba582640f19704b5c439e5f6807bc29) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1c7c4c5ac9
commit
35062f6510
120
src/testlib/3rdparty/cycle/cycle_p.h
vendored
120
src/testlib/3rdparty/cycle/cycle_p.h
vendored
@ -31,12 +31,12 @@
|
|||||||
/* To use the cycle counters in your code, simply #include "cycle.h" (this
|
/* To use the cycle counters in your code, simply #include "cycle.h" (this
|
||||||
file), and then use the functions/macros:
|
file), and then use the functions/macros:
|
||||||
|
|
||||||
CycleCounterTicks getticks(void);
|
ticks getticks(void);
|
||||||
|
|
||||||
CycleCounterTicks is an opaque typedef defined below, representing the current time.
|
ticks is an opaque typedef defined below, representing the current time.
|
||||||
You extract the elapsed time between two calls to gettick() via:
|
You extract the elapsed time between two calls to gettick() via:
|
||||||
|
|
||||||
double elapsed(CycleCounterTicks t1, CycleCounterTicks t0);
|
double elapsed(ticks t1, ticks t0);
|
||||||
|
|
||||||
which returns a double-precision variable in arbitrary units. You
|
which returns a double-precision variable in arbitrary units. You
|
||||||
are not expected to convert this into human units like seconds; it
|
are not expected to convert this into human units like seconds; it
|
||||||
@ -77,10 +77,11 @@
|
|||||||
dnl ---------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QBENCHLIB_CYCLE_H
|
#ifndef QBENCHLIB_CYCLE_H
|
||||||
#define QBENCHLIB_CYCLE_H
|
#define QBENCHLIB_CYCLE_H
|
||||||
|
#define ticks CycleCounterTicks
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
@ -93,7 +94,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INLINE_ELAPSED(INL) static INL double elapsed(CycleCounterTicks t1, CycleCounterTicks t0) \
|
#define INLINE_ELAPSED(INL) static INL double elapsed(ticks t1, ticks t0) \
|
||||||
{ \
|
{ \
|
||||||
return (double)(t1 - t0); \
|
return (double)(t1 - t0); \
|
||||||
}
|
}
|
||||||
@ -101,7 +102,7 @@
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
/* Solaris */
|
/* Solaris */
|
||||||
#if defined(HAVE_GETHRTIME) && defined(HAVE_HRTIME_T) && !defined(HAVE_TICK_COUNTER)
|
#if defined(HAVE_GETHRTIME) && defined(HAVE_HRTIME_T) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef hrtime_t CycleCounterTicks;
|
typedef hrtime_t ticks;
|
||||||
|
|
||||||
#define getticks gethrtime
|
#define getticks gethrtime
|
||||||
|
|
||||||
@ -113,16 +114,16 @@ INLINE_ELAPSED(inline)
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
/* AIX v. 4+ routines to read the real-time clock or time-base register */
|
/* AIX v. 4+ routines to read the real-time clock or time-base register */
|
||||||
#if defined(HAVE_READ_REAL_TIME) && defined(HAVE_TIME_BASE_TO_TIME) && !defined(HAVE_TICK_COUNTER)
|
#if defined(HAVE_READ_REAL_TIME) && defined(HAVE_TIME_BASE_TO_TIME) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef timebasestruct_t CycleCounterTicks;
|
typedef timebasestruct_t ticks;
|
||||||
|
|
||||||
static inline CycleCounterTicks getticks(void)
|
static inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks t;
|
ticks t;
|
||||||
read_real_time(&t, TIMEBASE_SZ);
|
read_real_time(&t, TIMEBASE_SZ);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0) /* time in nanoseconds */
|
static inline double elapsed(ticks t1, ticks t0) /* time in nanoseconds */
|
||||||
{
|
{
|
||||||
time_base_to_time(&t1, TIMEBASE_SZ);
|
time_base_to_time(&t1, TIMEBASE_SZ);
|
||||||
time_base_to_time(&t0, TIMEBASE_SZ);
|
time_base_to_time(&t0, TIMEBASE_SZ);
|
||||||
@ -137,9 +138,9 @@ static inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0) /* time
|
|||||||
* PowerPC ``cycle'' counter using the time base register.
|
* PowerPC ``cycle'' counter using the time base register.
|
||||||
*/
|
*/
|
||||||
#if ((defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))) || (defined(__MWERKS__) && defined(macintosh))) && !defined(HAVE_TICK_COUNTER)
|
#if ((defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))) || (defined(__MWERKS__) && defined(macintosh))) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long long CycleCounterTicks;
|
typedef unsigned long long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
unsigned int tbl, tbu0, tbu1;
|
unsigned int tbl, tbu0, tbu1;
|
||||||
|
|
||||||
@ -161,7 +162,7 @@ INLINE_ELAPSED(__inline__)
|
|||||||
from Carbon, requires no additional libraries to be linked). */
|
from Carbon, requires no additional libraries to be linked). */
|
||||||
#if defined(HAVE_MACH_ABSOLUTE_TIME) && defined(HAVE_MACH_MACH_TIME_H) && !defined(HAVE_TICK_COUNTER)
|
#if defined(HAVE_MACH_ABSOLUTE_TIME) && defined(HAVE_MACH_MACH_TIME_H) && !defined(HAVE_TICK_COUNTER)
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
typedef uint64_t CycleCounterTicks;
|
typedef uint64_t ticks;
|
||||||
#define getticks mach_absolute_time
|
#define getticks mach_absolute_time
|
||||||
INLINE_ELAPSED(__inline__)
|
INLINE_ELAPSED(__inline__)
|
||||||
#define HAVE_TICK_COUNTER
|
#define HAVE_TICK_COUNTER
|
||||||
@ -172,11 +173,11 @@ INLINE_ELAPSED(__inline__)
|
|||||||
* Pentium cycle counter
|
* Pentium cycle counter
|
||||||
*/
|
*/
|
||||||
#if (defined(__GNUC__) || defined(__ICC)) && defined(__i386__) && !defined(HAVE_TICK_COUNTER)
|
#if (defined(__GNUC__) || defined(__ICC)) && defined(__i386__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long long CycleCounterTicks;
|
typedef unsigned long long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks ret;
|
ticks ret;
|
||||||
|
|
||||||
__asm__ __volatile__("rdtsc": "=A" (ret));
|
__asm__ __volatile__("rdtsc": "=A" (ret));
|
||||||
/* no input, nothing else clobbered */
|
/* no input, nothing else clobbered */
|
||||||
@ -193,12 +194,12 @@ INLINE_ELAPSED(__inline__)
|
|||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#if _MSC_VER >= 1200 && (_M_IX86 >= 500 || (defined(_WIN32_WCE) && defined(_X86_))) && !defined(HAVE_TICK_COUNTER)
|
#if _MSC_VER >= 1200 && (_M_IX86 >= 500 || (defined(_WIN32_WCE) && defined(_X86_))) && !defined(HAVE_TICK_COUNTER)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef LARGE_INTEGER CycleCounterTicks;
|
typedef LARGE_INTEGER ticks;
|
||||||
#define RDTSC __asm __emit 0fh __asm __emit 031h /* hack for VC++ 5.0 */
|
#define RDTSC __asm __emit 0fh __asm __emit 031h /* hack for VC++ 5.0 */
|
||||||
|
|
||||||
static __inline CycleCounterTicks getticks(void)
|
static __inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks retval;
|
ticks retval;
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
RDTSC
|
RDTSC
|
||||||
@ -208,7 +209,7 @@ static __inline CycleCounterTicks getticks(void)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
static __inline double elapsed(ticks t1, ticks t0)
|
||||||
{
|
{
|
||||||
return (double)(t1.QuadPart - t0.QuadPart);
|
return (double)(t1.QuadPart - t0.QuadPart);
|
||||||
}
|
}
|
||||||
@ -220,14 +221,14 @@ static __inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
|||||||
|
|
||||||
#if _MSC_VER >= 1400 && defined(_WIN32_WCE) && !defined(HAVE_TICK_COUNTER)
|
#if _MSC_VER >= 1400 && defined(_WIN32_WCE) && !defined(HAVE_TICK_COUNTER)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef DWORD CycleCounterTicks;
|
typedef DWORD ticks;
|
||||||
|
|
||||||
static __inline CycleCounterTicks getticks(void)
|
static __inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
return GetTickCount();
|
return GetTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
static __inline double elapsed(ticks t1, ticks t0)
|
||||||
{
|
{
|
||||||
return (double)(t1 - t0);
|
return (double)(t1 - t0);
|
||||||
}
|
}
|
||||||
@ -241,13 +242,13 @@ static __inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
|||||||
* X86-64 cycle counter
|
* X86-64 cycle counter
|
||||||
*/
|
*/
|
||||||
#if (defined(__GNUC__) || defined(__ICC)) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER)
|
#if (defined(__GNUC__) || defined(__ICC)) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long long CycleCounterTicks;
|
typedef unsigned long long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
unsigned a, d;
|
unsigned a, d;
|
||||||
asm volatile("rdtsc" : "=a" (a), "=d" (d));
|
asm volatile("rdtsc" : "=a" (a), "=d" (d));
|
||||||
return ((CycleCounterTicks)a) | (((CycleCounterTicks)d) << 32);
|
return ((ticks)a) | (((ticks)d) << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ELAPSED(__inline__)
|
INLINE_ELAPSED(__inline__)
|
||||||
@ -259,8 +260,8 @@ INLINE_ELAPSED(__inline__)
|
|||||||
NOTE: this code will fail to link unless you use the -Masmkeyword compiler
|
NOTE: this code will fail to link unless you use the -Masmkeyword compiler
|
||||||
option (grrr). */
|
option (grrr). */
|
||||||
#if defined(__PGI) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER)
|
#if defined(__PGI) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long long CycleCounterTicks;
|
typedef unsigned long long ticks;
|
||||||
static CycleCounterTicks getticks(void)
|
static ticks getticks(void)
|
||||||
{
|
{
|
||||||
asm(" rdtsc; shl $0x20,%rdx; mov %eax,%eax; or %rdx,%rax; ");
|
asm(" rdtsc; shl $0x20,%rdx; mov %eax,%eax; or %rdx,%rax; ");
|
||||||
}
|
}
|
||||||
@ -272,7 +273,7 @@ INLINE_ELAPSED(__inline__)
|
|||||||
#if _MSC_VER >= 1400 && (defined(_M_AMD64) || defined(_M_X64)) && !defined(HAVE_TICK_COUNTER)
|
#if _MSC_VER >= 1400 && (defined(_M_AMD64) || defined(_M_X64)) && !defined(HAVE_TICK_COUNTER)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
|
||||||
typedef unsigned __int64 CycleCounterTicks;
|
typedef unsigned __int64 ticks;
|
||||||
|
|
||||||
#define getticks __rdtsc
|
#define getticks __rdtsc
|
||||||
|
|
||||||
@ -288,10 +289,10 @@ INLINE_ELAPSED(__inline)
|
|||||||
|
|
||||||
/* intel's icc/ecc compiler */
|
/* intel's icc/ecc compiler */
|
||||||
#if (defined(__EDG_VERSION) || defined(__ECC)) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER)
|
#if (defined(__EDG_VERSION) || defined(__ECC)) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long CycleCounterTicks;
|
typedef unsigned long ticks;
|
||||||
#include <ia64intrin.h>
|
#include <ia64intrin.h>
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
return __getReg(_IA64_REG_AR_ITC);
|
return __getReg(_IA64_REG_AR_ITC);
|
||||||
}
|
}
|
||||||
@ -303,11 +304,11 @@ INLINE_ELAPSED(__inline__)
|
|||||||
|
|
||||||
/* gcc */
|
/* gcc */
|
||||||
#if defined(__GNUC__) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER)
|
#if defined(__GNUC__) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long CycleCounterTicks;
|
typedef unsigned long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks ret;
|
ticks ret;
|
||||||
|
|
||||||
__asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret));
|
__asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret));
|
||||||
return ret;
|
return ret;
|
||||||
@ -321,11 +322,11 @@ INLINE_ELAPSED(__inline__)
|
|||||||
/* HP/UX IA64 compiler, courtesy Teresa L. Johnson: */
|
/* HP/UX IA64 compiler, courtesy Teresa L. Johnson: */
|
||||||
#if defined(__hpux) && defined(__ia64) && !defined(HAVE_TICK_COUNTER)
|
#if defined(__hpux) && defined(__ia64) && !defined(HAVE_TICK_COUNTER)
|
||||||
#include <machine/sys/inline.h>
|
#include <machine/sys/inline.h>
|
||||||
typedef unsigned long CycleCounterTicks;
|
typedef unsigned long ticks;
|
||||||
|
|
||||||
static inline CycleCounterTicks getticks(void)
|
static inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks ret;
|
ticks ret;
|
||||||
|
|
||||||
ret = _Asm_mov_from_ar (_AREG_ITC);
|
ret = _Asm_mov_from_ar (_AREG_ITC);
|
||||||
return ret;
|
return ret;
|
||||||
@ -338,7 +339,7 @@ INLINE_ELAPSED(inline)
|
|||||||
|
|
||||||
/* Microsoft Visual C++ */
|
/* Microsoft Visual C++ */
|
||||||
#if defined(_MSC_VER) && defined(_M_IA64) && !defined(HAVE_TICK_COUNTER)
|
#if defined(_MSC_VER) && defined(_M_IA64) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned __int64 CycleCounterTicks;
|
typedef unsigned __int64 ticks;
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -346,9 +347,9 @@ extern "C"
|
|||||||
ticks __getReg(int whichReg);
|
ticks __getReg(int whichReg);
|
||||||
#pragma intrinsic(__getReg)
|
#pragma intrinsic(__getReg)
|
||||||
|
|
||||||
static __inline CycleCounterTicks getticks(void)
|
static __inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
volatile CycleCounterTicks temp;
|
volatile ticks temp;
|
||||||
temp = __getReg(3116);
|
temp = __getReg(3116);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
@ -361,12 +362,12 @@ static __inline CycleCounterTicks getticks(void)
|
|||||||
* PA-RISC cycle counter
|
* PA-RISC cycle counter
|
||||||
*/
|
*/
|
||||||
#if (defined(__hppa__) || defined(__hppa)) && !defined(HAVE_TICK_COUNTER)
|
#if (defined(__hppa__) || defined(__hppa)) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long CycleCounterTicks;
|
typedef unsigned long ticks;
|
||||||
|
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks ret;
|
ticks ret;
|
||||||
|
|
||||||
__asm__ __volatile__("mfctl 16, %0": "=r" (ret));
|
__asm__ __volatile__("mfctl 16, %0": "=r" (ret));
|
||||||
/* no input, nothing else clobbered */
|
/* no input, nothing else clobbered */
|
||||||
@ -381,7 +382,7 @@ INLINE_ELAPSED(inline)
|
|||||||
# include <machine/inline.h>
|
# include <machine/inline.h>
|
||||||
static inline unsigned long getticks(void)
|
static inline unsigned long getticks(void)
|
||||||
{
|
{
|
||||||
register CycleCounterTicks ret;
|
register ticks ret;
|
||||||
_MFCTL(16, ret);
|
_MFCTL(16, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -392,11 +393,11 @@ static inline unsigned long getticks(void)
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
/* S390, courtesy of James Treacy */
|
/* S390, courtesy of James Treacy */
|
||||||
#if defined(__GNUC__) && defined(__s390__) && !defined(HAVE_TICK_COUNTER)
|
#if defined(__GNUC__) && defined(__s390__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long long CycleCounterTicks;
|
typedef unsigned long long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks cycles;
|
ticks cycles;
|
||||||
__asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc");
|
__asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc");
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
@ -411,9 +412,9 @@ INLINE_ELAPSED(__inline__)
|
|||||||
* The 32-bit cycle counter on alpha overflows pretty quickly,
|
* The 32-bit cycle counter on alpha overflows pretty quickly,
|
||||||
* unfortunately. A 1GHz machine overflows in 4 seconds.
|
* unfortunately. A 1GHz machine overflows in 4 seconds.
|
||||||
*/
|
*/
|
||||||
typedef unsigned int CycleCounterTicks;
|
typedef unsigned int ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
unsigned long cc;
|
unsigned long cc;
|
||||||
__asm__ __volatile__ ("rpcc %0" : "=r"(cc));
|
__asm__ __volatile__ ("rpcc %0" : "=r"(cc));
|
||||||
@ -427,11 +428,11 @@ INLINE_ELAPSED(__inline__)
|
|||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
#if defined(__GNUC__) && defined(__sparc_v9__) && !defined(HAVE_TICK_COUNTER)
|
#if defined(__GNUC__) && defined(__sparc_v9__) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef unsigned long CycleCounterTicks;
|
typedef unsigned long ticks;
|
||||||
|
|
||||||
static __inline__ CycleCounterTicks getticks(void)
|
static __inline__ ticks getticks(void)
|
||||||
{
|
{
|
||||||
CycleCounterTicks ret;
|
ticks ret;
|
||||||
__asm__ __volatile__("rd %%tick, %0" : "=r" (ret));
|
__asm__ __volatile__("rd %%tick, %0" : "=r" (ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -444,9 +445,9 @@ INLINE_ELAPSED(__inline__)
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
#if (defined(__DECC) || defined(__DECCXX)) && defined(__alpha) && defined(HAVE_C_ASM_H) && !defined(HAVE_TICK_COUNTER)
|
#if (defined(__DECC) || defined(__DECCXX)) && defined(__alpha) && defined(HAVE_C_ASM_H) && !defined(HAVE_TICK_COUNTER)
|
||||||
# include <c_asm.h>
|
# include <c_asm.h>
|
||||||
typedef unsigned int CycleCounterTicks;
|
typedef unsigned int ticks;
|
||||||
|
|
||||||
static __inline CycleCounterTicks getticks(void)
|
static __inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
unsigned long cc;
|
unsigned long cc;
|
||||||
cc = asm("rpcc %v0");
|
cc = asm("rpcc %v0");
|
||||||
@ -460,16 +461,16 @@ INLINE_ELAPSED(__inline)
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
/* SGI/Irix */
|
/* SGI/Irix */
|
||||||
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) && !defined(HAVE_TICK_COUNTER)
|
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) && !defined(HAVE_TICK_COUNTER)
|
||||||
typedef struct timespec CycleCounterTicks;
|
typedef struct timespec ticks;
|
||||||
|
|
||||||
static inline CycleCounterTicks getticks(void)
|
static inline ticks getticks(void)
|
||||||
{
|
{
|
||||||
struct timespec t;
|
struct timespec t;
|
||||||
clock_gettime(CLOCK_SGI_CYCLE, &t);
|
clock_gettime(CLOCK_SGI_CYCLE, &t);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
static inline double elapsed(ticks t1, ticks t0)
|
||||||
{
|
{
|
||||||
return (double)(t1.tv_sec - t0.tv_sec) * 1.0E9 +
|
return (double)(t1.tv_sec - t0.tv_sec) * 1.0E9 +
|
||||||
(double)(t1.tv_nsec - t0.tv_nsec);
|
(double)(t1.tv_nsec - t0.tv_nsec);
|
||||||
@ -484,7 +485,7 @@ static inline double elapsed(CycleCounterTicks t1, CycleCounterTicks t0)
|
|||||||
# include <intrinsics.h>
|
# include <intrinsics.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef long long CycleCounterTicks;
|
typedef long long ticks;
|
||||||
|
|
||||||
#define getticks _rtc
|
#define getticks _rtc
|
||||||
|
|
||||||
@ -493,4 +494,5 @@ INLINE_ELAPSED(inline)
|
|||||||
#define HAVE_TICK_COUNTER
|
#define HAVE_TICK_COUNTER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef ticks
|
||||||
#endif // QBENCHLIB_CYCLE_H
|
#endif // QBENCHLIB_CYCLE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user