// Quick and dirty hack to measure a system's memory speed #include #include #include #include #include // How big of a chunk of memory to move around // 50 megs.. I think.. #define MEM_SIZE 1024*5000 unsigned long long c; void sig_alrm(int x) { printf("%llu\n", c); exit(0); } int main() { char *p, *p2; signal(14, sig_alrm); alarm(10); p = malloc(MEM_SIZE); p2 = malloc(MEM_SIZE); for(c=0;;c++) { memcpy(p, p2, MEM_SIZE); memcpy(p2, p, MEM_SIZE); } }