Changeset 19


Ignore:
Timestamp:
Nov 7, 2005 6:14:08 PM (18 years ago)
Author:
bennylp
Message:

UDP echo testing in Linux

Location:
pjproject/main/pjlib
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • pjproject/main/pjlib/build/Makefile

    r14 r19  
    8585# 
    8686export TEST_SRCDIR = ../src/pjlib-test 
    87 export TEST_OBJS += atomic.o echo_clt.o echo_srv.o errno.o exception.o \ 
    88                     fifobuf.o \ 
     87export TEST_OBJS += atomic.o echo_clt.o errno.o exception.o \ 
     88                    fifobuf.o file.o \ 
    8989                    ioq_perf.o ioq_udp.o ioq_tcp.o \ 
    9090                    list.o mutex.o os.o pool.o pool_perf.o rand.o rbtree.o \ 
    9191                    select.o sleep.o sock.o sock_perf.o \ 
    9292                    string.o test.o thread.o timer.o timestamp.o \ 
    93                     udp_echo_srv_sync.o \ 
     93                    udp_echo_srv_sync.o udp_echo_srv_ioqueue.o \ 
    9494                    util.o xml.o 
    9595export TEST_CFLAGS += $(_CFLAGS) 
     
    114114        $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test print_bin 
    115115         
    116 depend: 
     116depend: ../include/pj/config_site.h 
    117117        $(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib depend 
    118118        $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test depend 
  • pjproject/main/pjlib/build/os-linux.mak

    r14 r19  
    1818export PJLIB_OBJS += ioqueue_epoll.o 
    1919 
     20export PJLIB_OBJS += file_access_unistd.o file_io_ansi.o 
     21 
    2022# 
    2123# TEST_OBJS are operating system specific object files to be included in 
  • pjproject/main/pjlib/include/pj/ioqueue.h

    r18 r19  
    109109 *  - \ref page_pjlib_ioqueue_perf_test 
    110110 */ 
    111  
    112111 
    113112 
     
    219218#   define PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL     (16) 
    220219#endif 
     220 
     221/** 
     222 * Return the name of the ioqueue implementation. 
     223 * 
     224 * @return              Implementation name. 
     225 */ 
     226PJ_DECL(const char*) pj_ioqueue_name(void); 
    221227 
    222228 
  • pjproject/main/pjlib/src/pj/config.c

    r11 r19  
    33#include <pj/config.h> 
    44#include <pj/log.h> 
     5#include <pj/ioqueue.h> 
    56 
    67static const char *id = "config.c"; 
     
    2425    PJ_LOG(3, (id, " PJ_HAS_EVENT_OBJ         : %d", PJ_HAS_EVENT_OBJ)); 
    2526    PJ_LOG(3, (id, " PJ_HAS_HIGH_RES_TIMER    : %d", PJ_HAS_HIGH_RES_TIMER)); 
    26     PJ_LOG(3, (id, " PJ_(endianness)          : %s", (PJ_IS_BIG_ENDIAN?"big-endian":"little-endian"))); 
     27    PJ_LOG(3, (id, " PJ_(endianness)          : %s",  
     28               (PJ_IS_BIG_ENDIAN?"big-endian":"little-endian"))); 
     29    PJ_LOG(3, (id, " ioqueue type             : %s", pj_ioqueue_name())); 
    2730    PJ_LOG(3, (id, " PJ_IOQUEUE_MAX_HANDLES   : %d", PJ_IOQUEUE_MAX_HANDLES)); 
    2831} 
  • pjproject/main/pjlib/src/pj/ioqueue_epoll.c

    r14 r19  
    160160 
    161161/* 
     162 * pj_ioqueue_name() 
     163 */ 
     164PJ_DEF(const char*) pj_ioqueue_name(void) 
     165{ 
     166#if defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0 
     167        return "epoll-kernel"; 
     168#else 
     169        return "epoll"; 
     170#endif 
     171} 
     172 
     173/* 
    162174 * pj_ioqueue_create() 
    163175 * 
  • pjproject/main/pjlib/src/pj/ioqueue_select.c

    r16 r19  
    105105 */ 
    106106#include "ioqueue_common_abs.c" 
     107 
     108/* 
     109 * pj_ioqueue_name() 
     110 */ 
     111PJ_DEF(const char*) pj_ioqueue_name(void) 
     112{ 
     113    return "select"; 
     114} 
    107115 
    108116/* 
  • pjproject/main/pjlib/src/pj/ioqueue_winnt.c

    r18 r19  
    223223} 
    224224#endif 
     225 
     226/* 
     227 * pj_ioqueue_name() 
     228 */ 
     229PJ_DEF(const char*) pj_ioqueue_name(void) 
     230{ 
     231    return "iocp"; 
     232} 
    225233 
    226234/* 
  • pjproject/main/pjlib/src/pjlib-test/echo_clt.c

    r6 r19  
    4242    pj_str_t s; 
    4343    pj_status_t rc; 
     44    pj_uint32_t buffer_id; 
     45    pj_uint32_t buffer_counter; 
     46    pj_uint32_t timeout_counter=0, invalid_counter=0; 
    4447    struct client *client = arg; 
    4548    pj_status_t last_recv_err = PJ_SUCCESS, last_send_err = PJ_SUCCESS; 
     
    7881    //PJ_LOG(3,("", "...thread %p running", pj_thread_this())); 
    7982 
     83    buffer_id = (pj_uint32_t) pj_thread_this(); 
     84    buffer_counter = 0; 
     85 
     86    *(pj_uint32_t*)send_buf = buffer_id; 
     87 
    8088    for (;;) { 
    8189        int rc; 
    8290        pj_ssize_t bytes; 
     91        pj_uint32_t *p_buffer_id, *p_buffer_counter; 
    8392 
    8493        ++counter; 
     94 
     95        while (wait_socket(sock,0) > 0) 
     96            ; 
    8597 
    8698        /* Send a packet. */ 
    8799        bytes = BUF_SIZE; 
     100        *(pj_uint32_t*)(send_buf+4) = ++buffer_counter; 
    88101        rc = pj_sock_send(sock, send_buf, &bytes, 0); 
    89102        if (rc != PJ_SUCCESS || bytes != BUF_SIZE) { 
     
    101114            PJ_LOG(3,("", "...timeout")); 
    102115            bytes = 0; 
     116            timeout_counter++; 
    103117        } else if (rc < 0) { 
    104118            rc = pj_get_netos_error(); 
  • pjproject/main/pjlib/src/pjlib-test/test.h

    r18 r19  
    1010#define GROUP_DATA_STRUCTURE        0 
    1111#define GROUP_NETWORK               0 
    12 #define GROUP_FILE                  1 
     12#define GROUP_FILE                  0 
    1313#define GROUP_EXTRA                 0 
    1414 
     
    3737#define INCLUDE_XML_TEST            GROUP_EXTRA 
    3838 
    39 #define INCLUDE_ECHO_SERVER         0 
     39#define INCLUDE_ECHO_SERVER         1 
    4040#define INCLUDE_ECHO_CLIENT         0 
    4141 
    4242 
    43 #define ECHO_SERVER_MAX_THREADS     4 
     43#define ECHO_SERVER_MAX_THREADS     2 
    4444#define ECHO_SERVER_START_PORT      65000 
    4545#define ECHO_SERVER_ADDRESS         "compaq.home" 
  • pjproject/main/pjlib/src/pjlib-test/udp_echo_srv_sync.c

    r11 r19  
    6161    } 
    6262 
    63     rc = app_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, ECHO_SERVER_START_PORT, &sock); 
     63    rc = app_socket(PJ_AF_INET, PJ_SOCK_DGRAM,0, ECHO_SERVER_START_PORT, &sock); 
    6464    if (rc != PJ_SUCCESS) { 
    6565        app_perror("...socket error", rc); 
     
    122122        count++; 
    123123 
    124         PJ_LOG(3,("", "Synchronous UDP (%d threads): %u KB/s  (avg=%u KB/s) %s",  
     124        PJ_LOG(3,("", "Synchronous UDP (%d threads): %u KB/s (avg=%u KB/s) %s",  
    125125                  ECHO_SERVER_MAX_THREADS,  
    126126                  (unsigned)(bw / 1000), 
Note: See TracChangeset for help on using the changeset viewer.