File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ int main(int argc, char **argv)
198198 unsigned int i , nb_channels ;
199199 unsigned int nb_active_channels = 0 ;
200200 unsigned int buffer_size = SAMPLES_PER_READ ;
201+ unsigned int refill_per_benchmark = REFILL_PER_BENCHMARK ;
201202 int c ;
202203 struct iio_device * dev ;
203204 ssize_t sample_size ;
@@ -400,15 +401,20 @@ int main(int argc, char **argv)
400401 after = get_time_us ();
401402 total += after - before ;
402403
403- if (++ i == REFILL_PER_BENCHMARK ) {
404+ if (++ i == refill_per_benchmark ) {
404405 rate = buffer_size * sample_size *
405- REFILL_PER_BENCHMARK * 1000000ull / total ;
406+ refill_per_benchmark * 1000000ull / total ;
406407 mib = rate > 1048576 ;
407408
408409 fprintf (stderr , "\33[2K\rThroughput: %" PRIu64 " %ciB/s" ,
409410 rate / (1024 * (mib ? 1024 : 1 )),
410411 mib ? 'M' : 'K' );
411412
413+ /* Print every 100ms more or less */
414+ refill_per_benchmark = refill_per_benchmark * 100000 / total ;
415+ if (refill_per_benchmark < REFILL_PER_BENCHMARK )
416+ refill_per_benchmark = REFILL_PER_BENCHMARK ;
417+
412418 i = 0 ;
413419 total = 0 ;
414420 }
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ int main(int argc, char **argv)
209209 unsigned int i , nb_channels ;
210210 unsigned int nb_active_channels = 0 ;
211211 unsigned int buffer_size = SAMPLES_PER_READ ;
212+ unsigned int refill_per_benchmark = REFILL_PER_BENCHMARK ;
212213 int c ;
213214 struct iio_device * dev ;
214215 ssize_t sample_size ;
@@ -445,15 +446,20 @@ int main(int argc, char **argv)
445446 after = get_time_us ();
446447 total += after - before ;
447448
448- if (++ i == REFILL_PER_BENCHMARK ) {
449+ if (++ i == refill_per_benchmark ) {
449450 rate = buffer_size * sample_size *
450- REFILL_PER_BENCHMARK * 1000000ull / total ;
451+ refill_per_benchmark * 1000000ull / total ;
451452 mib = rate > 1048576 ;
452453
453454 fprintf (stderr , "\33[2K\rThroughput: %" PRIu64 " %ciB/s" ,
454455 rate / (1024 * (mib ? 1024 : 1 )),
455456 mib ? 'M' : 'K' );
456457
458+ /* Print every 100ms more or less */
459+ refill_per_benchmark = refill_per_benchmark * 100000 / total ;
460+ if (refill_per_benchmark < REFILL_PER_BENCHMARK )
461+ refill_per_benchmark = REFILL_PER_BENCHMARK ;
462+
457463 i = 0 ;
458464 total = 0 ;
459465 }
You can’t perform that action at this time.
0 commit comments