Changeset 1372:6b1a2405cebb in freeDiameter for extensions/loadtest_cc/loadtest_cc.c
- Timestamp:
- Jun 12, 2019, 9:54:35 PM (5 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/loadtest_cc/loadtest_cc.c
r1371 r1372 68 68 } statistics; 69 69 70 void print_statistics(void) { 71 uint64_t missing; 72 73 if (statistics.first == 0 || statistics.last == 0 || statistics.last == statistics.first) { 74 return; 75 } 76 77 missing = statistics.sent - statistics.error - statistics.success; 78 79 fd_log_error("%s: %lld CCR messages sent in %llds (%.2f messages/second), %lld success (%.2f%%), %lld errors (%.2f%%), %lld missing (%.2f%%)", 80 fd_g_config->cnf_diamid, 81 (long long)statistics.sent, (long long)(statistics.last-statistics.first), (float)statistics.sent / (statistics.last-statistics.first), 82 (long long)statistics.success, 83 100*(float)statistics.success/statistics.sent, (long long)statistics.error, 100*(float)statistics.error/statistics.sent, 84 missing, 100*(float)missing/statistics.sent); 85 } 86 70 87 static int handle_message(struct msg **msg) { 71 88 struct msg_hdr *hdr = NULL; … … 299 316 do { 300 317 if (do_generate) { 318 time_t now; 301 319 if (statistics.first == 0) { 302 320 statistics.first = time(NULL); … … 305 323 fd_msg_send(&msg, NULL, NULL); 306 324 fd_log_debug("[%s] sent message", MODULE_NAME); 325 now = time(NULL); 326 if (statistics.last != now) { 327 print_statistics(); 328 } 307 329 statistics.last = time(NULL); 308 330 statistics.sent++; … … 387 409 void fd_ext_fini(void) 388 410 { 389 uint64_t missing;390 411 /* stop sending */ 391 412 do_generate = 0; … … 400 421 } 401 422 402 missing = statistics.sent - statistics.error - statistics.success; 403 404 fd_log_error("%lld messages sent in %llds (%.2f messages/second), %lld success (%.2f%%), %lld errors (%.2f%%), %lld missing (%.2f%%)", 405 (long long)statistics.sent, (long long)(statistics.last-statistics.first), (float)statistics.sent / (statistics.last-statistics.first), 406 (long long)statistics.success, 407 100*(float)statistics.success/statistics.sent, (long long)statistics.error, 100*(float)statistics.error/statistics.sent, 408 missing, 100*(float)missing/statistics.sent); 423 print_statistics(); 409 424 410 425 return;
Note: See TracChangeset
for help on using the changeset viewer.