Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 64306 Details for
Bug 100289
Glibc patches to enhance performance on x86_64.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
memcpy.c
memcpy.c (text/plain), 1.70 KB, created by
Simon Strandman
on 2005-07-25 14:28:56 UTC
(
hide
)
Description:
memcpy.c
Filename:
MIME Type:
Creator:
Simon Strandman
Created:
2005-07-25 14:28:56 UTC
Size:
1.70 KB
patch
obsolete
>// memcpy.c - Measure how fast we can copy memory > >#include <stdio.h> >#include <stdlib.h> >#include <time.h> >#include <string.h> > >/* timing function */ >#define rdtscll(val) do { \ > unsigned int a,d; \ > asm volatile("rdtsc" : "=a" (a), "=d" (d)); \ > (val) = ((unsigned long)a) | (((unsigned long)d)<<32); \ >} while(0) > >int main(int argc, char *argv[]) { > int cpu_rate, num_loops, block_size, block_size_lwords, i, j; > unsigned char *send_block_p, *rcv_block_p; > unsigned long start_time, end_time; > float rate; > unsigned long *s_p, *r_p; > > if (argc != 4) { > fprintf(stderr, > "Usage: %s <cpu clk rate (MHz)> <num. iterations> <copy block size>\n", > argv[0] ); > return 1; > } > > cpu_rate = atoi(argv[1]); > num_loops = atoi(argv[2]); > block_size = atoi(argv[3]); > > block_size_lwords = block_size / sizeof(unsigned long); > block_size = sizeof(unsigned long) * block_size_lwords; > > send_block_p = malloc(block_size); > rcv_block_p = malloc(block_size); > > if ((send_block_p == NULL) || (rcv_block_p == NULL)) { > fprintf(stderr, "Malloc failed to allocate block(s) of size %d.\n", > block_size); > } > >// start_time = clock(); > rdtscll(start_time); > > for (i = 0; i < num_loops; i++) { > memcpy(rcv_block_p, send_block_p, block_size); > >// s_p = (unsigned long *) send_block_p; >// r_p = (unsigned long *) rcv_block_p; >// >// for (j = 0 ; j < block_size_lwords; j++) { >// *(r_p++) = *(s_p++); >// } > } > >// end_time = clock(); > rdtscll(end_time); > > rate = (float) (block_size) * (float) (num_loops) / > ((float) (end_time - start_time)) * > ((float) cpu_rate) * 1.0E6 / 1.0E6; > > fprintf(stdout, > "Memory to memory copy rate = %f MBytes / sec. Block size = %d.\n", > rate, block_size); > >} /* end main() */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 100289
:
64301
|
64302
|
64303
|
64304
|
64305
| 64306 |
65840
|
81968
|
81969