Debian Codegraph @

Xpjproject/pjlib/src/pjlib-test/ioq_perf.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "test.h"
20 #include <pjlib.h>
21 #include <pj/compat/high_precision.h>
22
23 /**
24 * \page page_pjlib_ioqueue_perf_test Test: I/O Queue Performance
25 *
26 * Test the performance of the I/O queue, using typical producer
27 * consumer test. The test should examine the effect of using multiple
28 * threads on the performance.
29 *
30 * This file is <b>pjlib-test/ioq_perf.c</b>
31 *
32 * \include pjlib-test/ioq_perf.c
33 */
34
35 #if INCLUDE_IOQUEUE_PERF_TEST
36
37 #ifdef _MSC_VER
38 # pragma warning ( disable: 4204) // non-constant aggregate initializer
39 #endif
40
41 #define THIS_FILE "ioq_perf"
42 //#define TRACE_(expr) PJ_LOG(3,expr)
43 #define TRACE_(expr)
44
45
46 static pj_bool_t thread_quit_flag;
47 static pj_status_t last_error;
48 static unsigned last_error_counter;
49
50 /* Limit the number of send/receive to this value. The recommended value is
51 * zero, to limit the test by some duration. IMO setting this value to non-zero
52 * will cause the test to terminate prematurely:
53 * a) setting it to 10000 (the old behavior) causes the test to complete in 1ms.
54 * b) any thread that first reaches this value will cause other threads to
55 * quit, even if that other threads have not processed anything.
56 */
57 //#define LIMIT_TRANSFER 10000
58 #define LIMIT_TRANSFER 0
59
60 /* Silenced error(s):
61 * -Linux/Unix: EAGAIN (Resource temporarily unavailable)
62 * -Windows: WSAEWOULDBLOCK
63 */
64 #define IS_ERROR_SILENCED(e) ((e)==PJ_STATUS_FROM_OS(PJ_BLOCKING_ERROR_VAL))
65
66 /* Descriptor for each producer/consumer pair. */
67 typedef struct test_item
68 {
69 const char *type_name;
70 pj_sock_t server_fd,
71 client_fd;
72 pj_ioqueue_t *ioqueue;
73 pj_ioqueue_key_t *server_key,
74 *client_key;
75 pj_ioqueue_op_key_t recv_op,
76 send_op;
77 int has_pending_send;
78 pj_size_t buffer_size;
79 char *outgoing_buffer;
80 char *incoming_buffer;
81 pj_size_t bytes_sent,
82 bytes_recv;
83 } test_item;
84
85 /* Callback when data has been read.
86 * Increment item->bytes_recv and ready to read the next data.
87 */
88 static void on_read_complete(pj_ioqueue_key_t *key,
89 pj_ioqueue_op_key_t *op_key,
90 pj_ssize_t bytes_read)
91 {
92 test_item *item = (test_item*)pj_ioqueue_get_user_data(key);
93 pj_status_t rc;
94 int data_is_available = 1;
95
96 //TRACE_((THIS_FILE, " read complete, bytes_read=%d", bytes_read));
97
98 do {
99 if (thread_quit_flag)
100 return;
101
102 if (bytes_read < 0) {
103 char errmsg[PJ_ERR_MSG_SIZE];
104
105 rc = (pj_status_t)-bytes_read;
106 if (rc != last_error) {
107 //last_error = rc;
108
109 /* Note:
110 * we can receive EAGAIN (on Linux/Unix) or EWOULDBLOCK (on Win)
111 * when we have more than one threads competing to do recv().
112 * This is a normal situation even when EPOLLEXCLUSIVE is used
113 * (e.g two packets arrive at the same time, causing both
114 * threads to wake up, but thread A greedily read the packets)
115 * therefore we silence the error here.
116 */
117 if (!IS_ERROR_SILENCED(rc)) {
118 pj_strerror(rc, errmsg, sizeof(errmsg));
119 PJ_LOG(3,(THIS_FILE,"...error: read error, bytes_read=%ld (%s)",
120 bytes_read, errmsg));
121 PJ_LOG(3,(THIS_FILE,
122 ".....additional info: type=%s, total read=%lu, "
123 "total sent=%lu",
124 item->type_name, (unsigned long)item->bytes_recv,
125 (unsigned long)item->bytes_sent));
126 }
127 } else {
128 last_error_counter++;
129 }
130 bytes_read = 0;
131
132 } else if (bytes_read == 0) {
133 PJ_LOG(3,(THIS_FILE, "...socket has closed!"));
134 }
135
136 item->bytes_recv += bytes_read;
137
138 /* To assure that the test quits, even if main thread
139 * doesn't have time to run.
140 */
141 if (LIMIT_TRANSFER && item->bytes_recv>item->buffer_size*LIMIT_TRANSFER)
142 thread_quit_flag = 1;
143
144 bytes_read = item->buffer_size;
145 rc = pj_ioqueue_recv( key, op_key,
146 item->incoming_buffer, &bytes_read, 0 );
147
148 if (rc == PJ_SUCCESS) {
149 data_is_available = 1;
150 } else if (rc == PJ_EPENDING) {
151 data_is_available = 0;
152 } else {
153 data_is_available = 0;
154 if (rc != last_error) {
155 last_error = rc;
156 app_perror("...error: read error(1)", rc);
157 } else {
158 last_error_counter++;
159 }
160 }
161
162 if (!item->has_pending_send) {
163 pj_ssize_t sent = item->buffer_size;
164 rc = pj_ioqueue_send(item->client_key, &item->send_op,
165 item->outgoing_buffer, &sent, 0);
166 if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
167 app_perror("...error: write error", rc);
168 } else if (rc == PJ_SUCCESS) {
169 item->bytes_sent += sent;
170 }
171
172 item->has_pending_send = (rc==PJ_EPENDING);
173 }
174
175 } while (data_is_available);
176 }
177
178 /* Callback when data has been written.
179 * Increment item->bytes_sent and write the next data.
180 */
181 static void on_write_complete(pj_ioqueue_key_t *key,
182 pj_ioqueue_op_key_t *op_key,
183 pj_ssize_t bytes_sent)
184 {
185 test_item *item = (test_item*) pj_ioqueue_get_user_data(key);
186
187 //TRACE_((THIS_FILE, " write complete: sent = %d", bytes_sent));
188
189 if (thread_quit_flag)
190 return;
191
192 if (bytes_sent <= 0) {
193 if (!IS_ERROR_SILENCED(-bytes_sent)) {
194 PJ_PERROR(3, (THIS_FILE, (pj_status_t)-bytes_sent,
195 "...error: sending stopped. bytes_sent=%ld",
196 -bytes_sent));
197 }
198 item->has_pending_send = 0;
199 }
200 else if (!item->has_pending_send) {
201 pj_status_t rc;
202
203 item->bytes_sent += bytes_sent;
204 bytes_sent = item->buffer_size;
205 rc = pj_ioqueue_send( item->client_key, op_key,
206 item->outgoing_buffer, &bytes_sent, 0);
207 if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
208 app_perror("...error: write error", rc);
209 } else if (rc == PJ_SUCCESS) {
210 item->bytes_sent += bytes_sent;
211 }
212
213 item->has_pending_send = (rc==PJ_EPENDING);
214 }
215 }
216
217 struct thread_arg
218 {
219 int id;
220 pj_ioqueue_t *ioqueue;
221 unsigned loop_cnt,
222 err_cnt,
223 event_cnt;
224 };
225
226 /* The worker thread. */
227 static int worker_thread(void *p)
228 {
229 struct thread_arg *arg = (struct thread_arg*) p;
230 const pj_time_val timeout = {0, 100};
231 int rc;
232
233 while (!thread_quit_flag) {
234
235 ++arg->loop_cnt;
236 rc = pj_ioqueue_poll(arg->ioqueue, &timeout);
237 //TRACE_((THIS_FILE, " thread: poll returned rc=%d", rc));
238 if (rc < 0) {
239 char errmsg[PJ_ERR_MSG_SIZE];
240 pj_strerror(-rc, errmsg, sizeof(errmsg));
241 PJ_LOG(3, (THIS_FILE,
242 "...error in pj_ioqueue_poll() in thread %d "
243 "after %d loop: %s [pj_status_t=%d]",
244 arg->id, arg->loop_cnt, errmsg, -rc));
245 //return -1;
246 ++arg->err_cnt;
247 } else if (rc > 0) {
248 ++arg->event_cnt;
249 }
250 }
251 return 0;
252 }
253
254 /* Calculate the bandwidth for the specific test configuration.
255 * The test is simple:
256 * - create sockpair_cnt number of producer-consumer socket pair.
257 * - create thread_cnt number of worker threads.
258 * - each producer will send buffer_size bytes data as fast and
259 * as soon as it can.
260 * - each consumer will read buffer_size bytes of data as fast
261 * as it could.
262 * - measure the total bytes received by all consumers during a
263 * period of time.
264 */
265 static int perform_test(const pj_ioqueue_cfg *cfg,
266 int sock_type, const char *type_name,
267 unsigned thread_cnt, unsigned sockpair_cnt,
268 pj_size_t buffer_size,
269 pj_bool_t display_report,
270 pj_size_t *p_bandwidth)
271 {
272 enum { MSEC_DURATION = 5000 };
273 pj_pool_t *pool;
274 test_item *items;
275 pj_thread_t **thread;
276 struct thread_arg *args;
277 pj_ioqueue_t *ioqueue;
278 pj_status_t rc;
279 pj_ioqueue_callback ioqueue_callback;
280 pj_size_t total_elapsed_usec, total_received;
281 pj_highprec_t bandwidth;
282 pj_timestamp start, stop;
283 unsigned i;
284
285 TRACE_((THIS_FILE, " starting test.."));
286
287 pj_bzero(&ioqueue_callback, sizeof(ioqueue_callback));
288 ioqueue_callback.on_read_complete = &on_read_complete;
289 ioqueue_callback.on_write_complete = &on_write_complete;
290
291 thread_quit_flag = 0;
292
293 PJ_TEST_NOT_NULL((pool=pj_pool_create(mem, NULL, 4096, 4096, NULL)),
294 NULL, return -10);
295
296 items = (test_item*) pj_pool_calloc(pool, sockpair_cnt, sizeof(test_item));
297 thread = (pj_thread_t**)
298 pj_pool_alloc(pool, thread_cnt*sizeof(pj_thread_t*));
299
300 TRACE_((THIS_FILE, " creating ioqueue.."));
301 PJ_TEST_SUCCESS(pj_ioqueue_create2(pool, sockpair_cnt*2, cfg, &ioqueue),
302 NULL, return -15);
303
304 /* Initialize each producer-consumer pair. */
305 for (i=0; i<sockpair_cnt; ++i) {
306 pj_ssize_t bytes;
307
308 items[i].type_name = type_name;
309 items[i].ioqueue = ioqueue;
310 items[i].buffer_size = buffer_size;
311 items[i].outgoing_buffer = (char*) pj_pool_alloc(pool, buffer_size);
312 items[i].incoming_buffer = (char*) pj_pool_alloc(pool, buffer_size);
313 items[i].bytes_recv = items[i].bytes_sent = 0;
314
315 /* randomize outgoing buffer. */
316 pj_create_random_string(items[i].outgoing_buffer, buffer_size);
317
318 /* Init operation keys. */
319 pj_ioqueue_op_key_init(&items[i].recv_op, sizeof(items[i].recv_op));
320 pj_ioqueue_op_key_init(&items[i].send_op, sizeof(items[i].send_op));
321
322 /* Create socket pair. */
323 TRACE_((THIS_FILE, " calling socketpair.."));
324 PJ_TEST_SUCCESS(app_socketpair(pj_AF_INET(), sock_type, 0,
325 &items[i].server_fd,
326 &items[i].client_fd),
327 NULL, return -20);
328
329 /* Register server socket to ioqueue. */
330 TRACE_((THIS_FILE, " register(1).."));
331 PJ_TEST_SUCCESS( pj_ioqueue_register_sock( pool, ioqueue,
332 items[i].server_fd,
333 &items[i],
334 &ioqueue_callback,
335 &items[i].server_key),
336 NULL, return -60);
337
338 /* Register client socket to ioqueue. */
339 TRACE_((THIS_FILE, " register(2).."));
340 PJ_TEST_SUCCESS( pj_ioqueue_register_sock(pool, ioqueue,
341 items[i].client_fd,
342 &items[i],
343 &ioqueue_callback,
344 &items[i].client_key),
345 NULL, return -70);
346
347 /* Start reading. */
348 TRACE_((THIS_FILE, " pj_ioqueue_recv.."));
349 bytes = items[i].buffer_size;
350 PJ_TEST_EQ( pj_ioqueue_recv(items[i].server_key, &items[i].recv_op,
351 items[i].incoming_buffer, &bytes, 0),
352 PJ_EPENDING, NULL, return -73);
353
354 /* Start writing. */
355 TRACE_((THIS_FILE, " pj_ioqueue_write.."));
356 bytes = items[i].buffer_size;
357 rc = pj_ioqueue_send(items[i].client_key, &items[i].send_op,
358 items[i].outgoing_buffer, &bytes, 0);
359 PJ_TEST_TRUE(rc==PJ_SUCCESS || rc==PJ_EPENDING, "pj_ioqueue_send",
360 return -76);
361 if (rc == PJ_SUCCESS) {
362 items[i].bytes_sent += bytes;
363 }
364
365 items[i].has_pending_send = (rc==PJ_EPENDING);
366 }
367
368 /* Create the threads. */
369 args = (struct thread_arg*) pj_pool_calloc(pool, thread_cnt,
370 sizeof(struct thread_arg));
371 for (i=0; i<thread_cnt; ++i) {
372 struct thread_arg *arg = &args[i];
373 arg->id = i;
374 arg->ioqueue = ioqueue;
375
376 PJ_TEST_SUCCESS( pj_thread_create( pool, NULL,
377 &worker_thread,
378 arg,
379 PJ_THREAD_DEFAULT_STACK_SIZE,
380 PJ_THREAD_SUSPENDED, &thread[i] ),
381 NULL, return -80);
382 }
383
384 /* Mark start time. */
385 PJ_TEST_SUCCESS( pj_get_timestamp(&start), NULL, return -90);
386
387 /* Start the thread. */
388 TRACE_((THIS_FILE, " resuming all threads.."));
389 for (i=0; i<thread_cnt; ++i) {
390 PJ_TEST_SUCCESS(pj_thread_resume(thread[i]), NULL, return -100);
391 }
392
393 /* Wait for MSEC_DURATION seconds.
394 * This should be as simple as pj_thread_sleep(MSEC_DURATION) actually,
395 * but unfortunately it doesn't work when system doesn't employ
396 * timeslicing for threads.
397 */
398 TRACE_((THIS_FILE, " wait for few seconds.."));
399 do {
400 pj_thread_sleep(1);
401
402 /* Mark end time. */
403 rc = pj_get_timestamp(&stop);
404
405 if (thread_quit_flag) {
406 TRACE_((THIS_FILE, " transfer limit reached.."));
407 break;
408 }
409
410 if (pj_elapsed_usec(&start,&stop) > MSEC_DURATION * 1000) {
411 TRACE_((THIS_FILE, " time limit reached.."));
412 break;
413 }
414
415 } while (1);
416
417 /* Terminate all threads. */
418 TRACE_((THIS_FILE, " terminating all threads.."));
419 thread_quit_flag = 1;
420
421 for (i=0; i<thread_cnt; ++i) {
422 TRACE_((THIS_FILE, " join thread %d..", i));
423 pj_thread_join(thread[i]);
424 }
425
426 /* Calculate actual time in usec. */
427 total_elapsed_usec = pj_elapsed_usec(&start, &stop);
428
429 /* Close all sockets. */
430 TRACE_((THIS_FILE, " closing all sockets.."));
431 for (i=0; i<sockpair_cnt; ++i) {
432 pj_ioqueue_unregister(items[i].server_key);
433 pj_ioqueue_unregister(items[i].client_key);
434 }
435
436 /* Destroy threads */
437 for (i=0; i<thread_cnt; ++i) {
438 pj_thread_destroy(thread[i]);
439 }
440
441 /* Destroy ioqueue. */
442 TRACE_((THIS_FILE, " destroying ioqueue.."));
443 pj_ioqueue_destroy(ioqueue);
444
445 /* Calculate total bytes received. */
446 total_received = 0;
447 for (i=0; i<sockpair_cnt; ++i) {
448 total_received += items[i].bytes_recv;
449 }
450
451 /* bandwidth = total_received*1000/total_elapsed_usec */
452 bandwidth = (pj_highprec_t)total_received;
453 pj_highprec_mul(bandwidth, 1000);
454 pj_highprec_div(bandwidth, total_elapsed_usec);
455
456 *p_bandwidth = (pj_uint32_t)bandwidth;
457
458 if (display_report) {
459 PJ_LOG(3,(THIS_FILE, " %s %d threads, %d pairs", type_name,
460 thread_cnt, sockpair_cnt));
461 PJ_LOG(3,(THIS_FILE, " Elapsed : %lu msec",
462 (unsigned long)(total_elapsed_usec/1000)));
463 PJ_LOG(3,(THIS_FILE, " Bandwidth: %lu KB/s",
464 (unsigned long)*p_bandwidth));
465 PJ_LOG(3,(THIS_FILE, " Threads statistics:"));
466 PJ_LOG(3,(THIS_FILE, " ============================="));
467 PJ_LOG(3,(THIS_FILE, " Thread Loops Events Errors"));
468 PJ_LOG(3,(THIS_FILE, " ============================="));
469 for (i=0; i<thread_cnt; ++i) {
470 struct thread_arg *arg = &args[i];
471 PJ_LOG(3,(THIS_FILE, " %6d %6d %6d %6d",
472 arg->id, arg->loop_cnt, arg->event_cnt, arg->err_cnt));
473 }
474 PJ_LOG(3,(THIS_FILE, " ============================="));
475 PJ_LOG(3,(THIS_FILE, " Socket-pair statistics:"));
476 PJ_LOG(3,(THIS_FILE, " ==================================="));
477 PJ_LOG(3,(THIS_FILE, " Pair Sent Recv Pct total"));
478 PJ_LOG(3,(THIS_FILE, " ==================================="));
479 for (i=0; i<sockpair_cnt; ++i) {
480 test_item *item = &items[i];
481 PJ_LOG(3,(THIS_FILE, " %4d %5.1f MB %5.1f MB %5.1f%%",
482 i, item->bytes_sent/1000000.0,
483 item->bytes_recv/1000000.0,
484 item->bytes_recv*100.0/total_received));
485 }
486 } else {
487 PJ_LOG(3,(THIS_FILE, " %.4s %2d %2d %8lu KB/s",
488 type_name, thread_cnt, sockpair_cnt,
489 (unsigned long)*p_bandwidth));
490 }
491
492 /* Done. */
493 pj_pool_release(pool);
494
495 TRACE_((THIS_FILE, " done.."));
496 return 0;
497 }
498
499 static int ioqueue_perf_test_imp(const pj_ioqueue_cfg *cfg)
500 {
501 enum { BUF_SIZE = 512 };
502 int i, rc;
503 struct {
504 int type;
505 const char *type_name;
506 int thread_cnt;
507 int sockpair_cnt;
508 } test_param[] =
509 {
510 { pj_SOCK_DGRAM(), "udp", 1, 1},
511 { pj_SOCK_DGRAM(), "udp", 2, 2},
512 { pj_SOCK_DGRAM(), "udp", 4, 4},
513 { pj_SOCK_DGRAM(), "udp", 8, 8},
514 { pj_SOCK_DGRAM(), "udp", 16, 16},
515
516 { pj_SOCK_STREAM(), "tcp", 1, 1},
517 { pj_SOCK_STREAM(), "tcp", 2, 2},
518 { pj_SOCK_STREAM(), "tcp", 4, 4},
519 { pj_SOCK_STREAM(), "tcp", 8, 8},
520 { pj_SOCK_STREAM(), "tcp", 16, 16},
521 };
522 pj_size_t best_bandwidth;
523 int best_index = 0;
524
525 PJ_LOG(3,(THIS_FILE, " Benchmarking %s ioqueue:", pj_ioqueue_name()));
526 PJ_LOG(3,(THIS_FILE, " Testing with concurency=%d, epoll_flags=0x%x",
527 cfg->default_concurrency, cfg->epoll_flags));
528 PJ_LOG(3,(THIS_FILE, " ======================================="));
529 PJ_LOG(3,(THIS_FILE, " Type Threads Skt.Pairs Bandwidth"));
530 PJ_LOG(3,(THIS_FILE, " ======================================="));
531
532 best_bandwidth = 0;
533 for (i=0; i<(int)PJ_ARRAY_SIZE(test_param); ++i) {
534 pj_size_t bandwidth;
535
536 rc = perform_test(cfg,
537 test_param[i].type,
538 test_param[i].type_name,
539 test_param[i].thread_cnt,
540 test_param[i].sockpair_cnt,
541 BUF_SIZE,
542 PJ_FALSE,
543 &bandwidth);
544 if (rc != 0)
545 return rc;
546
547 if (bandwidth > best_bandwidth)
548 best_bandwidth = bandwidth, best_index = i;
549
550 /* Give it a rest before next test, to allow system to close the
551 * sockets properly.
552 */
553 pj_thread_sleep(500);
554 }
555
556 PJ_LOG(3,(THIS_FILE,
557 " Best: Type=%s Threads=%d, Skt.Pairs=%d, Bandwidth=%lu KB/s",
558 test_param[best_index].type_name,
559 test_param[best_index].thread_cnt,
560 test_param[best_index].sockpair_cnt,
561 (unsigned long)best_bandwidth));
562 PJ_LOG(3,(THIS_FILE, " (Note: packet size=%d, total errors=%u)",
563 BUF_SIZE, last_error_counter));
564 return 0;
565 }
566
567 static pj_ioqueue_epoll_flag epoll_flags[] = {
568 #if PJ_IOQUEUE_IMP==PJ_IOQUEUE_IMP_EPOLL
569 PJ_IOQUEUE_EPOLL_EXCLUSIVE,
570 PJ_IOQUEUE_EPOLL_ONESHOT,
571 0,
572 #else
573 PJ_IOQUEUE_EPOLL_AUTO,
574 #endif
575 };
576
577 int ioqueue_perf_test0(void)
578 {
579 pj_size_t bandwidth;
580 pj_ioqueue_cfg cfg;
581 int i, rc;
582
583 /* Defailed performance report (concurrency=1) */
584 for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
585 pj_ioqueue_cfg_default(&cfg);
586 cfg.epoll_flags = epoll_flags[i];
587
588 PJ_LOG(3,(THIS_FILE, " Detailed perf (concurrency=%d, epoll_flags=0x%x):",
589 cfg.default_concurrency, cfg.epoll_flags));
590 rc = perform_test(&cfg,
591 pj_SOCK_DGRAM(),
592 "udp",
593 8,
594 8,
595 512,
596 PJ_TRUE,
597 &bandwidth);
598 if (rc != 0)
599 return rc;
600 }
601
602 /* Defailed performance report (concurrency=0) */
603 pj_ioqueue_cfg_default(&cfg);
604 cfg.default_concurrency = PJ_FALSE;
605 PJ_LOG(3,(THIS_FILE, " Detailed perf (concurrency=%d, epoll_flags=0x%x):",
606 cfg.default_concurrency, cfg.epoll_flags));
607 rc = perform_test(&cfg,
608 pj_SOCK_DGRAM(),
609 "udp",
610 8,
611 8,
612 512,
613 PJ_TRUE,
614 &bandwidth);
615 if (rc != 0)
616 return rc;
617
618 return 0;
619 }
620
621 int ioqueue_perf_test1(void)
622 {
623 pj_ioqueue_cfg cfg;
624 int i, rc;
625
626 /* The benchmark across configs */
627 for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
628 int concur;
629 for (concur=0; concur<2; ++concur) {
630 pj_ioqueue_cfg_default(&cfg);
631 cfg.epoll_flags = epoll_flags[i];
632 cfg.default_concurrency = concur;
633 rc = ioqueue_perf_test_imp(&cfg);
634 if (rc != 0)
635 return rc;
636 }
637 }
638
639 return 0;
640 }
641
642
643 #else
644 /* To prevent warning about "translation unit is empty"
645 * when this test is disabled.
646 */
647 int dummy_uiq_perf_test;
648 #endif /* INCLUDE_IOQUEUE_PERF_TEST */
649
650