History

Improve multichan_throughput_test

Test more channels Allow to grep output for fastest only with `grep -A 4 'Best Throughput'`

Alexander Grund committed 7 years ago

Commit 30547e21 parent 54186d51 file · +17 −17Browse files

Unified · Split

tests/multichan_throughput_test.c+17−17
@@ -29,8 +29,8 @@ · 28 unmodified lines
2929 static float input [BUFFER_LEN] ;
3030 static float output [BUFFER_LEN] ;
3131
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)
3434 { SRC_DATA src_data ;
3535 clock_t start_time, clock_time ;
3636 double duration ;
@@ -85,16 +85,14 @@ throughput_test (int converter, int channels, long best_throughput) · 48 unmodified lines
8585
8686 throughput = lrint (floor (total_frames / duration)) ;
8787
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) ;
9190 }
9291 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) ;
9594 }
9695
97− return best_throughput ;
9896 } /* throughput_test */
9997
10098 static void
@@ -127,7 +125,7 @@ single_run (void) · 26 unmodified lines
127125
128126 static void
129127 multi_run (int run_count)
130−{ int k, ch ;
128+{ int channels[] = {1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18};
131129
132130 printf ("\n CPU name : %s\n", get_cpu_name ()) ;
133131
@@ -137,13 +135,14 @@ multi_run (int run_count) · 3 unmodified lines
137135 " ----------------------------------------------------------------------------------------"
138136 ) ;
139137
140− for (ch = 1 ; ch <= 5 ; ch++)
138+ for (int i = 0 ; i < ARRAY_LEN(channels) ; i++)
141139 { long sinc_fastest = 0, sinc_medium = 0, sinc_best = 0 ;
140+ int ch = channels[i];
142141
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) ;
147146
148147 puts ("") ;
149148
@@ -155,10 +154,11 @@ multi_run (int run_count) · 5 unmodified lines
155154 #endif
156155 } ;
157156
158− puts (
157+ printf (
159158 "\n"
160− " Converter Best Throughput\n"
161− " ------------------------------------------------"
159+ " Converter (channels: %d) Best Throughput\n"
160+ " ------------------------------------------------\n",
161+ ch
162162 ) ;
163163
164164 printf (" %-30s %10ld\n", src_get_name (SRC_SINC_FASTEST), sinc_fastest) ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t