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

Comparing ircd-hybrid-7.2/modules/m_stats.c (file contents):
Revision 896 by michael, Sat Nov 3 08:54:09 2007 UTC vs.
Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC

# Line 180 | Line 180 | static const struct StatsStruct
180    { 'z',        stats_memory,           1,      0,      },
181    { 'Z',        stats_ziplinks,         1,      0,      },
182    { '?',        stats_servlinks,        0,      0,      },
183 <  { '\0',       (void(*)())0,           0,      0,      }
183 >  { '\0',       NULL,                   0,      0,      }
184   };
185  
186   const char *from, *to;
# Line 379 | Line 379 | count_memory(struct Client *source_p)
379    const dlink_node *gptr = NULL;
380    const dlink_node *dlink = NULL;
381  
382 <  int local_client_conf_count = 0;      /* local client conf links */
383 <  int users_counted = 0;                /* user structs */
382 >  unsigned int local_client_conf_count = 0;      /* local client conf links */
383 >  unsigned int users_counted = 0;                /* user structs */
384  
385 <  int channel_users = 0; /* XXX */
386 <  int channel_invites = 0;
387 <  int channel_bans = 0;
388 <  int channel_except = 0;
389 <  int channel_invex = 0;
390 <
391 <  int wwu = 0;                  /* whowas users */
392 <  int class_count = 0;          /* classes */
393 <  int aways_counted = 0;
394 <  int number_ips_stored;        /* number of ip addresses hashed */
395 <
396 <  unsigned long channel_memory = 0;
397 <  size_t channel_ban_memory = 0;
398 <  size_t channel_except_memory = 0;
399 <  size_t channel_invex_memory = 0;
385 >  unsigned int channel_users = 0; /* XXX */
386 >  unsigned int channel_invites = 0;
387 >  unsigned int channel_bans = 0;
388 >  unsigned int channel_except = 0;
389 >  unsigned int channel_invex = 0;
390 >
391 >  unsigned int wwu = 0;                  /* whowas users */
392 >  unsigned int class_count = 0;          /* classes */
393 >  unsigned int aways_counted = 0;
394 >  unsigned int number_ips_stored;        /* number of ip addresses hashed */
395 >
396 >  uint64_t channel_memory = 0;
397 >  uint64_t channel_ban_memory = 0;
398 >  uint64_t channel_except_memory = 0;
399 >  uint64_t channel_invex_memory = 0;
400  
401    unsigned int safelist_count = 0;
402 <  size_t safelist_memory = 0;
402 >  uint64_t safelist_memory = 0;
403  
404 <  unsigned long away_memory = 0;       /* memory used by aways           */
405 <  unsigned long wwm = 0;               /* whowas array memory used       */
406 <  unsigned long conf_memory = 0;       /* memory used by conf lines      */
407 <  unsigned long mem_ips_stored;        /* memory used by ip address hash */
408 <
409 <  unsigned long client_hash_table_size = 0;
410 <  unsigned long channel_hash_table_size = 0;
411 <  unsigned long resv_hash_table_size = 0;
412 <  unsigned long id_hash_table_size = 0;
413 <  unsigned long total_channel_memory = 0;
414 <  unsigned long totww = 0;
404 >  uint64_t away_memory = 0;       /* memory used by aways           */
405 >  uint64_t wwm = 0;               /* whowas array memory used       */
406 >  uint64_t conf_memory = 0;       /* memory used by conf lines      */
407 >  uint64_t mem_ips_stored;        /* memory used by ip address hash */
408 >
409 >  uint64_t client_hash_table_size = 0;
410 >  uint64_t channel_hash_table_size = 0;
411 >  uint64_t resv_hash_table_size = 0;
412 >  uint64_t id_hash_table_size = 0;
413 >  uint64_t total_channel_memory = 0;
414 >  uint64_t totww = 0;
415  
416    unsigned int local_client_count  = 0;
417    unsigned int remote_client_count = 0;
418  
419 <  unsigned int local_client_memory_used  = 0;
420 <  unsigned int remote_client_memory_used = 0;
419 >  uint64_t local_client_memory_used  = 0;
420 >  uint64_t remote_client_memory_used = 0;
421  
422 <  unsigned long total_memory = 0;
422 >  uint64_t total_memory = 0;
423    unsigned int topic_count = 0;
424  
425    unsigned int wlh = 0;   /* watchlist headers     */
426    unsigned int wle = 0;   /* watchlist entries     */
427 <  size_t wlhm = 0; /* watchlist memory used */
427 >  uint64_t wlhm = 0; /* watchlist memory used */
428  
429    count_whowas_memory(&wwu, &wwm);
430  
# Line 458 | Line 458 | count_memory(struct Client *source_p)
458                     sizeof(struct Channel);
459    DLINK_FOREACH(gptr, global_channel_list.head)
460    {
461 <    struct Ban *actualBan;
462 <    struct Channel *chptr = gptr->data;
461 >    const struct Ban *actualBan;
462 >    const struct Channel *chptr = gptr->data;
463  
464      channel_users   += dlink_list_length(&chptr->members);
465      channel_invites += dlink_list_length(&chptr->invites);
# Line 515 | Line 515 | count_memory(struct Client *source_p)
515      safelist_memory = safelist_count * sizeof(struct ListTask);
516      DLINK_FOREACH(gptr, listing_client_list.head)
517      {
518 <      struct Client *acptr = gptr->data;
518 >      const struct Client *acptr = gptr->data;
519  
520        DLINK_FOREACH(dlink, acptr->localClient->list_task->show_mask.head)
521          safelist_memory += strlen(dlink->data);
# Line 550 | Line 550 | count_memory(struct Client *source_p)
550               me.name, RPL_STATSDEBUG, source_p->name, users_counted,
551               (users_counted * sizeof(struct Client)));
552  
553 <  sendto_one(source_p, ":%s %d %s z :User aways %u(%d)",
553 >  sendto_one(source_p, ":%s %d %s z :User aways %u(%llu)",
554               me.name, RPL_STATSDEBUG, source_p->name,
555 <             aways_counted, (int)away_memory);
555 >             aways_counted, away_memory);
556  
557 <  sendto_one(source_p, ":%s %d %s z :Attached confs %u(%u)",
557 >  sendto_one(source_p, ":%s %d %s z :Attached confs %u(%llu)",
558               me.name, RPL_STATSDEBUG, source_p->name,
559               local_client_conf_count,
560 <             (unsigned long)(local_client_conf_count * sizeof(dlink_node)));
560 >             (unsigned long long)(local_client_conf_count * sizeof(dlink_node)));
561  
562    /* XXX  ConfigItemList fix */
563   #if 0
# Line 573 | Line 573 | count_memory(struct Client *source_p)
573               dlink_list_length(&nresv_items),
574               dlink_list_length(&nresv_items) * sizeof(struct MatchItem));
575  
576 <  sendto_one(source_p, ":%s %d %s z :Classes %u(%lu)",
576 >  sendto_one(source_p, ":%s %d %s z :Classes %u(%llu)",
577               me.name, RPL_STATSDEBUG, source_p->name,
578 <             class_count, (unsigned long)(class_count * sizeof(struct ClassItem)));
578 >             class_count, (unsigned long long)(class_count * sizeof(struct ClassItem)));
579  
580 <  sendto_one(source_p, ":%s %d %s z :Channels %lu(%lu) Topics %u(%d)",
580 >  sendto_one(source_p, ":%s %d %s z :Channels %lu(%llu) Topics %u(%d)",
581               me.name, RPL_STATSDEBUG, source_p->name,
582               dlink_list_length(&global_channel_list),
583               channel_memory, topic_count, topic_count *
584               (TOPICLEN + 1 + USERHOST_REPLYLEN));
585  
586 <  sendto_one(source_p, ":%s %d %s z :Bans %u(%u)",
586 >  sendto_one(source_p, ":%s %d %s z :Bans %u(%llu)",
587               me.name, RPL_STATSDEBUG, source_p->name,
588               channel_bans, channel_ban_memory);
589  
590 <  sendto_one(source_p, ":%s %d %s z :Exceptions %u(%u)",
590 >  sendto_one(source_p, ":%s %d %s z :Exceptions %u(%llu)",
591               me.name, RPL_STATSDEBUG, source_p->name,
592               channel_except, channel_except_memory);
593  
594 <  sendto_one(source_p, ":%s %d %s z :Invex %u(%u)",
594 >  sendto_one(source_p, ":%s %d %s z :Invex %u(%llu)",
595               me.name, RPL_STATSDEBUG, source_p->name,
596               channel_invex, channel_invex_memory);
597  
598 <  sendto_one(source_p, ":%s %d %s z :Channel members %u(%lu) invites %u(%lu)",
598 >  sendto_one(source_p, ":%s %d %s z :Channel members %u(%llu) invites %u(%llu)",
599               me.name, RPL_STATSDEBUG, source_p->name, channel_users,
600 <             (unsigned long)(channel_users * sizeof(struct Membership)),
601 <             channel_invites, (unsigned long)channel_invites *
600 >             (unsigned long long)(channel_users * sizeof(struct Membership)),
601 >             channel_invites, (unsigned long long)channel_invites *
602               sizeof(dlink_node) * 2);
603  
604    total_channel_memory = channel_memory + channel_ban_memory +
605                           channel_users * sizeof(struct Membership) +
606                           (channel_invites * sizeof(dlink_node)*2);
607  
608 <  sendto_one(source_p, ":%s %d %s z :Safelist %u(%u)",
608 >  sendto_one(source_p, ":%s %d %s z :Safelist %u(%llu)",
609               me.name, RPL_STATSDEBUG, source_p->name,
610               safelist_count, safelist_memory);
611  
612 <  sendto_one(source_p, ":%s %d %s z :Whowas users %u(%lu)",
612 >  sendto_one(source_p, ":%s %d %s z :Whowas users %u(%llu)",
613               me.name, RPL_STATSDEBUG, source_p->name,
614 <             wwu, (unsigned long)(wwu * sizeof(struct Client)));
614 >             wwu, (unsigned long long)(wwu * sizeof(struct Client)));
615  
616 <  sendto_one(source_p, ":%s %d %s z :Whowas array %u(%d)",
616 >  sendto_one(source_p, ":%s %d %s z :Whowas array %u(%llu)",
617               me.name, RPL_STATSDEBUG, source_p->name,
618 <             NICKNAMEHISTORYLENGTH, (int)wwm);
618 >             NICKNAMEHISTORYLENGTH, wwm);
619  
620    totww = wwu * sizeof(struct Client) + wwm;
621   /****
# Line 632 | Line 632 | count_memory(struct Client *source_p)
632               resv_hash_table_size, U_MAX, id_hash_table_size);
633   ****/
634    count_ip_hash(&number_ips_stored,&mem_ips_stored);
635 <  sendto_one(source_p, ":%s %d %s z :iphash %u(%d)",
635 >  sendto_one(source_p, ":%s %d %s z :iphash %u(%llu)",
636               me.name, RPL_STATSDEBUG, source_p->name,
637 <             number_ips_stored, (int)mem_ips_stored);
637 >             number_ips_stored, mem_ips_stored);
638  
639    total_memory = totww + total_channel_memory + conf_memory + class_count *
640                   sizeof(struct ClassItem);
# Line 643 | Line 643 | count_memory(struct Client *source_p)
643    total_memory += resv_hash_table_size;
644    total_memory += id_hash_table_size;
645  
646 <  sendto_one(source_p, ":%s %d %s z :Total: whowas %d channel %d conf %d",
647 <             me.name, RPL_STATSDEBUG, source_p->name, (int)totww,
648 <            (int)total_channel_memory, (int)conf_memory);
646 >  sendto_one(source_p, ":%s %d %s z :Total: whowas %llu channel %llu conf %llu",
647 >             me.name, RPL_STATSDEBUG, source_p->name, totww,
648 >             total_channel_memory, conf_memory);
649  
650    local_client_memory_used = local_client_count*(sizeof(struct Client) + sizeof(struct LocalUser));
651    total_memory += local_client_memory_used;
652 <  sendto_one(source_p, ":%s %d %s z :Local client Memory in use: %d(%d)",
652 >  sendto_one(source_p, ":%s %d %s z :Local client Memory in use: %d(%llu)",
653               me.name, RPL_STATSDEBUG, source_p->name, local_client_count,
654               local_client_memory_used);
655  
656    remote_client_memory_used = remote_client_count * sizeof(struct Client);
657    total_memory += remote_client_memory_used;
658 <  sendto_one(source_p, ":%s %d %s z :Remote client Memory in use: %d(%d)",
658 >  sendto_one(source_p, ":%s %d %s z :Remote client Memory in use: %d(%llu)",
659               me.name, RPL_STATSDEBUG, source_p->name, remote_client_count,
660               remote_client_memory_used);
661  
662    block_heap_report_stats(source_p);
663  
664    sendto_one(source_p,
665 <             ":%s %d %s z :TOTAL: %d Available:  Current max RSS: %lu",
665 >             ":%s %d %s z :TOTAL: %llu",
666               me.name, RPL_STATSDEBUG, source_p->name,
667 <             (int)total_memory, get_maxrss());
667 >             total_memory);
668   }
669  
670   static void
# Line 1262 | Line 1262 | stats_memory(struct Client *source_p)
1262   static void
1263   stats_ziplinks(struct Client *source_p)
1264   {
1265 <  dlink_node *ptr;
1266 <  struct Client *target_p;
1265 >  dlink_node *ptr = NULL;
1266    unsigned int sent_data = 0;
1267  
1268    DLINK_FOREACH(ptr, serv_list.head)
1269    {
1270 <    target_p = ptr->data;
1270 >    const struct Client *target_p = ptr->data;
1271  
1272      if (IsCapable(target_p, CAP_ZIP))
1273      {
# Line 1277 | Line 1276 | stats_ziplinks(struct Client *source_p)
1276         * -jmallett, 04/27/2002
1277         */
1278        struct ZipStats zipstats;
1279 <      memcpy(&zipstats, &target_p->localClient->zipstats, sizeof (struct ZipStats));
1279 >
1280 >      memcpy(&zipstats, &target_p->localClient->zipstats, sizeof(zipstats));
1281  
1282        sendto_one(source_p, ":%s %d %s Z :ZipLinks stats for %s send[%.2f%% "
1283 <                 "compression (%lu bytes data/%lu bytes wire)] recv[%.2f%% "
1284 <                 "compression (%lu bytes data/%lu bytes wire)]",
1283 >                 "compression (%llu bytes data/%llu bytes wire)] recv[%.2f%% "
1284 >                 "compression (%llu bytes data/%llu bytes wire)]",
1285                   from, RPL_STATSDEBUG, to, target_p->name,
1286                   zipstats.out_ratio, zipstats.out, zipstats.out_wire,
1287                   zipstats.in_ratio,  zipstats.in,  zipstats.in_wire);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines