Skip to content

Commit

Permalink
numademo: Adjust memcpy test bandwidth calculation
Browse files Browse the repository at this point in the history
Only use half the memory for bandwidth.

Fixes #200
  • Loading branch information
Andi Kleen committed Jan 6, 2024
1 parent a68578c commit 2aa89de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion numademo.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ static void memtest(char *name, unsigned char *mem)
unsigned long long max, min, sum, r;
int i;
char title[128], result[128];
unsigned long factor = 1;

if (!mem) {
fprintf(stderr,
Expand Down Expand Up @@ -202,6 +203,7 @@ static void memtest(char *name, unsigned char *mem)
gettimeofday(&start,NULL);
memcpy(mem, mem + msize/2, msize/2);
gettimeofday(&end,NULL);
factor = 2;
break;

case FORWARD:
Expand Down Expand Up @@ -261,7 +263,7 @@ static void memtest(char *name, unsigned char *mem)
sum += r;
}
sprintf(title, "%s%s%s", name, delim, testname[thistest]);
#define H(t) (((double)msize) / ((double)t))
#define H(t) (((double)msize/factor) / ((double)t))
#define D3 delim,delim,delim
sprintf(result, "Avg%s%.2f%sMB/s%sMax%s%.2f%sMB/s%sMin%s%.2f%sMB/s",
delim,
Expand Down

0 comments on commit 2aa89de

Please sign in to comment.