Changeset 1072:9a7d3ecbb44b in freeDiameter
- Timestamp:
- May 2, 2013, 12:52:17 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_monitor/dbg_monitor.c
r974 r1072 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 throughput = (total_count * 1000000000) / ((total->tv_sec * 1000000000) + total->tv_nsec); 59 if (peer) { 60 TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%llditems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", 61 queue_desc, peer, current_count, limit_count, highest_count, 62 total_count, total->tv_sec, total->tv_nsec, throughput, 63 blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec); 64 } else { 65 TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%llditems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", 66 queue_desc, current_count, limit_count, highest_count, 67 total_count, total->tv_sec, total->tv_nsec, throughput, 68 blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec); 69 } 70 } 71 52 72 /* Thread to display periodical debug information */ 53 73 static pthread_t thr; … … 59 79 /* Loop */ 60 80 while (1) { 81 int current_count, limit_count, highest_count; 82 long long total_count; 83 struct timespec total, blocking, last; 84 struct fd_list * li; 85 61 86 #ifdef DEBUG 62 87 for (i++; i % 30; i++) { … … 65 90 } 66 91 #else /* DEBUG */ 67 sleep(3 600); /* 1 hour */92 sleep(3599); /* 1 hour */ 68 93 #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 */); 94 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping queues statistics"); 95 96 CHECK_FCT_DO( fd_stat_getstats(STAT_G_LOCAL, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 97 display_info("Local delivery", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 98 99 CHECK_FCT_DO( fd_stat_getstats(STAT_G_INCOMING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 100 display_info("Total received", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 101 102 CHECK_FCT_DO( fd_stat_getstats(STAT_G_OUTGOING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 103 display_info("Total sending", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 104 105 106 CHECK_FCT_DO( pthread_rwlock_rdlock(&fd_g_peers_rw), /* continue */ ); 107 108 for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) { 109 struct peer_hdr * p = (struct peer_hdr *)li->o; 110 111 fd_peer_dump(p, NONE); 112 113 CHECK_FCT_DO( fd_stat_getstats(STAT_P_PSM, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 114 display_info("Events, incl. recept", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 115 116 CHECK_FCT_DO( fd_stat_getstats(STAT_P_TOSEND, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); 117 display_info("Outgoing", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); 118 119 } 120 121 CHECK_FCT_DO( pthread_rwlock_unlock(&fd_g_peers_rw), /* continue */ ); 122 123 124 71 125 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 126 sleep(1); 74 127 }
Note: See TracChangeset
for help on using the changeset viewer.