Changes in extensions/dbg_monitor/dbg_monitor.c [974:2091bf698fb1:1075:54d1cb00331a] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_monitor/dbg_monitor.c
r974 r1075 50 50 EXTENSION_ENTRY("dbg_monitor", monitor_main); 51 51 52 53 54 /* Display information about a queue */ 55 static void display_info(char * queue_desc, char * peer, int current_count, int limit_count, int highest_count, long long total_count, 56 struct timespec * total, struct timespec * blocking, struct timespec * last) 57 { 58 long long ms = (total->tv_sec * 1000000) + (total->tv_nsec / 1000); 59 long double throughput = (long double)total_count * 1000000; 60 throughput /= ms; 61 if (peer) { 62 TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", 63 queue_desc, peer, current_count, limit_count, highest_count, 64 total_count, total->tv_sec, total->tv_nsec, throughput, 65 blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec); 66 } else { 67 TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", 68 queue_desc, current_count, limit_count, highest_count, 69 total_count, total->tv_sec, total->tv_nsec, throughput, 70 blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec); 71 } 72 } 73 52 74 /* Thread to display periodical debug information */ 53 75 static pthread_t thr; … … 59 81 /* Loop */ 60 82 while (1) { 83 int current_count, limit_count, highest_count; 84 long long total_count; 85 struct timespec total, blocking, last; 86 struct fd_list * li; 87 61 88 #ifdef DEBUG 62 89 for (i++; i % 30; i++) { … … 65 92 } 66 93 #else /* DEBUG */ 67 sleep(3 600); /* 1 hour */94 sleep(3599); /* 1 hour */ 68 95 #endif /* DEBUG */ 69 fd_log_debug("[dbg_monitor] Dumping current information"); 70 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, 0, NULL), /* continue */); 96 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping queues statistics"); 97 98 CHECK_FCT_DO( fd_stat_getstats(STAT_G_LOCAL, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 99 display_info("Local delivery", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 100 101 CHECK_FCT_DO( fd_stat_getstats(STAT_G_INCOMING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 102 display_info("Total received", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 103 104 CHECK_FCT_DO( fd_stat_getstats(STAT_G_OUTGOING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 105 display_info("Total sending", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 106 107 108 CHECK_FCT_DO( pthread_rwlock_rdlock(&fd_g_peers_rw), /* continue */ ); 109 110 for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) { 111 struct peer_hdr * p = (struct peer_hdr *)li->o; 112 113 fd_peer_dump(p, NONE); 114 115 CHECK_FCT_DO( fd_stat_getstats(STAT_P_PSM, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 116 display_info("Events, incl. recept", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 117 118 CHECK_FCT_DO( fd_stat_getstats(STAT_P_TOSEND, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 119 display_info("Outgoing", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 120 121 } 122 123 CHECK_FCT_DO( pthread_rwlock_unlock(&fd_g_peers_rw), /* continue */ ); 124 125 126 71 127 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */); 72 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_PEERS, 0, NULL), /* continue */);73 128 sleep(1); 74 129 }
Note: See TracChangeset
for help on using the changeset viewer.