Ignore:
Timestamp:
Feb 13, 2008 3:17:28 PM (17 years ago)
Author:
bennylp
Message:

Ticket #474: option in ioqueue to control concurrency (to allow/disallow simultaneous/multiple callback calls)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pjlib-test/ioq_perf.c

    r1405 r1789  
    222222 *    period of time. 
    223223 */ 
    224 static int perform_test(int sock_type, const char *type_name, 
     224static int perform_test(pj_bool_t allow_concur, 
     225                        int sock_type, const char *type_name, 
    225226                        unsigned thread_cnt, unsigned sockpair_cnt, 
    226227                        pj_size_t buffer_size,  
     
    261262    } 
    262263 
     264    rc = pj_ioqueue_set_default_concurrency(ioqueue, allow_concur); 
     265    if (rc != PJ_SUCCESS) { 
     266        app_perror("...error: pj_ioqueue_set_default_concurrency()", rc); 
     267        return -16; 
     268    } 
     269 
    263270    /* Initialize each producer-consumer pair. */ 
    264271    for (i=0; i<sockpair_cnt; ++i) { 
     
    438445} 
    439446 
    440 /* 
    441  * main test entry. 
    442  */ 
    443 int ioqueue_perf_test(void) 
     447static int ioqueue_perf_test_imp(pj_bool_t allow_concur) 
    444448{ 
    445449    enum { BUF_SIZE = 512 }; 
     
    501505 
    502506    PJ_LOG(3,(THIS_FILE, "   Benchmarking %s ioqueue:", pj_ioqueue_name())); 
     507    PJ_LOG(3,(THIS_FILE, "   Testing with concurency=%d", allow_concur)); 
    503508    PJ_LOG(3,(THIS_FILE, "   =======================================")); 
    504509    PJ_LOG(3,(THIS_FILE, "   Type  Threads  Skt.Pairs      Bandwidth")); 
     
    509514        pj_size_t bandwidth; 
    510515 
    511         rc = perform_test(test_param[i].type,  
     516        rc = perform_test(allow_concur, 
     517                          test_param[i].type,  
    512518                          test_param[i].type_name, 
    513519                          test_param[i].thread_cnt,  
     
    538544} 
    539545 
     546/* 
     547 * main test entry. 
     548 */ 
     549int ioqueue_perf_test(void) 
     550{ 
     551    int rc; 
     552 
     553    rc = ioqueue_perf_test_imp(PJ_TRUE); 
     554    if (rc != 0) 
     555        return rc; 
     556 
     557    rc = ioqueue_perf_test_imp(PJ_FALSE); 
     558    if (rc != 0) 
     559        return rc; 
     560 
     561    return 0; 
     562} 
     563 
    540564#else 
    541565/* To prevent warning about "translation unit is empty" 
Note: See TracChangeset for help on using the changeset viewer.