diff options
author | austriancoder <austriancoder> | 2004-10-04 21:09:34 +0000 |
---|---|---|
committer | austriancoder <austriancoder> | 2004-10-04 21:09:34 +0000 |
commit | 6e40c29e483fd3eb70d35b76ee7992397498bf9a (patch) | |
tree | 9d62123d5b0e2bee43830f270ba7e1f54ce3f3c1 | |
parent | 47e5051fb4e5ea6594b00fe10af583df473493e0 (diff) | |
download | vdr-plugin-dxr3-6e40c29e483fd3eb70d35b76ee7992397498bf9a.tar.gz vdr-plugin-dxr3-6e40c29e483fd3eb70d35b76ee7992397498bf9a.tar.bz2 |
- extended cDxr3MemcpyBench::Rdtsc(uint32_t config_flags)
support for non x86 arch
support for cpu's, which dont support rdtsc timing
-rw-r--r-- | HISTORY | 7 | ||||
-rw-r--r-- | dxr3memcpy.c | 46 | ||||
-rw-r--r-- | dxr3memcpy.h | 2 |
3 files changed, 37 insertions, 18 deletions
@@ -238,7 +238,7 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - fixed void cDxr3Interface::SetAudioDigitalPCM() - thanks to Stephan Skrodzki <skrodzki@contcast.de> for patch - dxr3memcpy.c/h: fix to support older compilers like gcc-2.95 Here i want to thanks Marco Schlüßler very much for run compil tests, even he - dont uses the plugin :) + dont run the plugin :) - dxr3memcpy.c/h: should now compile on alpha and powerpc - thanks to Paavo Hartikainen <pahartik@sci.fi> - added many comments into source - using doxygen for docs @@ -251,4 +251,7 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - you can set now logpath in makefile You should also run a linke like # find / -name "dxr3plugin.log" | xargs rm - because the pre2 seems to put this dxr3plugin.log random in some folders - reporded by Martin Dauskardt <md001@gmx.de>
\ No newline at end of file + because the pre2 seems to put this dxr3plugin.log random in some folders - reporded by Martin Dauskardt <md001@gmx.de> +- extended cDxr3MemcpyBench::Rdtsc(uint32_t config_flags) + support for non x86 arch + support for cpu's, which dont support rdtsc timing
\ No newline at end of file diff --git a/dxr3memcpy.c b/dxr3memcpy.c index 1b5f564..c50b350 100644 --- a/dxr3memcpy.c +++ b/dxr3memcpy.c @@ -34,7 +34,12 @@ #include "dxr3log.h" #include "dxr3cpu.h" #include "dxr3memcpy.h" +#include <sys/times.h> +#include <limits.h> + +// ================================== +//! our function pointer void *(* dxr3_memcpy)(void *to, const void *from, size_t len); #ifdef __i386__ @@ -54,7 +59,7 @@ __asm__ __volatile__(\ } */ // ================================== -// linux kernel __memcpy (from: /include/asm/string.h) +//! linux kernel __memcpy (from: /include/asm/string.h) static __inline__ void * __memcpy ( void * to, const void * from, @@ -312,7 +317,7 @@ static void *linux_kernel_memcpy(void *to, const void *from, size_t len) { // ================================== -// constr. +//! constr. cDxr3MemcpyBench::cDxr3MemcpyBench(uint32_t config_flags) { // @@ -389,13 +394,13 @@ cDxr3MemcpyBench::cDxr3MemcpyBench(uint32_t config_flags) } // count 100 runs of the memcpy function - t = Rdtsc(); + t = Rdtsc(config_flags); for (j = 0; j < 50; j++) { m_methods[i].function(buf2,buf1,BUFSIZE); m_methods[i].function(buf1,buf2,BUFSIZE); } - t = Rdtsc() - t; + t = Rdtsc(config_flags) - t; m_methods[i].time = t; @@ -417,16 +422,27 @@ cDxr3MemcpyBench::cDxr3MemcpyBench(uint32_t config_flags) } // ================================== -// neede for exact timing -unsigned long long int cDxr3MemcpyBench::Rdtsc() +//! needed for exact timing +#ifdef __i386__ +unsigned long long int cDxr3MemcpyBench::Rdtsc(uint32_t config_flags) { - #ifdef __i386__ - unsigned long long int x; - __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); - return x; - #else - /* FIXME: implement an equivalent for using optimized memcpy on other - architectures */ - return 0; - #endif + // we need rdtsc support + if (config_flags && CC_MMX) + { + unsigned long long int x; + __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); + return x; + } + else + { + return times(NULL); + } + +} +#else +unsigned long long int cDxr3MemcpyBench::Rdtsc(uint32_t config_flags) +{ + struct tms tp; + return times(&tp); } +#endif
\ No newline at end of file diff --git a/dxr3memcpy.h b/dxr3memcpy.h index 5200434..364f87f 100644 --- a/dxr3memcpy.h +++ b/dxr3memcpy.h @@ -80,7 +80,7 @@ public: cDxr3MemcpyBench(uint32_t config_flags = 0); private: - unsigned long long int Rdtsc(); + unsigned long long int Rdtsc(uint32_t config_flags); std::vector<memcpy_routine> m_methods; ///< a std::vector with all methodes }; |