/[svn]/ircd-hybrid-7.2/modules/m_stats.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/modules/m_stats.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1016 by michael, Fri Sep 18 10:14:09 2009 UTC revision 1017 by michael, Tue Oct 27 22:22:38 2009 UTC
# Line 380  count_memory(struct Client *source_p) Line 380  count_memory(struct Client *source_p)
380    unsigned int local_client_conf_count = 0;      /* local client conf links */    unsigned int local_client_conf_count = 0;      /* local client conf links */
381    unsigned int users_counted = 0;                /* user structs */    unsigned int users_counted = 0;                /* user structs */
382    
383    unsigned int channel_users = 0; /* XXX */    unsigned int channel_members = 0;
384    unsigned int channel_invites = 0;    unsigned int channel_invites = 0;
385    unsigned int channel_bans = 0;    unsigned int channel_bans = 0;
386    unsigned int channel_except = 0;    unsigned int channel_except = 0;
# Line 404  count_memory(struct Client *source_p) Line 404  count_memory(struct Client *source_p)
404    uint64_t conf_memory = 0;       /* memory used by conf lines      */    uint64_t conf_memory = 0;       /* memory used by conf lines      */
405    uint64_t mem_ips_stored;        /* memory used by ip address hash */    uint64_t mem_ips_stored;        /* memory used by ip address hash */
406    
   uint64_t client_hash_table_size = 0;  
   uint64_t channel_hash_table_size = 0;  
   uint64_t resv_hash_table_size = 0;  
   uint64_t id_hash_table_size = 0;  
407    uint64_t total_channel_memory = 0;    uint64_t total_channel_memory = 0;
408    uint64_t totww = 0;    uint64_t totww = 0;
409    
# Line 420  count_memory(struct Client *source_p) Line 416  count_memory(struct Client *source_p)
416    uint64_t total_memory = 0;    uint64_t total_memory = 0;
417    unsigned int topic_count = 0;    unsigned int topic_count = 0;
418    
419    unsigned int wlh = 0;   /* watchlist headers     */    unsigned int watch_list_headers = 0;   /* watchlist headers     */
420    unsigned int wle = 0;   /* watchlist entries     */    unsigned int watch_list_entries = 0;   /* watchlist entries     */
421    uint64_t wlhm = 0; /* watchlist memory used */    uint64_t watch_list_memory = 0; /* watchlist memory used */
422    
   count_whowas_memory(&wwu, &wwm);  
