summaryrefslogtreecommitdiff
path: root/src/xine-utils/memcpy.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2011-12-10 22:49:27 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2011-12-10 22:49:27 +0000
commit471aee5bb21bb5d568ac1ddaea0b35c18cda5c07 (patch)
tree77d42d4a0c337d4001d100b49b785f2604deeb0e /src/xine-utils/memcpy.c
parentc6324255117128d3a7a9f614c756022d3ef7461d (diff)
parent508e9088eec8f00b5dea9571383480803d4ad45e (diff)
downloadxine-lib-471aee5bb21bb5d568ac1ddaea0b35c18cda5c07.tar.gz
xine-lib-471aee5bb21bb5d568ac1ddaea0b35c18cda5c07.tar.bz2
Merge from 1.1.
--HG-- rename : src/liba52/xine_a52_decoder.c => src/audio_dec/xine_a52_decoder.c rename : src/libspudvb/xine_spudvb_decoder.c => src/spu_dec/spudvb_decoder.c rename : src/libxinevdec/image.c => src/video_dec/image.c
Diffstat (limited to 'src/xine-utils/memcpy.c')
-rw-r--r--src/xine-utils/memcpy.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index cea2b5b0b..515919a41 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -1,4 +1,4 @@
-/*
+;/*
* Copyright (C) 2001-2004 the xine project
*
* This file is part of xine, a free video player.
@@ -403,11 +403,23 @@ static const struct {
{ "ppcasm", ppcasm_memcpy, 0 },
{ "ppcasm_cached", ppcasm_cacheable_memcpy, MM_ACCEL_PPC_CACHE32 },
#endif /* ARCH_PPC && !HOST_OS_DARWIN */
+ { "", NULL, 0 }
};
static uint64_t memcpy_timing[sizeof(memcpy_method)/sizeof(memcpy_method[0])] = { 0, };
-#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H)
+#ifdef HAVE_POSIX_TIMERS
+/* Prefer clock_gettime() where available. */
+static int64_t _x_gettime(void)
+{
+ struct timespec tm;
+ return (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tm) == -1)
+ ? times (NULL)
+ : (int64_t)tm.tv_sec * 1e9 + tm.tv_nsec;
+}
+# define rdtsc(x) _x_gettime()
+
+#elif (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H)
static int64_t rdtsc(int config_flags)
{
int64_t x;
@@ -510,7 +522,13 @@ void xine_probe_fast_memcpy(xine_t *xine)
memset(buf1,0,BUFSIZE);
memset(buf2,0,BUFSIZE);
- for(i = 1; i < sizeof(memcpy_method)/sizeof(memcpy_method[0]); i++)
+ /* some initial activity to ensure that we're not running slowly :-) */
+ for(j=0;j<50;j++) {
+ memcpy_method[1].function(buf2,buf1,BUFSIZE);
+ memcpy_method[1].function(buf1,buf2,BUFSIZE);
+ }
+
+ for(i=1; memcpy_method[i].name[0]; i++)
{
if( (config_flags & memcpy_method[i].cpu_require) !=
memcpy_method[i].cpu_require )