Navigation


Changeset 1072:9a7d3ecbb44b in freeDiameter


Ignore:
Timestamp:
May 2, 2013, 12:52:17 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Update dbg_monitor to use the new function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_monitor/dbg_monitor.c

    r974 r1072  
    5050EXTENSION_ENTRY("dbg_monitor", monitor_main);
    5151
     52
     53
     54/* Display information about a queue */
     55static 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
    5272/* Thread to display periodical debug information */
    5373static pthread_t thr;
     
    5979        /* Loop */
    6080        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       
    6186                #ifdef DEBUG
    6287                for (i++; i % 30; i++) {
     
    6590                }
    6691                #else /* DEBUG */
    67                 sleep(3600); /* 1 hour */
     92                sleep(3599); /* 1 hour */
    6893                #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, &current_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, &current_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, &current_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, &current_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, &current_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               
    71125                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 */);
    73126                sleep(1);
    74127        }
Note: See TracChangeset for help on using the changeset viewer.