Changeset 602 for pjproject/trunk
- Timestamp:
- Jul 11, 2006 9:53:27 AM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/pjsip-perf.c
r601 r602 986 986 "\n" 987 987 "Client options:\n" 988 " --method=METHOD, -m Set the test method [default: OPTIONS]\n" 988 " --method=METHOD, -m Set test method (set to INVITE for call benchmark)\n" 989 " [default: OPTIONS]\n" 989 990 " --count=N, -n Set total number of requests to initiate\n" 990 991 " [default=%d]\n" … … 1000 1001 "Client and Server options:\n" 1001 1002 " --local-port=PORT, -p Set local port [default: 5060]\n" 1002 " --use-tcp, -T Use TCP instead of UDP [default: no]\n" 1003 " --use-tcp, -T Use TCP instead of UDP. Note that when started as\n" 1004 " client, you must add ;transport=tcp parameter to URL\n" 1005 " [default: no]\n" 1003 1006 " --thread-count=N Set number of worker threads [default=1]\n" 1004 1007 "\n" 1005 1008 "Misc options:\n" 1006 1009 " --help, -h Display this screen\n" 1007 " --verbose, -v Display verbose logging (can be put more than once)\n"1010 " --verbose, -v Verbose logging (put more than once for even more)\n" 1008 1011 "\n" 1009 1012 "When started as server, pjsip-perf can be contacted on the following URIs:\n" … … 1256 1259 { 1257 1260 unsigned last_timeout_check = 0; 1258 pj_time_val end_time, now; 1259 1260 PJ_UNUSED_ARG(arg); 1261 pj_time_val end_time, last_report, now; 1262 unsigned thread_index = (unsigned)arg; 1261 1263 1262 1264 pj_thread_sleep(100); … … 1265 1267 end_time.sec += app.client.timeout; 1266 1268 1269 pj_gettimeofday(&last_report); 1270 1267 1271 if (app.client.first_request.sec == 0) { 1268 1272 pj_gettimeofday(&app.client.first_request); … … 1270 1274 1271 1275 /* Submit all jobs */ 1272 while (app.client.job_submitted < app.client.job_count && !app.thread_quit) 1276 while (app.client.job_submitted < app.client.job_count && !app.thread_quit){ 1273 1277 pj_time_val timeout = { 0, 1 }; 1274 1278 unsigned i; … … 1306 1310 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, NULL); 1307 1311 1308 /* Check for time out */1309 if (app.client.job_submitted - last_timeout_check >= 2000) {1312 /* Check for time out, also print report */ 1313 if (app.client.job_submitted - last_timeout_check >= 500) { 1310 1314 pj_gettimeofday(&now); 1311 if (PJ_TIME_VAL_GTE(now, end_time)) 1315 if (PJ_TIME_VAL_GTE(now, end_time)) { 1312 1316 break; 1317 } 1313 1318 last_timeout_check = app.client.job_submitted; 1319 1320 1321 if (thread_index == 0 && now.sec-last_report.sec >= 2) { 1322 printf("\r%d jobs started, %d completed... ", 1323 app.client.job_submitted, app.client.job_finished); 1324 fflush(stdout); 1325 last_report = now; 1326 } 1314 1327 } 1315 1328 } … … 1320 1333 1321 1334 1335 if (thread_index == 0) { 1336 printf("\r%d jobs started, %d completed%s\n", 1337 app.client.job_submitted, app.client.job_finished, 1338 (app.client.job_submitted!=app.client.job_finished ? 1339 ", waiting..." : ".") ); 1340 fflush(stdout); 1341 } 1342 1322 1343 /* Wait until all jobs completes, or timed out */ 1323 1344 pj_gettimeofday(&now); 1324 while ( now.sec < end_time.sec&&1345 while (PJ_TIME_VAL_LT(now, end_time) && 1325 1346 app.client.job_finished < app.client.job_count && 1326 1347 !app.thread_quit) … … 1330 1351 1331 1352 for (i=0; i<1000; ++i) { 1332 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, NULL); 1353 unsigned count; 1354 count = 0; 1355 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &count); 1356 if (count == 0) 1357 break; 1358 } 1359 1360 pj_gettimeofday(&now); 1361 } 1362 1363 /* Wait couple of seconds if there are still unfinished jobs */ 1364 pj_gettimeofday(&now); 1365 end_time = now; 1366 end_time.sec += 2; 1367 while (PJ_TIME_VAL_LT(now, end_time) && 1368 app.client.job_finished < app.client.job_submitted) 1369 { 1370 pj_time_val timeout = { 0, 1 }; 1371 unsigned i; 1372 1373 for (i=0; i<1000; ++i) { 1374 unsigned count; 1375 count = 0; 1376 pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &count); 1377 if (count == 0) 1378 break; 1333 1379 } 1334 1380 … … 1432 1478 { 1433 1479 static char report[1024]; 1480 1481 puts("PJSIP Performance Measurement Tool\n" 1482 "(c)2006 pjsip.org\n"); 1434 1483 1435 1484 if (create_app() != 0) … … 1487 1536 1488 1537 1489 PJ_LOG(3,(THIS_FILE, "Sending %d %s to '%.*s' with %d maximum outstanding jobs, please wait..",1538 printf("Sending %d %s to '%.*s' with %d maximum outstanding jobs, please wait..\n", 1490 1539 app.client.job_count, test_type, 1491 1540 (int)app.client.dst_uri.slen, app.client.dst_uri.ptr, 1492 app.client.job_window) );1541 app.client.job_window); 1493 1542 1494 1543 for (i=0; i<app.thread_count; ++i) { 1495 status = pj_thread_create(app.pool, NULL, &client_thread, NULL,1544 status = pj_thread_create(app.pool, NULL, &client_thread, (void*)i, 1496 1545 0, 0, &app.thread[i]); 1497 1546 if (status != PJ_SUCCESS) { … … 1528 1577 if (msec_req == 0) msec_req = 1; 1529 1578 1579 if (app.client.job_submitted < app.client.job_count) 1580 puts("\ntimed-out!\n"); 1581 else 1582 puts("\ndone.\n"); 1530 1583 1531 1584 pj_ansi_snprintf( 1532 1585 report, sizeof(report), 1533 "Total %d %s sent in %d ms at rate %d/sec\n"1586 "Total %d %s sent in %d ms at rate of %d/sec\n" 1534 1587 "Total %d responses receieved in %d ms:\n" 1535 1588 " - 2xx responses: %7d (rate=%d/sec)\n" -
pjproject/trunk/pjsip/include/pjsip/sip_config.h
r583 r602 147 147 #endif 148 148 149 150 /** 151 * This macro controls maximum numbers of ioqueue events to be processed 152 * in a single pjsip_endpt_handle_events() poll. When PJSIP detects that 153 * there are probably more events available from the network and total 154 * events so far is less than this value, PJSIP will call pj_ioqueue_poll() 155 * again to get more events. 156 * 157 * Value 1 works best for ioqueue with select() back-end, while for IOCP it is 158 * probably best to set this value equal to PJSIP_MAX_TIMED_OUT_ENTRIES 159 * since IOCP only processes one event at a time. 160 * 161 * Default: 1 162 */ 163 #ifndef PJSIP_MAX_NET_EVENTS 164 # define PJSIP_MAX_NET_EVENTS 1 165 #endif 166 167 168 /** 169 * Max entries to process in timer heap per poll. 170 * 171 * Default: 10 172 */ 173 #ifndef PJSIP_MAX_TIMED_OUT_ENTRIES 174 # define PJSIP_MAX_TIMED_OUT_ENTRIES 10 175 #endif 176 177 178 /** 179 * Idle timeout interval to be applied to transports with no usage 180 * before the transport is destroyed. Value is in seconds. 181 * 182 * Default: 60 183 */ 184 #ifndef PJSIP_TRANSPORT_IDLE_TIME 185 # define PJSIP_TRANSPORT_IDLE_TIME 60 186 #endif 187 188 189 /** 190 * Maximum number of usages for a transport before a new transport is 191 * created. This only applies for ephemeral transports such as TCP. 192 * 193 * Currently this is not used. 194 * 195 * Default: -1 196 */ 197 #ifndef PJSIP_MAX_TRANSPORT_USAGE 198 # define PJSIP_MAX_TRANSPORT_USAGE ((unsigned)-1) 199 #endif 149 200 150 201 … … 164 215 #define PJSIP_POOL_LEN_UA 4000 165 216 #define PJSIP_POOL_INC_UA 4000 166 #define PJSIP_TRANSPORT_CLOSE_TIMEOUT 30167 #define PJSIP_MAX_TRANSPORT_USAGE 16168 217 169 218 #define PJSIP_MAX_FORWARDS_VALUE 70 … … 193 242 #define PJSIP_POOL_INC_DIALOG 512 194 243 195 /* Transport idle timeout before it's destroyed. */196 #define PJSIP_TRANSPORT_IDLE_TIME 30197 198 /* Max entries to process in timer heap per poll. */199 #define PJSIP_MAX_TIMED_OUT_ENTRIES 10200 201 244 /* Maximum header types. */ 202 245 #define PJSIP_MAX_HEADER_TYPES 64 -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r598 r602 657 657 timeout.sec = timeout.msec = 0; 658 658 } 659 } while (c > 0 && net_event_count < PJSIP_MAX_ TIMED_OUT_ENTRIES*2);659 } while (c > 0 && net_event_count < PJSIP_MAX_NET_EVENTS); 660 660 661 661 count += net_event_count;
Note: See TracChangeset
for help on using the changeset viewer.