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

Comparing:
ircd-hybrid/modules/m_stats.c (file contents), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid-7.2/modules/m_stats.c (file contents), Revision 988 by michael, Sun Aug 16 14:00:36 2009 UTC

# Line 19 | Line 19
19   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
20   *  USA
21   *
22 < *  $Id: m_stats.c,v 1.190 2005/09/27 12:43:33 adx Exp $
22 > *  $Id$
23   */
24  
25   #include "stdinc.h"
# Line 41 | Line 41
41   #include "s_conf.h"      /* AccessItem, report_configured_links */
42   #include "s_misc.h"      /* serv_info */
43   #include "s_serv.h"      /* hunt_server */
44 – #include "s_stats.h"     /* tstats */
44   #include "s_user.h"      /* show_opers */
45   #include "event.h"       /* events */
46   #include "dbuf.h"
# Line 51 | Line 50
50   #include "resv.h"  /* report_resv */
51   #include "whowas.h"
52   #include "list.h"
53 + #include "watch.h"
54  
55   static void do_stats(struct Client *, int, char **);
56   static void m_stats(struct Client *, struct Client *, int, char *[]);
# Line 63 | Line 63 | struct Message stats_msgtab = {
63   };
64  
65   #ifndef STATIC_MODULES
66 < const char *_version = "$Revision: 1.190 $";
66 > const char *_version = "$Revision$";
67   static struct Callback *stats_cb;
68  
69   static void *
# 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 users_invited_count = 0;  /* users invited */
394 <  int aways_counted = 0;
395 <  int number_ips_stored;        /* number of ip addresses hashed */
396 <
397 <  unsigned long channel_memory = 0;
398 <  size_t channel_ban_memory = 0;
399 <  size_t channel_except_memory = 0;
400 <  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 +  uint64_t wlhm = 0; /* watchlist memory used */
428 +
429    count_whowas_memory(&wwu, &wwm);
430  
431    DLINK_FOREACH(gptr, global_client_list.head)
# Line 433 | Line 436 | count_memory(struct Client *source_p)
436      {
437        ++local_client_count;
438        local_client_conf_count += dlink_list_length(&target_p->localClient->confs);
439 +      wle += dlink_list_length(&target_p->localClient->watches);
440      }
441      else
442        ++remote_client_count;
# Line 440 | Line 444 | count_memory(struct Client *source_p)
444      if (IsClient(target_p))
445      {
446        ++users_counted;
443 –      users_invited_count += dlink_list_length(&target_p->invited);
447  
448        if (target_p->away != NULL)
449        {
# Line 455 | 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 512 | 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 537 | Line 540 | count_memory(struct Client *source_p)
540    /* count up all classes */
541    class_count = dlink_list_length(&class_items);
542  
543 <  sendto_one(source_p, ":%s %d %s z :Clients %u(%lu) Invites %u(%lu)",
543 >  watch_count_memory(&wlh, &wlhm);
544 >
545 >  sendto_one(source_p, ":%s %d %s z :WATCH headers %u(%u) entries %d(%d)",
546 >             me.name, RPL_STATSDEBUG, source_p->name, wlh, wlhm, wle,
547 >             wle * sizeof(dlink_node));
548 >
549 >  sendto_one(source_p, ":%s %d %s z :Clients %u(%u)",
550               me.name, RPL_STATSDEBUG, source_p->name, users_counted,
551 <             (unsigned long)(users_counted * sizeof(struct Client)),
543 <             users_invited_count, (unsigned long)(users_invited_count * sizeof(dlink_node)));
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(%lu)",
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 565 | 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) invite %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 *
602 <             sizeof(dlink_node));
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);
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 624 | 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 635 | 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 757 | Line 765 | stats_exempt(struct Client *source_p)
765    struct AccessItem *aconf;
766    int i;
767  
768 +  if (ConfigFileEntry.stats_e_disabled)
769 +  {
770 +    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
771 +               from, to);
772 +    return;
773 +  }
774 +
775    for (i = 0; i < ATABLE_SIZE; i++)
776    {
777      for (arec = atable[i]; arec; arec=arec->next)
# Line 790 | Line 805 | stats_events(struct Client *source_p)
805   static void
806   stats_pending_glines(struct Client *source_p)
807   {
808 < #ifdef GLINE_VOTING
809 <  dlink_node *pending_node;
810 <  struct gline_pending *glp_ptr;
811 <  char timebuffer[MAX_DATE_STRING];
797 <  struct tm *tmptr;
808 >  const dlink_node *dn_ptr = NULL;
809 >  const struct gline_pending *glp_ptr = NULL;
810 >  char timebuffer[MAX_DATE_STRING] = { '\0' };
811 >  struct tm *tmptr = NULL;
812  
813    if (!ConfigFileEntry.glines)
814    {
# Line 803 | Line 817 | stats_pending_glines(struct Client *sour
817      return;
818    }
819  
820 <  if (dlink_list_length(&pending_glines) > 0)
820 >  if (dlink_list_length(&pending_glines[GLINE_PENDING_ADD_TYPE]) > 0)
821      sendto_one(source_p, ":%s NOTICE %s :Pending G-lines",
822                 from, to);
823  
824 <  DLINK_FOREACH(pending_node, pending_glines.head)
824 >  DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_ADD_TYPE].head)
825    {
826 <    glp_ptr = pending_node->data;
827 <    tmptr   = localtime(&glp_ptr->time_request1);
826 >    glp_ptr = dn_ptr->data;
827 >    tmptr   = localtime(&glp_ptr->vote_1.time_request);
828      strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
829  
830      sendto_one(source_p,
831                 ":%s NOTICE %s :1) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
832 <               from, to, glp_ptr->oper_nick1,
833 <               glp_ptr->oper_user1, glp_ptr->oper_host1,
834 <               glp_ptr->oper_server1, timebuffer,
835 <               glp_ptr->user, glp_ptr->host, glp_ptr->reason1);
832 >               from, to, glp_ptr->vote_1.oper_nick,
833 >               glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
834 >               glp_ptr->vote_1.oper_server, timebuffer,
835 >               glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
836  
837 <    if (glp_ptr->oper_nick2[0] != '\0')
837 >    if (glp_ptr->vote_2.oper_nick[0] != '\0')
838      {
839 <      tmptr = localtime(&glp_ptr->time_request2);
839 >      tmptr = localtime(&glp_ptr->vote_2.time_request);
840        strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
841        sendto_one(source_p,
842        ":%s NOTICE %s :2) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
843 <                 from, to, glp_ptr->oper_nick2,
844 <                 glp_ptr->oper_user2, glp_ptr->oper_host2,
845 <                 glp_ptr->oper_server2, timebuffer,
846 <                 glp_ptr->user, glp_ptr->host, glp_ptr->reason2);
843 >               from, to, glp_ptr->vote_2.oper_nick,
844 >               glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
845 >               glp_ptr->vote_2.oper_server, timebuffer,
846 >               glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
847      }
848    }
849  
850    sendto_one(source_p, ":%s NOTICE %s :End of Pending G-lines",
851               from, to);
852 < #else
853 <  sendto_one(source_p, ":%s NOTICE %s :This server does not support G-Line voting",
852 >
853 >  if (dlink_list_length(&pending_glines[GLINE_PENDING_DEL_TYPE]) > 0)
854 >    sendto_one(source_p, ":%s NOTICE %s :Pending UNG-lines",
855 >               from, to);
856 >
857 >  DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_DEL_TYPE].head)
858 >  {
859 >    glp_ptr = dn_ptr->data;
860 >    tmptr   = localtime(&glp_ptr->vote_1.time_request);
861 >    strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
862 >
863 >    sendto_one(source_p,
864 >               ":%s NOTICE %s :1) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
865 >               from, to, glp_ptr->vote_1.oper_nick,
866 >               glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
867 >               glp_ptr->vote_1.oper_server, timebuffer,
868 >               glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
869 >
870 >    if (glp_ptr->vote_2.oper_nick[0] != '\0')
871 >    {
872 >      tmptr = localtime(&glp_ptr->vote_2.time_request);
873 >      strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
874 >      sendto_one(source_p,
875 >      ":%s NOTICE %s :2) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
876 >               from, to, glp_ptr->vote_2.oper_nick,
877 >               glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
878 >               glp_ptr->vote_2.oper_server, timebuffer,
879 >               glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
880 >
881 >    }
882 >  }
883 >
884 >  sendto_one(source_p, ":%s NOTICE %s :End of Pending UNG-lines",
885               from, to);
841 – #endif /* GLINE VOTING */
886   }
887  
888   /* stats_glines()
# Line 862 | Line 906 | stats_glines(struct Client *source_p)
906  
907    for (; i < ATABLE_SIZE; ++i)
908    {
909 <    for (arec = atable[i]; arec; arec=arec->next)
909 >    for (arec = atable[i]; arec; arec = arec->next)
910      {
911        if (arec->type == CONF_GLINE)
912        {
# Line 1002 | Line 1046 | stats_klines(struct Client *source_p)
1046      struct AccessItem *aconf;
1047  
1048      /* search for a kline */
1049 <    if(MyConnect(source_p))
1049 >    if (MyConnect(source_p))
1050        aconf = find_conf_by_address(source_p->host,
1051                                     &source_p->localClient->ip,
1052                                     CONF_KILL,
# Line 1012 | Line 1056 | stats_klines(struct Client *source_p)
1056        aconf = find_conf_by_address(source_p->host, NULL, CONF_KILL,
1057                                     0, source_p->username, NULL);
1058  
1059 <    if(aconf == NULL)
1059 >    if (aconf == NULL)
1060        return;
1061  
1062      /* dont report a tkline as a kline */
1063 <    if(aconf->flags & CONF_FLAGS_TEMPORARY)
1063 >    if (aconf->flags & CONF_FLAGS_TEMPORARY)
1064        return;
1065        
1066      sendto_one(source_p, form_str(RPL_STATSKLINE), from,
# Line 1110 | Line 1154 | stats_usage(struct Client *source_p)
1154   static void
1155   stats_tstats(struct Client *source_p)
1156   {
1157 <  tstats(source_p);
1157 >  const struct Client *target_p = NULL;
1158 >  const dlink_node *ptr = NULL;
1159 >  struct ServerStatistics *sp;
1160 >  struct ServerStatistics tmp;
1161 >
1162 >  sp = &tmp;
1163 >  memcpy(sp, &ServerStats, sizeof(struct ServerStatistics));
1164 >
1165 >  /*
1166 >   * must use the += operator. is_sv is not the number of currently
1167 >   * active server connections. Note the incrementation in
1168 >   * s_bsd.c:close_connection.
1169 >   */
1170 >  sp->is_sv += dlink_list_length(&serv_list);
1171 >
1172 >  DLINK_FOREACH(ptr, serv_list.head)
1173 >  {
1174 >    target_p = ptr->data;
1175 >
1176 >    sp->is_sbs += target_p->localClient->send.bytes;
1177 >    sp->is_sbr += target_p->localClient->recv.bytes;
1178 >    sp->is_sti += CurrentTime - target_p->firsttime;
1179 >  }
1180 >
1181 >  sp->is_cl += dlink_list_length(&local_client_list);
1182 >
1183 >  DLINK_FOREACH(ptr, local_client_list.head)
1184 >  {
1185 >    target_p = ptr->data;
1186 >
1187 >    sp->is_cbs += target_p->localClient->send.bytes;
1188 >    sp->is_cbr += target_p->localClient->recv.bytes;
1189 >    sp->is_cti += CurrentTime - target_p->firsttime;
1190 >  }
1191 >
1192 >  sp->is_ni += dlink_list_length(&unknown_list);
1193 >
1194 >  sendto_one(source_p, ":%s %d %s T :accepts %u refused %u",
1195 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_ac, sp->is_ref);
1196 >  sendto_one(source_p, ":%s %d %s T :unknown commands %u prefixes %u",
1197 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_unco, sp->is_unpf);
1198 >  sendto_one(source_p, ":%s %d %s T :nick collisions %u unknown closes %u",
1199 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_kill, sp->is_ni);
1200 >  sendto_one(source_p, ":%s %d %s T :wrong direction %u empty %u",
1201 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_wrdi, sp->is_empt);
1202 >  sendto_one(source_p, ":%s %d %s T :numerics seen %u",
1203 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_num);
1204 >  sendto_one(source_p, ":%s %d %s T :auth successes %u fails %u",
1205 >             me.name, RPL_STATSDEBUG, source_p->name, sp->is_asuc, sp->is_abad);
1206 >  sendto_one(source_p, ":%s %d %s T :Client Server",
1207 >             me.name, RPL_STATSDEBUG, source_p->name);
1208 >
1209 >  sendto_one(source_p, ":%s %d %s T :connected %u %u",
1210 >             me.name, RPL_STATSDEBUG, source_p->name,
1211 >             (unsigned int)sp->is_cl,
1212 >             (unsigned int)sp->is_sv);
1213 >  sendto_one(source_p, ":%s %d %s T :bytes sent %llu %llu",
1214 >             me.name, RPL_STATSDEBUG, source_p->name,
1215 >             sp->is_cbs, sp->is_sbs);
1216 >  sendto_one(source_p, ":%s %d %s T :bytes recv %llu %llu",
1217 >             me.name, RPL_STATSDEBUG, source_p->name,
1218 >             sp->is_cbr, sp->is_sbr);
1219 >  sendto_one(source_p, ":%s %d %s T :time connected %u %u",
1220 >             me.name, RPL_STATSDEBUG, source_p->name,
1221 >             (unsigned int)sp->is_cti,
1222 >             (unsigned int)sp->is_sti);
1223   }
1224  
1225   static void
# Line 1182 | Line 1291 | stats_memory(struct Client *source_p)
1291   static void
1292   stats_ziplinks(struct Client *source_p)
1293   {
1294 <  dlink_node *ptr;
1186 <  struct Client *target_p;
1294 >  dlink_node *ptr = NULL;
1295    unsigned int sent_data = 0;
1296  
1297    DLINK_FOREACH(ptr, serv_list.head)
1298    {
1299 <    target_p = ptr->data;
1299 >    const struct Client *target_p = ptr->data;
1300  
1301      if (IsCapable(target_p, CAP_ZIP))
1302      {
# Line 1197 | Line 1305 | stats_ziplinks(struct Client *source_p)
1305         * -jmallett, 04/27/2002
1306         */
1307        struct ZipStats zipstats;
1308 <      memcpy(&zipstats, &target_p->localClient->zipstats, sizeof (struct ZipStats));
1308 >
1309 >      memcpy(&zipstats, &target_p->localClient->zipstats, sizeof(zipstats));
1310  
1311        sendto_one(source_p, ":%s %d %s Z :ZipLinks stats for %s send[%.2f%% "
1312 <                 "compression (%lu bytes data/%lu bytes wire)] recv[%.2f%% "
1313 <                 "compression (%lu bytes data/%lu bytes wire)]",
1312 >                 "compression (%llu bytes data/%llu bytes wire)] recv[%.2f%% "
1313 >                 "compression (%llu bytes data/%llu bytes wire)]",
1314                   from, RPL_STATSDEBUG, to, target_p->name,
1315 <                 zipstats.out_ratio, zipstats.out, zipstats.out_wire,
1316 <                 zipstats.in_ratio,  zipstats.in,  zipstats.in_wire);
1315 >                 zipstats.out_ratio, zipstats.out, zipstats.out_wire,
1316 >                 zipstats.in_ratio,  zipstats.in,  zipstats.in_wire);
1317        ++sent_data;
1318      }
1319    }
# Line 1218 | Line 1327 | stats_servlinks(struct Client *source_p)
1327   {
1328    uint64_t sendB = 0, recvB = 0;
1329    time_t uptime = 0;
1330 <  int j = 0;
1222 <  struct Client *target_p = NULL;
1223 <  dlink_node *ptr;
1330 >  dlink_node *ptr = NULL;
1331  
1332    if (ConfigServerHide.flatten_links && !IsOper(source_p))
1333    {
# Line 1231 | Line 1338 | stats_servlinks(struct Client *source_p)
1338  
1339    DLINK_FOREACH(ptr, serv_list.head)
1340    {
1341 <    target_p = ptr->data;
1341 >    struct Client *target_p = ptr->data;
1342  
1236 –    ++j;
1343      sendB += target_p->localClient->send.bytes;
1344      recvB += target_p->localClient->recv.bytes;
1345  
# Line 1255 | Line 1361 | stats_servlinks(struct Client *source_p)
1361    recvB >>= 10;
1362  
1363    sendto_one(source_p, ":%s %d %s ? :%u total server(s)",
1364 <             from, RPL_STATSDEBUG, to, j);
1364 >             from, RPL_STATSDEBUG, to, dlink_list_length(&serv_list));
1365    sendto_one(source_p, ":%s %d %s ? :Sent total : %7.2f %s",
1366               from, RPL_STATSDEBUG, to,
1367 <             _GMKv((signed)sendB), _GMKs((signed)sendB));
1367 >             _GMKv(sendB), _GMKs(sendB));
1368    sendto_one(source_p, ":%s %d %s ? :Recv total : %7.2f %s",
1369               from, RPL_STATSDEBUG, to,
1370 <             _GMKv((signed)recvB), _GMKs((signed)recvB));
1370 >             _GMKv(recvB), _GMKs(recvB));
1371  
1372    uptime = (CurrentTime - me.since);
1373  
1374    sendto_one(source_p, ":%s %d %s ? :Server send: %7.2f %s (%4.1f K/s)",
1375               from, RPL_STATSDEBUG, to,
1376 <             _GMKv((signed)(me.localClient->send.bytes>>10)),
1377 <             _GMKs((signed)(me.localClient->send.bytes>>10)),
1378 <             (float)((float)(((signed)me.localClient->send.bytes) >> 10) /
1379 <             (float)uptime));
1376 >             _GMKv((me.localClient->send.bytes>>10)),
1377 >             _GMKs((me.localClient->send.bytes>>10)),
1378 >             (float)((float)((me.localClient->send.bytes) >> 10) /
1379 >             (float)uptime));
1380    sendto_one(source_p, ":%s %d %s ? :Server recv: %7.2f %s (%4.1f K/s)",
1381               from, RPL_STATSDEBUG, to,
1382 <             _GMKv((signed)(me.localClient->recv.bytes>>10)),
1383 <             _GMKs((signed)(me.localClient->recv.bytes>>10)),
1384 <             (float)((float)(((signed)me.localClient->recv.bytes) >> 10) /
1385 <             (float)uptime));
1382 >             _GMKv((me.localClient->recv.bytes>>10)),
1383 >             _GMKs((me.localClient->recv.bytes>>10)),
1384 >             (float)((float)((me.localClient->recv.bytes) >> 10) /
1385 >             (float)uptime));
1386   }
1387  
1388   static void

Comparing:
ircd-hybrid/modules/m_stats.c (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid-7.2/modules/m_stats.c (property svn:keywords), Revision 988 by michael, Sun Aug 16 14:00:36 2009 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

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