diff options
author | atmosfear <atmosfear@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-04-21 18:19:12 +0000 |
---|---|---|
committer | atmosfear <atmosfear@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-04-21 18:19:12 +0000 |
commit | a2c7d931dbbee251815f8af22c4d639ed4692637 (patch) | |
tree | 02b1240f35b109513c13a6c9fd22d3bc4eabe921 /TOOLS | |
parent | d73d923d051efea8d8d044cab512e0358d4010ce (diff) | |
download | mpv-a2c7d931dbbee251815f8af22c4d639ed4692637.tar.bz2 mpv-a2c7d931dbbee251815f8af22c4d639ed4692637.tar.xz |
Initial release, used to benchmark fastmemcpy.h code from libvo.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@563 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rw-r--r-- | TOOLS/fastmemcpybench.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/TOOLS/fastmemcpybench.c b/TOOLS/fastmemcpybench.c new file mode 100644 index 0000000000..e7115ff72e --- /dev/null +++ b/TOOLS/fastmemcpybench.c @@ -0,0 +1,37 @@ +/* + fastmemcpybench.c used to benchmark fastmemcpy.h code from libvo. + + Note: this code can not be used on PentMMX-PII because they contain + a bug in rdtsc. For Intel processors since P6(PII) rdpmc should be used + instead. For PIII it's disputable and seems bug was fixed but I don't + tested it. +*/ + +#include <stdio.h> + +#include "../libvo/fastmemcpy.h" + +#define ARR_SIZE 100000 +//#define ARR_SIZE 1000000 + +static inline unsigned long long int read_tsc( void ) +{ + unsigned long long int retval; + __asm __volatile ("rdtsc":"=A"(retval)::"memory"); + return retval; +} + +unsigned char arr1[ARR_SIZE],arr2[ARR_SIZE]; + +int main( void ) +{ + unsigned long long int v1,v2; + unsigned char * marr1,*marr2; + marr1 = &arr1[1]; + marr2 = &arr2[3]; + v1 = read_tsc(); + memcpy(marr1,marr2,ARR_SIZE-4); + v2 = read_tsc(); + printf("v1 = %llu v2 = %llu v2-v1=%llu\n",v1,v2,v2-v1); + return 0; +} |