Changeset 581 for pjproject/trunk
- Timestamp:
- Jul 3, 2006 2:18:17 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/string.h
r514 r581 544 544 PJ_DECL(int) pj_utoa_pad( unsigned long val, char *buf, int min_dig, int pad); 545 545 546 547 /** 548 * Fill the memory location with zero. 549 * 550 * @param dst The destination buffer. 551 * @param size The number of bytes. 552 */ 553 PJ_INLINE(void) pj_bzero(void *dst, pj_size_t size) 554 { 555 bzero(dst, size); 556 } 557 558 546 559 /** 547 560 * Fill the memory location with value. -
pjproject/trunk/pjlib/src/pj/pool_caching.c
r364 r581 199 199 pj_pool_reset(pool); 200 200 201 pool_capacity = pj_pool_get_capacity(pool); 202 201 203 /* 202 204 * Otherwise put the pool in our recycle list. -
pjproject/trunk/pjsip-apps/build/Makefile
r508 r581 44 44 45 45 46 47 ###############################################################################48 # Defines for building PJSIP-PERF49 #50 export PJSIPPERF_SRCDIR = ../src/pjsip-perf51 export PJSIPPERF_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \52 handler_call.o handler_options.o main.o53 export PJSIPPERF_CFLAGS += $(_CFLAGS)54 export PJSIPPERF_LDFLAGS += $(_LDFLAGS)55 export PJSIPPERF_EXE:=../bin/pjsip-perf-$(TARGET_NAME)$(HOST_EXE)56 57 58 59 46 export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 60 47 ############################################################################### … … 62 49 # 63 50 # 64 TARGETS := pjsua pjsip-perfsamples51 TARGETS := pjsua samples 65 52 66 53 .PHONY: $(TARGETS) … … 79 66 $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE) 80 67 81 pjsip-perf:82 $(MAKE) -f $(RULES_MAK) APP=PJSIPPERF app=pjsip-perf $(PJSUA_EXE)83 84 68 samples: 85 69 $(MAKE) -f Samples.mak … … 91 75 clean depend realclean: 92 76 $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@ 93 $(MAKE) -f $(RULES_MAK) APP=PJSIPPERF app=pjsip-perf $@94 77 $(MAKE) -f Samples.mak $@ 95 78 @if test "$@" = "depend"; then \ 96 79 echo '$(PJSUA_EXE): $(PJSIP_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE) $(PJSUA_LIB_LIB) $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB) Makefile' >> .pjsua-$(TARGET_NAME).depend; \ 97 echo '$(PJSIPPERF_EXE): $(PJSIP_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE) $(PJSUA_LIB_LIB) $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB)' >> .pjsip-perf-$(TARGET_NAME).depend; \98 80 fi 99 81 -
pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw
r504 r581 64 64 ############################################################################### 65 65 66 Project: "pjsip_perf"=".\pjsip_perf.dsp" - Package Owner=<4> 66 Project: "pjsip_simple"="..\..\pjsip\build\pjsip_simple.dsp" - Package Owner=<4> 67 68 Package=<5> 69 {{{ 70 }}} 71 72 Package=<4> 73 {{{ 74 }}} 75 76 ############################################################################### 77 78 Project: "pjsip_ua"="..\..\pjsip\build\pjsip_ua.dsp" - Package Owner=<4> 79 80 Package=<5> 81 {{{ 82 }}} 83 84 Package=<4> 85 {{{ 86 }}} 87 88 ############################################################################### 89 90 Project: "pjsua"=".\pjsua.dsp" - Package Owner=<4> 67 91 68 92 Package=<5> … … 79 103 End Project Dependency 80 104 Begin Project Dependency 105 Project_Dep_Name pjmedia 106 End Project Dependency 107 Begin Project Dependency 108 Project_Dep_Name pjmedia_codec 109 End Project Dependency 110 Begin Project Dependency 81 111 Project_Dep_Name pjsip_core 82 112 End Project Dependency … … 90 120 Project_Dep_Name pjsua_lib 91 121 End Project Dependency 122 }}} 123 124 ############################################################################### 125 126 Project: "pjsua_lib"="..\..\pjsip\build\pjsua_lib.dsp" - Package Owner=<4> 127 128 Package=<5> 129 {{{ 130 }}} 131 132 Package=<4> 133 {{{ 134 }}} 135 136 ############################################################################### 137 138 Project: "sample_debug"=".\sample_debug.dsp" - Package Owner=<4> 139 140 Package=<5> 141 {{{ 142 }}} 143 144 Package=<4> 145 {{{ 146 Begin Project Dependency 147 Project_Dep_Name pjlib 148 End Project Dependency 149 Begin Project Dependency 150 Project_Dep_Name pjlib_util 151 End Project Dependency 92 152 Begin Project Dependency 93 153 Project_Dep_Name pjmedia 94 154 End Project Dependency 95 }}} 96 97 ############################################################################### 98 99 Project: "pjsip_simple"="..\..\pjsip\build\pjsip_simple.dsp" - Package Owner=<4> 100 101 Package=<5> 102 {{{ 103 }}} 104 105 Package=<4> 106 {{{ 107 }}} 108 109 ############################################################################### 110 111 Project: "pjsip_ua"="..\..\pjsip\build\pjsip_ua.dsp" - Package Owner=<4> 112 113 Package=<5> 114 {{{ 115 }}} 116 117 Package=<4> 118 {{{ 119 }}} 120 121 ############################################################################### 122 123 Project: "pjsua"=".\pjsua.dsp" - Package Owner=<4> 155 Begin Project Dependency 156 Project_Dep_Name pjmedia_codec 157 End Project Dependency 158 Begin Project Dependency 159 Project_Dep_Name pjsip_core 160 End Project Dependency 161 Begin Project Dependency 162 Project_Dep_Name pjsip_simple 163 End Project Dependency 164 Begin Project Dependency 165 Project_Dep_Name pjsip_ua 166 End Project Dependency 167 Begin Project Dependency 168 Project_Dep_Name pjsua_lib 169 End Project Dependency 170 }}} 171 172 ############################################################################### 173 174 Project: "samples"=".\samples.dsp" - Package Owner=<4> 124 175 125 176 Package=<5> … … 157 208 ############################################################################### 158 209 159 Project: "pjsua_lib"="..\..\pjsip\build\pjsua_lib.dsp" - Package Owner=<4>160 161 Package=<5>162 {{{163 }}}164 165 Package=<4>166 {{{167 }}}168 169 ###############################################################################170 171 Project: "sample_debug"=".\sample_debug.dsp" - Package Owner=<4>172 173 Package=<5>174 {{{175 }}}176 177 Package=<4>178 {{{179 Begin Project Dependency180 Project_Dep_Name pjlib181 End Project Dependency182 Begin Project Dependency183 Project_Dep_Name pjlib_util184 End Project Dependency185 Begin Project Dependency186 Project_Dep_Name pjmedia187 End Project Dependency188 Begin Project Dependency189 Project_Dep_Name pjmedia_codec190 End Project Dependency191 Begin Project Dependency192 Project_Dep_Name pjsip_core193 End Project Dependency194 Begin Project Dependency195 Project_Dep_Name pjsip_simple196 End Project Dependency197 Begin Project Dependency198 Project_Dep_Name pjsip_ua199 End Project Dependency200 Begin Project Dependency201 Project_Dep_Name pjsua_lib202 End Project Dependency203 }}}204 205 ###############################################################################206 207 Project: "samples"=".\samples.dsp" - Package Owner=<4>208 209 Package=<5>210 {{{211 }}}212 213 Package=<4>214 {{{215 Begin Project Dependency216 Project_Dep_Name pjlib217 End Project Dependency218 Begin Project Dependency219 Project_Dep_Name pjlib_util220 End Project Dependency221 Begin Project Dependency222 Project_Dep_Name pjmedia223 End Project Dependency224 Begin Project Dependency225 Project_Dep_Name pjmedia_codec226 End Project Dependency227 Begin Project Dependency228 Project_Dep_Name pjsip_core229 End Project Dependency230 Begin Project Dependency231 Project_Dep_Name pjsip_simple232 End Project Dependency233 Begin Project Dependency234 Project_Dep_Name pjsip_ua235 End Project Dependency236 Begin Project Dependency237 Project_Dep_Name pjsua_lib238 End Project Dependency239 }}}240 241 ###############################################################################242 243 210 Global: 244 211 -
pjproject/trunk/pjsip-apps/build/sample_debug.dsp
r371 r581 43 43 # PROP Target_Dir "" 44 44 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 45 # ADD CPP /nologo /MD /W3 /GX /O2 /I "../../pjsip/include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 45 # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "../../pjsip/include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c 46 # SUBTRACT CPP /YX 46 47 # ADD BASE RSC /l 0x409 /d "NDEBUG" 47 48 # ADD RSC /l 0x409 /d "NDEBUG" -
pjproject/trunk/pjsip-apps/src/samples/pjsip-perf.c
r580 r581 67 67 #include <stdio.h> 68 68 69 #define THIS_FILE "pjsip-perf.c" 70 #define DEFAULT_COUNT (PJSIP_MAX_TSX_COUNT/2>10000?10000:PJSIP_MAX_TSX_COUNT/2) 71 #define JOB_WINDOW DEFAULT_COUNT 69 #if defined(PJ_WIN32) && PJ_WIN32!=0 70 # include <windows.h> 71 #endif 72 73 #define THIS_FILE "pjsip-perf.c" 74 #define DEFAULT_COUNT (PJSIP_MAX_TSX_COUNT/2>10000?10000:PJSIP_MAX_TSX_COUNT/2) 75 #define JOB_WINDOW DEFAULT_COUNT 76 #define TERMINATE_TSX(x,c) 77 78 79 #ifndef CACHING_POOL_SIZE 80 # define CACHING_POOL_SIZE (256*1024*1024) 81 #endif 72 82 73 83 … … 139 149 job_finished, 140 150 job_window; 151 unsigned stat_max_window; 141 152 pj_time_val first_request; 142 153 pj_time_val last_completion; … … 588 599 589 600 /* Must create a pool factory before we can allocate any memory. */ 590 pj_caching_pool_init(&app.cp, &pj_pool_factory_default_policy, 0); 601 pj_caching_pool_init(&app.cp, &pj_pool_factory_default_policy, 602 CACHING_POOL_SIZE); 591 603 592 604 /* Create application pool for misc. */ … … 633 645 634 646 transport_type = "tcp"; 635 pj_sockaddr_in_init(&local_addr, 0, app.local_port);647 pj_sockaddr_in_init(&local_addr, 0, (pj_uint16_t)app.local_port); 636 648 status = pjsip_tcp_transport_start(app.sip_endpt, &local_addr, 637 649 app.thread_count, &tpfactory); … … 976 988 " --stateless, -s Set client to operate in stateless mode\n" 977 989 " (default: stateful)\n" 990 " --window=COUNT, -w Set maximum outstanding job in client (default: %d)\n" 978 991 " --real-sdp Generate real SDP from pjmedia, and also perform\n" 979 992 " proper SDP negotiation (default: dummy)\n" … … 986 999 " - sip:1@server-addr To handle requests statefully (INVITE and non-INVITE)\n" 987 1000 " - sip:2@server-addr To handle INVITE call (INVITE only)\n", 988 DEFAULT_COUNT );1001 DEFAULT_COUNT, JOB_WINDOW); 989 1002 } 990 1003 … … 1011 1024 { "verbose", 0, 0, 'v' }, 1012 1025 { "use-tcp", 0, 0, 'T' }, 1026 { "window", 1, 0, 'w' }, 1013 1027 { NULL, 0, 0, 0 }, 1014 1028 }; … … 1027 1041 /* Parse options */ 1028 1042 pj_optind = 0; 1029 while((c=pj_getopt_long(argc,argv, "p:c:m:t: hsv",1043 while((c=pj_getopt_long(argc,argv, "p:c:m:t:w:hsv", 1030 1044 long_options, &option_index))!=-1) 1031 1045 { … … 1091 1105 break; 1092 1106 1107 case 'w': 1108 app.client.job_window = my_atoi(pj_optarg); 1109 if (app.client.job_window <= 0) { 1110 PJ_LOG(3,(THIS_FILE, "Invalid --window %s", pj_optarg)); 1111 return -1; 1112 } 1113 break; 1114 1093 1115 case 'T': 1094 1116 app.use_tcp = PJ_TRUE; … … 1184 1206 tsx->mod_data[mod_test.id] = (void*)1; 1185 1207 1186 pjsip_tsx_terminate(tsx, tsx->status_code);1208 TERMINATE_TSX(tsx, tsx->status_code); 1187 1209 } 1188 1210 } … … 1220 1242 static int client_thread(void *arg) 1221 1243 { 1244 unsigned last_timeout_check = 0; 1222 1245 pj_time_val end_time, now; 1223 1246 … … 1240 1263 pj_status_t status; 1241 1264 1265 /* Calculate current outstanding job */ 1266 outstanding = app.client.job_submitted - app.client.job_finished; 1267 1268 /* Update stats on max outstanding jobs */ 1269 if (outstanding > (int)app.client.stat_max_window) 1270 app.client.stat_max_window = outstanding; 1271 1242 1272 /* Wait if there are more pending jobs than allowed in the 1243 1273 * window. 1244 1274 */ 1245 outstanding = app.client.job_submitted - app.client.job_finished; 1246 while (outstanding >= (int)app.client.job_window) { 1275 for (i=0; outstanding > (int)app.client.job_window && i<100; ++i) { 1247 1276 pjsip_endpt_handle_events(app.sip_endpt, &timeout); 1248 1277 outstanding = app.client.job_submitted - app.client.job_finished; 1249 1278 } 1250 1279 1280 1281 /* Submit one job */ 1251 1282 if (app.client.method.id == PJSIP_INVITE_METHOD) { 1252 1283 status = make_call(&app.client.dst_uri); … … 1259 1290 ++app.client.job_submitted; 1260 1291 1261 for (i=0; i<2; ++i) { 1262 unsigned cnt=0; 1263 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &cnt); 1264 if (cnt==0) 1292 /* Handle event */ 1293 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, NULL); 1294 1295 /* Check for time out */ 1296 if (app.client.job_submitted - last_timeout_check >= 2000) { 1297 pj_gettimeofday(&now); 1298 if (PJ_TIME_VAL_GTE(now, end_time)) 1265 1299 break; 1300 last_timeout_check = app.client.job_submitted; 1266 1301 } 1267 1302 } … … 1272 1307 unsigned i; 1273 1308 1274 for (i=0; i<2; ++i) { 1275 unsigned cnt=0; 1276 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &cnt); 1277 if (cnt==0) 1278 break; 1309 for (i=0; i<2000; ++i) { 1310 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, NULL); 1279 1311 } 1280 1312 … … 1353 1385 good_number(str_call, app.server.cur_state.call_cnt); 1354 1386 1355 printf("Total(rate): stateless:%s (%d/s), statefull:%s (%d/s), call:%s (%d/s) \r",1387 printf("Total(rate): stateless:%s (%d/s), statefull:%s (%d/s), call:%s (%d/s) \r", 1356 1388 str_stateless, stateless*1000/msec, 1357 1389 str_stateful, stateful*1000/msec, … … 1367 1399 } 1368 1400 1401 static void write_report(const char *msg) 1402 { 1403 puts(msg); 1404 1405 #if defined(PJ_WIN32) && PJ_WIN32!=0 1406 OutputDebugString(msg); 1407 OutputDebugString("\n"); 1408 #endif 1409 } 1410 1411 1369 1412 int main(int argc, char *argv[]) 1370 1413 { 1414 static char report[1024]; 1371 1415 1372 1416 if (create_app() != 0) … … 1459 1503 if (msec == 0) msec = 1; 1460 1504 1461 printf("Total %d %s sent, %d responses received in %d msec:\n" 1462 " - 2xx responses: %7d (rate=%d/sec)\n" 1463 " - 3xx responses: %7d (rate=%d/sec)\n" 1464 " - 4xx responses: %7d (rate=%d/sec)\n" 1465 " - 5xx responses: %7d (rate=%d/sec)\n" 1466 " - 6xx responses: %7d (rate=%d/sec)\n" 1467 " - 7xx responses: %7d (rate=%d/sec)\n" 1468 " ----------------\n" 1469 " TOTAL responses: %7d (rate=%d/sec)\n", 1470 app.client.job_submitted, test_type, 1471 app.client.total_responses, msec, 1472 app.client.status_class[2], app.client.status_class[2]*1000/msec, 1473 app.client.status_class[3], app.client.status_class[3]*1000/msec, 1474 app.client.status_class[4], app.client.status_class[4]*1000/msec, 1475 app.client.status_class[5], app.client.status_class[5]*1000/msec, 1476 app.client.status_class[6], app.client.status_class[6]*1000/msec, 1477 app.client.status_class[7], app.client.status_class[7]*1000/msec, 1478 app.client.total_responses, app.client.total_responses*1000/msec); 1505 pj_ansi_snprintf( 1506 report, sizeof(report), 1507 "Total %d %s sent, %d responses received in %d ms:\n" 1508 " - 2xx responses: %7d (rate=%d/sec)\n" 1509 " - 3xx responses: %7d (rate=%d/sec)\n" 1510 " - 4xx responses: %7d (rate=%d/sec)\n" 1511 " - 5xx responses: %7d (rate=%d/sec)\n" 1512 " - 6xx responses: %7d (rate=%d/sec)\n" 1513 " - 7xx responses: %7d (rate=%d/sec)\n" 1514 " ----------------\n" 1515 " TOTAL responses: %7d (rate=%d/sec)\n", 1516 app.client.job_submitted, test_type, 1517 app.client.total_responses, msec, 1518 app.client.status_class[2], app.client.status_class[2]*1000/msec, 1519 app.client.status_class[3], app.client.status_class[3]*1000/msec, 1520 app.client.status_class[4], app.client.status_class[4]*1000/msec, 1521 app.client.status_class[5], app.client.status_class[5]*1000/msec, 1522 app.client.status_class[6], app.client.status_class[6]*1000/msec, 1523 app.client.status_class[7], app.client.status_class[7]*1000/msec, 1524 app.client.total_responses, app.client.total_responses*1000/msec); 1525 1526 write_report(report); 1527 1528 pj_ansi_sprintf(report, "Maximum outstanding job: %d", 1529 app.client.stat_max_window); 1530 write_report(report); 1531 1479 1532 1480 1533 } else { -
pjproject/trunk/pjsip/include/pjsip/sip_config.h
r520 r581 118 118 #ifndef PJSIP_MAX_PKT_LEN 119 119 # define PJSIP_MAX_PKT_LEN 2000 120 #endif 121 122 123 /** 124 * Allow SIP modules removal or insertions during operation? 125 * If yes, then locking will be employed when endpoint need to 126 * access module. 127 */ 128 #ifndef PJSIP_SAFE_MODULE 129 # define PJSIP_SAFE_MODULE 1 120 130 #endif 121 131 -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r561 r581 89 89 90 90 91 #if defined(PJSIP_SAFE_MODULE) && PJSIP_SAFE_MODULE!=0 92 # define LOCK_MODULE_ACCESS(ept) pj_rwmutex_lock_read(ept->mod_mutex) 93 # define UNLOCK_MODULE_ACCESS(ept) pj_rwmutex_unlock_read(ept->mod_mutex) 94 #else 95 # define LOCK_MODULE_ACCESS(endpt) 96 # define UNLOCK_MODULE_ACCESS(endpt) 97 #endif 98 99 91 100 92 101 /* … … 582 591 PJ_LOG(6, (THIS_FILE, "Releasing pool %s", pj_pool_getobjname(pool))); 583 592 584 pj_mutex_lock(endpt->mutex); 593 /* Don't need to acquire mutex since pool factory is thread safe 594 pj_mutex_lock(endpt->mutex); 595 */ 585 596 pj_pool_release( pool ); 597 598 /* 586 599 pj_mutex_unlock(endpt->mutex); 600 */ 587 601 } 588 602 … … 777 791 778 792 /* Distribute to modules, starting from modules with highest priority */ 779 pj_rwmutex_lock_read(endpt->mod_mutex);793 LOCK_MODULE_ACCESS(endpt); 780 794 781 795 if (msg->type == PJSIP_REQUEST_MSG) { … … 824 838 } 825 839 826 pj_rwmutex_unlock_read(endpt->mod_mutex);840 UNLOCK_MODULE_ACCESS(endpt); 827 841 828 842 /* Must clear mod_data before returning rdata to transport, since … … 843 857 844 858 /* Distribute to modules, starting from modules with LOWEST priority */ 845 pj_rwmutex_lock_read(endpt->mod_mutex);859 LOCK_MODULE_ACCESS(endpt); 846 860 847 861 mod = endpt->module_list.prev; … … 865 879 } 866 880 867 pj_rwmutex_unlock_read(endpt->mod_mutex);881 UNLOCK_MODULE_ACCESS(endpt); 868 882 869 883 return status;
Note: See TracChangeset
for help on using the changeset viewer.