Ignore:
Timestamp:
Oct 24, 2006 5:13:30 PM (18 years ago)
Author:
bennylp
Message:

Bulk of PJLIB implementations on Symbian: exception framework, errno, OS core, Unicode, pool backend, log (to console), socket, address resolution, select, etc. IOQueue still doesn't work.

File:
1 edited

Legend:

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

    r365 r788  
    1818 */ 
    1919#include "test.h" 
    20 #include <pjlib.h> 
     20#include <pj/errno.h> 
     21#include <pj/ioqueue.h> 
     22#include <pj/log.h> 
     23#include <pj/os.h> 
     24#include <pj/pool.h> 
     25#include <pj/sock.h> 
    2126#include <pj/compat/high_precision.h> 
    2227 
     
    7378                             pj_ssize_t bytes_read) 
    7479{ 
    75     test_item *item = pj_ioqueue_get_user_data(key); 
     80    test_item *item = (test_item*)pj_ioqueue_get_user_data(key); 
    7681    pj_status_t rc; 
    7782    int data_is_available = 1; 
     
    151156                              pj_ssize_t bytes_sent) 
    152157{ 
    153     test_item *item = pj_ioqueue_get_user_data(key); 
     158    test_item *item = (test_item*)pj_ioqueue_get_user_data(key); 
    154159     
    155160    //TRACE_((THIS_FILE, "     write complete: sent = %d", bytes_sent)); 
     
    189194static int worker_thread(void *p) 
    190195{ 
    191     struct thread_arg *arg = p; 
     196    struct thread_arg *arg = (struct thread_arg *)p; 
    192197    const pj_time_val timeout = {0, 100}; 
    193198    int rc; 
     
    250255        return -10; 
    251256 
    252     items = pj_pool_alloc(pool, sockpair_cnt*sizeof(test_item)); 
    253     thread = pj_pool_alloc(pool, thread_cnt*sizeof(pj_thread_t*)); 
     257    items = (test_item *)pj_pool_alloc(pool, sockpair_cnt*sizeof(test_item)); 
     258    thread = (pj_thread_t **)pj_pool_alloc(pool, thread_cnt*sizeof(pj_thread_t*)); 
    254259 
    255260    TRACE_((THIS_FILE, "     creating ioqueue..")); 
     
    266271        items[i].ioqueue = ioqueue; 
    267272        items[i].buffer_size = buffer_size; 
    268         items[i].outgoing_buffer = pj_pool_alloc(pool, buffer_size); 
    269         items[i].incoming_buffer = pj_pool_alloc(pool, buffer_size); 
     273        items[i].outgoing_buffer = (char*)pj_pool_alloc(pool, buffer_size); 
     274        items[i].incoming_buffer = (char*)pj_pool_alloc(pool, buffer_size); 
    270275        items[i].bytes_recv = items[i].bytes_sent = 0; 
    271276 
     
    332337        struct thread_arg *arg; 
    333338 
    334         arg = pj_pool_zalloc(pool, sizeof(*arg)); 
     339        arg = (struct thread_arg *)pj_pool_zalloc(pool, sizeof(*arg)); 
    335340        arg->id = i; 
    336341        arg->ioqueue = ioqueue; 
     
    444449    enum { BUF_SIZE = 512 }; 
    445450    int i, rc; 
     451    enum 
     452    { 
     453        SOCK_DGRAM = 1, 
     454        SOCK_STREAM = 2, 
     455    }; 
    446456    struct { 
    447457        int         type; 
     
    451461    } test_param[] =  
    452462    { 
    453         { PJ_SOCK_DGRAM, "udp", 1, 1}, 
    454         { PJ_SOCK_DGRAM, "udp", 1, 2}, 
    455         { PJ_SOCK_DGRAM, "udp", 1, 4}, 
    456         { PJ_SOCK_DGRAM, "udp", 1, 8}, 
    457         { PJ_SOCK_DGRAM, "udp", 2, 1}, 
    458         { PJ_SOCK_DGRAM, "udp", 2, 2}, 
    459         { PJ_SOCK_DGRAM, "udp", 2, 4}, 
    460         { PJ_SOCK_DGRAM, "udp", 2, 8}, 
    461         { PJ_SOCK_DGRAM, "udp", 4, 1}, 
    462         { PJ_SOCK_DGRAM, "udp", 4, 2}, 
    463         { PJ_SOCK_DGRAM, "udp", 4, 4}, 
    464         { PJ_SOCK_DGRAM, "udp", 4, 8}, 
    465         { PJ_SOCK_DGRAM, "udp", 4, 16}, 
    466         { PJ_SOCK_STREAM, "tcp", 1, 1}, 
    467         { PJ_SOCK_STREAM, "tcp", 1, 2}, 
    468         { PJ_SOCK_STREAM, "tcp", 1, 4}, 
    469         { PJ_SOCK_STREAM, "tcp", 1, 8}, 
    470         { PJ_SOCK_STREAM, "tcp", 2, 1}, 
    471         { PJ_SOCK_STREAM, "tcp", 2, 2}, 
    472         { PJ_SOCK_STREAM, "tcp", 2, 4}, 
    473         { PJ_SOCK_STREAM, "tcp", 2, 8}, 
    474         { PJ_SOCK_STREAM, "tcp", 4, 1}, 
    475         { PJ_SOCK_STREAM, "tcp", 4, 2}, 
    476         { PJ_SOCK_STREAM, "tcp", 4, 4}, 
    477         { PJ_SOCK_STREAM, "tcp", 4, 8}, 
    478         { PJ_SOCK_STREAM, "tcp", 4, 16}, 
     463        { SOCK_DGRAM, "udp", 1, 1}, 
     464        { SOCK_DGRAM, "udp", 1, 2}, 
     465        { SOCK_DGRAM, "udp", 1, 4}, 
     466        { SOCK_DGRAM, "udp", 1, 8}, 
     467        { SOCK_DGRAM, "udp", 2, 1}, 
     468        { SOCK_DGRAM, "udp", 2, 2}, 
     469        { SOCK_DGRAM, "udp", 2, 4}, 
     470        { SOCK_DGRAM, "udp", 2, 8}, 
     471        { SOCK_DGRAM, "udp", 4, 1}, 
     472        { SOCK_DGRAM, "udp", 4, 2}, 
     473        { SOCK_DGRAM, "udp", 4, 4}, 
     474        { SOCK_DGRAM, "udp", 4, 8}, 
     475        { SOCK_DGRAM, "udp", 4, 16}, 
     476        { SOCK_STREAM, "tcp", 1, 1}, 
     477        { SOCK_STREAM, "tcp", 1, 2}, 
     478        { SOCK_STREAM, "tcp", 1, 4}, 
     479        { SOCK_STREAM, "tcp", 1, 8}, 
     480        { SOCK_STREAM, "tcp", 2, 1}, 
     481        { SOCK_STREAM, "tcp", 2, 2}, 
     482        { SOCK_STREAM, "tcp", 2, 4}, 
     483        { SOCK_STREAM, "tcp", 2, 8}, 
     484        { SOCK_STREAM, "tcp", 4, 1}, 
     485        { SOCK_STREAM, "tcp", 4, 2}, 
     486        { SOCK_STREAM, "tcp", 4, 4}, 
     487        { SOCK_STREAM, "tcp", 4, 8}, 
     488        { SOCK_STREAM, "tcp", 4, 16}, 
    479489/* 
    480         { PJ_SOCK_DGRAM, "udp", 32, 1}, 
    481         { PJ_SOCK_DGRAM, "udp", 32, 1}, 
    482         { PJ_SOCK_DGRAM, "udp", 32, 1}, 
    483         { PJ_SOCK_DGRAM, "udp", 32, 1}, 
    484         { PJ_SOCK_DGRAM, "udp", 1, 32}, 
    485         { PJ_SOCK_DGRAM, "udp", 1, 32}, 
    486         { PJ_SOCK_DGRAM, "udp", 1, 32}, 
    487         { PJ_SOCK_DGRAM, "udp", 1, 32}, 
    488         { PJ_SOCK_STREAM, "tcp", 32, 1}, 
    489         { PJ_SOCK_STREAM, "tcp", 32, 1}, 
    490         { PJ_SOCK_STREAM, "tcp", 32, 1}, 
    491         { PJ_SOCK_STREAM, "tcp", 32, 1}, 
    492         { PJ_SOCK_STREAM, "tcp", 1, 32}, 
    493         { PJ_SOCK_STREAM, "tcp", 1, 32}, 
    494         { PJ_SOCK_STREAM, "tcp", 1, 32}, 
    495         { PJ_SOCK_STREAM, "tcp", 1, 32}, 
     490        { SOCK_DGRAM, "udp", 32, 1}, 
     491        { SOCK_DGRAM, "udp", 32, 1}, 
     492        { SOCK_DGRAM, "udp", 32, 1}, 
     493        { SOCK_DGRAM, "udp", 32, 1}, 
     494        { SOCK_DGRAM, "udp", 1, 32}, 
     495        { SOCK_DGRAM, "udp", 1, 32}, 
     496        { SOCK_DGRAM, "udp", 1, 32}, 
     497        { SOCK_DGRAM, "udp", 1, 32}, 
     498        { SOCK_STREAM, "tcp", 32, 1}, 
     499        { SOCK_STREAM, "tcp", 32, 1}, 
     500        { SOCK_STREAM, "tcp", 32, 1}, 
     501        { SOCK_STREAM, "tcp", 32, 1}, 
     502        { SOCK_STREAM, "tcp", 1, 32}, 
     503        { SOCK_STREAM, "tcp", 1, 32}, 
     504        { SOCK_STREAM, "tcp", 1, 32}, 
     505        { SOCK_STREAM, "tcp", 1, 32}, 
    496506*/ 
    497507    }; 
     
    503513    PJ_LOG(3,(THIS_FILE, "   Type  Threads  Skt.Pairs      Bandwidth")); 
    504514    PJ_LOG(3,(THIS_FILE, "   =======================================")); 
     515 
     516    for (i=0; i<PJ_ARRAY_SIZE(test_param); ++i) { 
     517        if (test_param[i].type == SOCK_DGRAM) 
     518            test_param[i].type = PJ_SOCK_DGRAM; 
     519        else if (test_param[i].type == SOCK_STREAM) 
     520            test_param[i].type = PJ_SOCK_STREAM; 
     521    } 
    505522 
    506523    best_bandwidth = 0; 
Note: See TracChangeset for help on using the changeset viewer.