423    
424    DLINK_FOREACH(gptr, global_client_list.head)    DLINK_FOREACH(gptr, global_client_list.head)
425    {    {
# Line 434  count_memory(struct Client *source_p) Line 429  count_memory(struct Client *source_p)
429      {      {
430        ++local_client_count;        ++local_client_count;
431        local_client_conf_count += dlink_list_length(&target_p->localClient->confs);        local_client_conf_count += dlink_list_length(&target_p->localClient->confs);
432        wle += dlink_list_length(&target_p->localClient->watches);        watch_list_entries += dlink_list_length(&target_p->localClient->watches);
433      }      }
434      else      else
435        ++remote_client_count;        ++remote_client_count;
# Line 459  count_memory(struct Client *source_p) Line 454  count_memory(struct Client *source_p)
454      const struct Ban *actualBan;      const struct Ban *actualBan;
455      const struct Channel *chptr = gptr->data;      const struct Channel *chptr = gptr->data;
456    
457      channel_users   += dlink_list_length(&chptr->members);      channel_members += dlink_list_length(&chptr->members);
458      channel_invites += dlink_list_length(&chptr->invites);      channel_invites += dlink_list_length(&chptr->invites);
459    
460      if (chptr->topic != NULL)      if (chptr->topic != NULL)
461        ++topic_count;        ++topic_count;
462    
463      if ((channel_bans = dlink_list_length(&chptr->banlist)))      channel_bans += dlink_list_length(&chptr->banlist);
464      {      channel_ban_memory += dlink_list_length(&chptr->banlist) * sizeof(struct Ban);
       channel_ban_memory = channel_bans * sizeof(struct Ban);  
465    
466        DLINK_FOREACH(dlink, chptr->banlist.head)      DLINK_FOREACH(dlink, chptr->banlist.head)
467        {      {
468          actualBan = dlink->data;        actualBan = dlink->data;
469          assert(actualBan->who);        assert(actualBan->who);
470    
471          channel_ban_memory += actualBan->len + 3;        channel_ban_memory += actualBan->len + 1;
472          channel_ban_memory += strlen(actualBan->who) + 1;        channel_ban_memory += strlen(actualBan->who) + 1;
       }  
473      }      }
474    
475      if ((channel_except = dlink_list_length(&chptr->exceptlist)))      channel_except += dlink_list_length(&chptr->exceptlist);
476      {      channel_except_memory += dlink_list_length(&chptr->exceptlist) * sizeof(struct Ban);
       channel_except_memory = channel_except * sizeof(struct Ban);  
477    
478        DLINK_FOREACH(dlink, chptr->exceptlist.head)      DLINK_FOREACH(dlink, chptr->exceptlist.head)
479        {      {
480          actualBan = dlink->data;        actualBan = dlink->data;
481          assert(actualBan->who);        assert(actualBan->who);
482    
483          channel_except_memory += actualBan->len + 3;        channel_except_memory += actualBan->len + 1;
484          channel_except_memory += strlen(actualBan->who) + 1;        channel_except_memory += strlen(actualBan->who) + 1;
       }  
485      }      }
486    
487      if ((channel_invex = dlink_list_length(&chptr->invexlist)))      channel_invex += dlink_list_length(&chptr->invexlist);
488      {      channel_invex_memory += dlink_list_length(&chptr->invexlist) * sizeof(struct Ban);
       channel_invex_memory = channel_invex * sizeof(struct Ban);  
489    
490        DLINK_FOREACH(dlink, chptr->invexlist.head)      DLINK_FOREACH(dlink, chptr->invexlist.head)
491        {      {
492          actualBan = dlink->data;        actualBan = dlink->data;
493          assert(actualBan->who);        assert(actualBan->who);
494    
495          channel_invex_memory += actualBan->len + 3;        channel_invex_memory += actualBan->len + 1;
496          channel_invex_memory += strlen(actualBan->who) + 1;        channel_invex_memory += strlen(actualBan->who) + 1;
       }  
497      }      }
498    }    }
499    
# Line 538  count_memory(struct Client *source_p) Line 527  count_memory(struct Client *source_p)
527    /* count up all classes */    /* count up all classes */
528    class_count = dlink_list_length(&class_items);    class_count = dlink_list_length(&class_items);
529    
530    watch_count_memory(&wlh, &wlhm);    count_whowas_memory(&wwu, &wwm);
531      watch_count_memory(&watch_list_headers, &watch_list_memory);
532    
533    sendto_one(source_p, ":%s %d %s z :WATCH headers %u(%u) entries %d(%d)",    sendto_one(source_p, ":%s %d %s z :WATCH headers %u(%u) entries %d(%d)",
534               me.name, RPL_STATSDEBUG, source_p->name, wlh, wlhm, wle,               me.name, RPL_STATSDEBUG, source_p->name, watch_list_headers,
535               wle * sizeof(dlink_node));               watch_list_memory, watch_list_entries,
536                 watch_list_entries * sizeof(dlink_node) * 2);
537    
538    sendto_one(source_p, ":%s %d %s z :Clients %u(%u)",    sendto_one(source_p, ":%s %d %s z :Clients %u(%u)",
539               me.name, RPL_STATSDEBUG, source_p->name, users_counted,               me.name, RPL_STATSDEBUG, source_p->name, users_counted,
# Line 557  count_memory(struct Client *source_p) Line 548  count_memory(struct Client *source_p)
548               local_client_conf_count,               local_client_conf_count,
549               (unsigned long long)(local_client_conf_count * sizeof(dlink_node)));               (unsigned long long)(local_client_conf_count * sizeof(dlink_node)));
550    
   /* XXX  ConfigItemList fix */  
 #if 0  
   sendto_one(source_p, ":%s %d %s z :Conflines %lu(%d)",  
              me.name, RPL_STATSDEBUG, source_p->name,  
              dlink_list_length(&ConfigItemList), (int) conf_memory);  
 #endif  
   
551    sendto_one(source_p, ":%s %d %s z :Resv channels %lu(%lu) nicks %lu(%lu)",    sendto_one(source_p, ":%s %d %s z :Resv channels %lu(%lu) nicks %lu(%lu)",
552               me.name, RPL_STATSDEBUG, source_p->name,               me.name, RPL_STATSDEBUG, source_p->name,
553               dlink_list_length(&resv_channel_list),               dlink_list_length(&resv_channel_list),
# Line 594  count_memory(struct Client *source_p) Line 578  count_memory(struct Client *source_p)
578               channel_invex, channel_invex_memory);               channel_invex, channel_invex_memory);
579    
580    sendto_one(source_p, ":%s %d %s z :Channel members %u(%llu) invites %u(%llu)",    sendto_one(source_p, ":%s %d %s z :Channel members %u(%llu) invites %u(%llu)",
581               me.name, RPL_STATSDEBUG, source_p->name, channel_users,               me.name, RPL_STATSDEBUG, source_p->name, channel_members,
582               (unsigned long long)(channel_users * sizeof(struct Membership)),               (unsigned long long)(channel_members * sizeof(struct Membership)),
583               channel_invites, (unsigned long long)channel_invites *               channel_invites, (unsigned long long)channel_invites *
584               sizeof(dlink_node) * 2);               sizeof(dlink_node) * 2);
585    
586    total_channel_memory = channel_memory + channel_ban_memory +    total_channel_memory = channel_memory + channel_ban_memory +
587                           channel_users * sizeof(struct Membership) +                           channel_members * sizeof(struct Membership) +
588                           (channel_invites * sizeof(dlink_node)*2);                           (channel_invites * sizeof(dlink_node)*2);
589    
590    sendto_one(source_p, ":%s %d %s z :Safelist %u(%llu)",    sendto_one(source_p, ":%s %d %s z :Safelist %u(%llu)",
# Line 616  count_memory(struct Client *source_p) Line 600  count_memory(struct Client *source_p)
600               NICKNAMEHISTORYLENGTH, wwm);               NICKNAMEHISTORYLENGTH, wwm);
601    
602    totww = wwu * sizeof(struct Client) + wwm;    totww = wwu * sizeof(struct Client) + wwm;
603  /****  
   client_hash_table_size  = hash_get_client_table_size();  
   channel_hash_table_size = hash_get_channel_table_size();  
   resv_hash_table_size    = hash_get_resv_table_size();  
   id_hash_table_size      = hash_get_id_table_size();  
   
   sendto_one(source_p, ":%s %d %s z :Hash: client %u(%lu) chan %u(%lu) resv "  
              "%u(%lu) id %u(%lu)",  
              me.name, RPL_STATSDEBUG, source_p->name,  
              U_MAX, client_hash_table_size,  
              CH_MAX, channel_hash_table_size , R_MAX,  
              resv_hash_table_size, U_MAX, id_hash_table_size);  
 ****/  
604    count_ip_hash(&number_ips_stored,&mem_ips_stored);    count_ip_hash(&number_ips_stored,&mem_ips_stored);
605    sendto_one(source_p, ":%s %d %s z :iphash %u(%llu)",    sendto_one(source_p, ":%s %d %s z :iphash %u(%llu)",
606               me.name, RPL_STATSDEBUG, source_p->name,               me.name, RPL_STATSDEBUG, source_p->name,
# Line 636  count_memory(struct Client *source_p) Line 608  count_memory(struct Client *source_p)
608    
609    total_memory = totww + total_channel_memory + conf_memory + class_count *    total_memory = totww + total_channel_memory + conf_memory + class_count *
610                   sizeof(struct ClassItem);                   sizeof(struct ClassItem);
   total_memory += client_hash_table_size;  
   total_memory += channel_hash_table_size;  
   total_memory += resv_hash_table_size;  
   total_memory += id_hash_table_size;  
   
611    sendto_one(source_p, ":%s %d %s z :Total: whowas %llu channel %llu conf %llu",    sendto_one(source_p, ":%s %d %s z :Total: whowas %llu channel %llu conf %llu",
612               me.name, RPL_STATSDEBUG, source_p->name, totww,               me.name, RPL_STATSDEBUG, source_p->name, totww,
613               total_channel_memory, conf_memory);               total_channel_memory, conf_memory);

Legend:
Removed from v.1016  
changed lines
  Added in v.1017

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28