Changeset 1381:f374d3f8f7d3 in freeDiameter for extensions/test_ccload
- Timestamp:
- Jun 27, 2019, 1:11:36 AM (5 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_ccload/test_ccload.c
r1375 r1381 67 67 uint64_t error; 68 68 time_t first; 69 time_t first_reply; 69 70 time_t last; 71 time_t last_reply; 70 72 } statistics; 71 73 72 74 void print_statistics(void) { 73 uint64_t missing ;75 uint64_t missing, received; 74 76 75 77 if (statistics.first == 0 || statistics.last == 0 || statistics.last == statistics.first) { … … 77 79 } 78 80 79 missing = statistics.sent - statistics.error - statistics.success; 80 81 fd_log_error("%s: %lld CCR messages sent in %llds (%.2f messages/second), %lld success (%.2f%%), %lld errors (%.2f%%), %lld missing (%.2f%%)", 81 received = statistics.error + statistics.success; 82 missing = statistics.sent - received; 83 84 fd_log_error("%s: %lld CCR messages sent in %llds (%.2f messages/second), %lld CCA messages received in %llds (%.2f messages/second), %lld success (%.2f%%), %lld errors (%.2f%%), %lld missing (%.2f%%)", 82 85 fd_g_config->cnf_diamid, 83 86 (long long)statistics.sent, (long long)(statistics.last-statistics.first), (float)statistics.sent / (statistics.last-statistics.first), 87 (long long)received, (long long)(statistics.last_reply-statistics.first_reply), (float)received / (statistics.last_reply-statistics.first_reply), 84 88 (long long)statistics.success, 85 89 100*(float)statistics.success/statistics.sent, (long long)statistics.error, 100*(float)statistics.error/statistics.sent, … … 104 108 } 105 109 110 if (statistics.first_reply == 0) { 111 statistics.first_reply = time(NULL); 112 } 106 113 /* Answer received, check it */ 107 114 if (fd_msg_search_avp(*msg, rc_avp_do, &rc) < 0 || rc == NULL) { … … 114 121 return -1; 115 122 } 123 statistics.last_reply = time(NULL); 116 124 fd_log_debug("Credit-Control-Answer with Result-Code %d received", ahdr->avp_value->i32); 117 125 switch (ahdr->avp_value->i32/1000) { … … 122 130 statistics.error++; 123 131 break; 132 } 133 if (statistics.sent - statistics.error - statistics.success == 0) { 134 print_statistics(); 124 135 } 125 136
Note: See TracChangeset
for help on using the changeset viewer.