Skip to content

Commit c4f41b1

Browse files
committed
Add MINREPEATS define and print repeats in results
1 parent a2cf6d7 commit c4f41b1

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ifdef WINDIR
55
endif
66

77
tinymembench: main.c util.o util.h asm-opt.h version.h asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o
8-
${CC} -O2 ${CFLAGS} -o tinymembench main.c util.o asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o -lm
8+
${CC} -O2 ${CFLAGS} "-DCFLAGS=\"${CFLAGS}\"" -o tinymembench main.c util.o asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o -lm
99

1010
util.o: util.c util.h
1111
${CC} -O2 ${CFLAGS} -c util.c

main.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
#ifndef MAXREPEATS
4646
# define MAXREPEATS 10
4747
#endif
48+
#ifndef MINREPEATS
49+
# define MINREPEATS 3
50+
#endif
4851
#ifndef LATBENCH_COUNT
4952
# define LATBENCH_COUNT 10000000
5053
#endif
@@ -131,7 +134,7 @@ static double bandwidth_bench_helper(int64_t *dstbuf, int64_t *srcbuf,
131134
if (speed > maxspeed)
132135
maxspeed = speed;
133136

134-
if (s0 > 2)
137+
if (s0 > MINREPEATS - 1)
135138
{
136139
s = sqrt((s0 * s2 - s1 * s1) / (s0 * (s0 - 1)));
137140
if (s < maxspeed / 1000.)
@@ -141,12 +144,12 @@ static double bandwidth_bench_helper(int64_t *dstbuf, int64_t *srcbuf,
141144

142145
if (maxspeed > 0 && s / maxspeed * 100. >= 0.1)
143146
{
144-
printf("%s%-52s : %8.1f MB/s (%.1f%%)\n", indent_prefix, description,
145-
maxspeed, s / maxspeed * 100.);
147+
printf("%s%-48s : %8.1f MB/s (%.f, %.1f%%)\n", indent_prefix, description,
148+
maxspeed, s0, s / maxspeed * 100.);
146149
}
147150
else
148151
{
149-
printf("%s%-52s : %8.1f MB/s\n", indent_prefix, description, maxspeed);
152+
printf("%s%-48s : %8.1f MB/s (%.f)\n", indent_prefix, description, maxspeed, s0);
150153
}
151154
return maxspeed;
152155
}
@@ -493,6 +496,7 @@ int main(void)
493496
#endif
494497

495498
printf("tinymembench v" VERSION " (simple benchmark for memory throughput and latency)\n");
499+
printf("CFLAGS: " CFLAGS "\n");
496500

497501

498502
poolbuf = alloc_four_nonaliased_buffers((void **)&srcbuf, bufsize,
@@ -504,13 +508,15 @@ int main(void)
504508
printf("== Memory bandwidth tests ==\n");
505509
printf("== ==\n");
506510
printf("== Note 1: 1MB = 1000000 bytes ==\n");
507-
printf("== Note 2: Results for 'copy' tests show how many bytes can be ==\n");
511+
printf("== Note 2: Test result is the best of repeated runs. Number of repeats ==\n");
512+
printf("== is shown in brackets ==\n");
513+
printf("== Note 3: Results for 'copy' tests show how many bytes can be ==\n");
508514
printf("== copied per second (adding together read and writen ==\n");
509515
printf("== bytes would have provided twice higher numbers) ==\n");
510-
printf("== Note 3: 2-pass copy means that we are using a small temporary buffer ==\n");
516+
printf("== Note 4: 2-pass copy means that we are using a small temporary buffer ==\n");
511517
printf("== to first fetch data into it, and only then write it to the ==\n");
512518
printf("== destination (source -> L1 cache, L1 cache -> destination) ==\n");
513-
printf("== Note 4: If sample standard deviation exceeds 0.1%%, it is shown in ==\n");
519+
printf("== Note 5: If sample standard deviation exceeds 0.1%%, it is shown in ==\n");
514520
printf("== brackets ==\n");
515521
printf("==========================================================================\n\n");
516522

version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define VERSION "0.4.9"
1+
#define VERSION "0.4.9-nuumio"

0 commit comments

Comments
 (0)