summaryrefslogtreecommitdiff
path: root/mbw.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbw.c')
-rw-r--r--mbw.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mbw.c b/mbw.c
index 3a02826..6251ea9 100644
--- a/mbw.c
+++ b/mbw.c
@@ -27,6 +27,8 @@
* MBW memory bandwidth benchmark
*
* 2006, 2012 Andras.Horvath@gmail.com
+ * 2013 j.m.slocum@gmail.com
+ * (Special thanks to Stephen Pasich)
*
* http://github.com/raas/mbw
*
@@ -105,12 +107,14 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon
/* timer stops */
gettimeofday(&endtime, NULL);
} else if(type==2) { /* memcpy block test */
+ char* aa = (char*)a;
+ char* bb = (char*)b;
gettimeofday(&starttime, NULL);
- for(t=0; t<array_bytes; t+=block_size) {
- b=mempcpy(b, a, block_size);
+ for (t=array_bytes; t >= block_size; t-=block_size, aa+=block_size){
+ bb=mempcpy(bb, aa, block_size);
}
- if(t>array_bytes) {
- b=mempcpy(b, a, t-array_bytes);
+ if(t) {
+ bb=mempcpy(bb, aa, t);
}
gettimeofday(&endtime, NULL);
} else { /* dumb test */