45
45
#ifndef MAXREPEATS
46
46
# define MAXREPEATS 10
47
47
#endif
48
+ #ifndef MINREPEATS
49
+ # define MINREPEATS 3
50
+ #endif
48
51
#ifndef LATBENCH_COUNT
49
52
# define LATBENCH_COUNT 10000000
50
53
#endif
@@ -131,7 +134,7 @@ static double bandwidth_bench_helper(int64_t *dstbuf, int64_t *srcbuf,
131
134
if (speed > maxspeed )
132
135
maxspeed = speed ;
133
136
134
- if (s0 > 2 )
137
+ if (s0 > MINREPEATS - 1 )
135
138
{
136
139
s = sqrt ((s0 * s2 - s1 * s1 ) / (s0 * (s0 - 1 )));
137
140
if (s < maxspeed / 1000. )
@@ -141,12 +144,12 @@ static double bandwidth_bench_helper(int64_t *dstbuf, int64_t *srcbuf,
141
144
142
145
if (maxspeed > 0 && s / maxspeed * 100. >= 0.1 )
143
146
{
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. );
146
149
}
147
150
else
148
151
{
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 );
150
153
}
151
154
return maxspeed ;
152
155
}
@@ -493,6 +496,7 @@ int main(void)
493
496
#endif
494
497
495
498
printf ("tinymembench v" VERSION " (simple benchmark for memory throughput and latency)\n" );
499
+ printf ("CFLAGS: " CFLAGS "\n" );
496
500
497
501
498
502
poolbuf = alloc_four_nonaliased_buffers ((void * * )& srcbuf , bufsize ,
@@ -504,13 +508,15 @@ int main(void)
504
508
printf ("== Memory bandwidth tests ==\n" );
505
509
printf ("== ==\n" );
506
510
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" );
508
514
printf ("== copied per second (adding together read and writen ==\n" );
509
515
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" );
511
517
printf ("== to first fetch data into it, and only then write it to the ==\n" );
512
518
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" );
514
520
printf ("== brackets ==\n" );
515
521
printf ("==========================================================================\n\n" );
516
522
0 commit comments