Test more channels Allow to grep output for fastest only with `grep -A 4 'Best Throughput'`
Unified · Split
| @@ -29,8 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | static float input [BUFFER_LEN] ; |
| 30 | 30 | static float output [BUFFER_LEN] ; |
| 31 | 31 | |
| 32 | −static long | |
| 33 | −throughput_test (int converter, int channels, long best_throughput) | |
| 32 | +static void | |
| 33 | +throughput_test (int converter, int channels, long *best_throughput) | |
| 34 | 34 | { SRC_DATA src_data ; |
| 35 | 35 | clock_t start_time, clock_time ; |
| 36 | 36 | double duration ; |
| @@ -85,16 +85,14 @@ throughput_test (int converter, int channels, long best_throughput) · 48 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | throughput = lrint (floor (total_frames / duration)) ; |
| 87 | 87 | |
| 88 | − if (best_throughput == 0) | |
| 89 | − { best_throughput = MAX (throughput, best_throughput) ; | |
| 90 | − printf ("%5.2f %10ld\n", duration, throughput) ; | |
| 88 | + if (!best_throughput) | |
| 89 | + { printf ("%5.2f %10ld\n", duration, throughput) ; | |
| 91 | 90 | } |
| 92 | 91 | else |
| 93 | − { best_throughput = MAX (throughput, best_throughput) ; | |
| 94 | − printf ("%5.2f %10ld %10ld\n", duration, throughput, best_throughput) ; | |
| 92 | + { *best_throughput = MAX (throughput, *best_throughput) ; | |
| 93 | + printf ("%5.2f %10ld %10ld\n", duration, throughput, *best_throughput) ; | |
| 95 | 94 | } |
| 96 | 95 | |
| 97 | − return best_throughput ; | |
| 98 | 96 | } /* throughput_test */ |
| 99 | 97 | |
| 100 | 98 | static void |
| @@ -127,7 +125,7 @@ single_run (void) · 26 unmodified lines | ||
| 127 | 125 | |
| 128 | 126 | static void |
| 129 | 127 | multi_run (int run_count) |
| 130 | −{ int k, ch ; | |
| 128 | +{ int channels[] = {1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18}; | |
| 131 | 129 | |
| 132 | 130 | printf ("\n CPU name : %s\n", get_cpu_name ()) ; |
| 133 | 131 | |
| @@ -137,13 +135,14 @@ multi_run (int run_count) · 3 unmodified lines | ||
| 137 | 135 | " ----------------------------------------------------------------------------------------" |
| 138 | 136 | ) ; |
| 139 | 137 | |
| 140 | − for (ch = 1 ; ch <= 5 ; ch++) | |
| 138 | + for (int i = 0 ; i < ARRAY_LEN(channels) ; i++) | |
| 141 | 139 | { long sinc_fastest = 0, sinc_medium = 0, sinc_best = 0 ; |
| 140 | + int ch = channels[i]; | |
| 142 | 141 | |
| 143 | − for (k = 0 ; k < run_count ; k++) | |
| 144 | − { sinc_fastest = throughput_test (SRC_SINC_FASTEST, ch, sinc_fastest) ; | |
| 145 | − sinc_medium = throughput_test (SRC_SINC_MEDIUM_QUALITY, ch, sinc_medium) ; | |
| 146 | − sinc_best = throughput_test (SRC_SINC_BEST_QUALITY, ch, sinc_best) ; | |
| 142 | + for (int k = 0 ; k < run_count ; k++) | |
| 143 | + { throughput_test (SRC_SINC_FASTEST, ch, &sinc_fastest) ; | |
| 144 | + throughput_test (SRC_SINC_MEDIUM_QUALITY, ch, &sinc_medium) ; | |
| 145 | + throughput_test (SRC_SINC_BEST_QUALITY, ch, &sinc_best) ; | |
| 147 | 146 | |
| 148 | 147 | puts ("") ; |
| 149 | 148 | |
| @@ -155,10 +154,11 @@ multi_run (int run_count) · 5 unmodified lines | ||
| 155 | 154 | #endif |
| 156 | 155 | } ; |
| 157 | 156 | |
| 158 | − puts ( | |
| 157 | + printf ( | |
| 159 | 158 | "\n" |
| 160 | − " Converter Best Throughput\n" | |
| 161 | − " ------------------------------------------------" | |
| 159 | + " Converter (channels: %d) Best Throughput\n" | |
| 160 | + " ------------------------------------------------\n", | |
| 161 | + ch | |
| 162 | 162 | ) ; |
| 163 | 163 | |
| 164 | 164 | printf (" %-30s %10ld\n", src_get_name (SRC_SINC_FASTEST), sinc_fastest) ; |