Wednesday, August 29, 2007

arithmetic

While experimenting with swapping on usb flash storage, I found the following:
Timing cached reads: 666 MB in 2.00 seconds = 332.28 MB/sec
which is absolutely correct.
Here is some code that spits that (adapted from the benchmark program):
unsigned int total_MB = 666;
double elapsed = 2.00435;
printf("%3u MB in %5.2f seconds = %6.2f MB/sec\n",
total_MB, elapsed, total_MB / elapsed);
Have fun.
P.S. It was much slower than swapping on the hard disk and yes, I did use a hi-speed port.

No comments: