ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.3/modules/m_stats.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/modules/m_stats.c (file contents), Revision 1011 by michael, Fri Sep 18 10:14:09 2009 UTC vs.
ircd-hybrid-7.3/modules/m_stats.c (file contents), Revision 1029 by michael, Sun Nov 8 13:10:50 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)