]> jfr.im git - solanum.git/commitdiff
Working over zipstats bug and moving on the new ServerStats struct (without Kb counti...
authorValery Yatsko <redacted>
Tue, 8 Apr 2008 14:00:38 +0000 (18:00 +0400)
committerValery Yatsko <redacted>
Tue, 8 Apr 2008 14:00:38 +0000 (18:00 +0400)
include/client.h
include/s_stats.h
modules/m_stats.c
src/client.c

index d38b5b7f23f2cb5f11601ffe415cf48c65726ff4..a37f9460de95b53da27f573888114e9079320439 100644 (file)
@@ -111,15 +111,11 @@ struct Server
 
 struct ZipStats
 {
-       unsigned long in;
-       unsigned long in_wire;
-       unsigned long out;
-       unsigned long out_wire;
-       unsigned long inK;
-       unsigned long inK_wire;
-       unsigned long outK;
-       unsigned long outK_wire;
-       double in_ratio;
+       unsigned long long in;\r
+       unsigned long long in_wire;\r
+       unsigned long long out;\r
+       unsigned long long out_wire;\r
+       double in_ratio;\r
        double out_ratio;
 };
 
index b4757d5ab7fc5e62c4746a8811b0cee6ccd5a27b..bf1b4efe6219620c773a0c24061a79fbb0808a70 100644 (file)
@@ -45,14 +45,10 @@ struct ServerStatistics
        unsigned int is_cl;     /* number of client connections */
        unsigned int is_sv;     /* number of server connections */
        unsigned int is_ni;     /* connection but no idea who it was */
-       unsigned short is_cbs;  /* bytes sent to clients */
-       unsigned short is_cbr;  /* bytes received to clients */
-       unsigned short is_sbs;  /* bytes sent to servers */
-       unsigned short is_sbr;  /* bytes received to servers */
-       unsigned long is_cks;   /* k-bytes sent to clients */
-       unsigned long is_ckr;   /* k-bytes received to clients */
-       unsigned long is_sks;   /* k-bytes sent to servers */
-       unsigned long is_skr;   /* k-bytes received to servers */
+       unsigned long long int is_cbs;  /* bytes sent to clients */\r
+       unsigned long long int is_cbr;  /* bytes received to clients */\r
+       unsigned long long int is_sbs;  /* bytes sent to servers */\r
+       unsigned long long int is_sbr;  /* bytes received to servers */
        time_t is_cti;          /* time spent connected by clients */
        time_t is_sti;          /* time spent connected by servers */
        unsigned int is_ac;     /* connections accepted */
index 65f13358bd91369f561fc893fbe807c79d999610..89b6aee3bbe22d4c1353ee131c90c2c87f07ba1a 100644 (file)
@@ -1445,31 +1445,25 @@ stats_ziplinks (struct Client *source_p)
 {
        rb_dlink_node *ptr;
        struct Client *target_p;
+       struct ZipStats *zipstats;
        int sent_data = 0;
        char buf[128], buf1[128];
-
        RB_DLINK_FOREACH (ptr, serv_list.head)
        {
                target_p = ptr->data;
                if(IsCapable (target_p, CAP_ZIP))
                {
-                       /* we use memcpy(3) and a local copy of the structure to
-                        * work around a register use bug on GCC on the SPARC.
-                        * -jmallett, 04/27/2002
-                        */
-                       struct ZipStats zipstats;
-                       memcpy (&zipstats, &target_p->localClient->zipstats,
-                               sizeof (struct ZipStats)); 
-                       snprintf(buf, sizeof buf, "%.2f%%", zipstats.out_ratio);
-                       snprintf(buf1, sizeof buf1, "%.2f%%", zipstats.in_ratio);
-
+                       zipstats = target_p->localClient->zipstats;                             
+                       sprintf(buf, "%.2f%%", zipstats->out_ratio);
+                       sprintf(buf1, "%.2f%%", zipstats->in_ratio);
                        sendto_one_numeric(source_p, RPL_STATSDEBUG,
                                            "Z :ZipLinks stats for %s send[%s compression "
-                                           "(%lu kB data/%lu kB wire)] recv[%s compression "
-                                           "(%lu kB data/%lu kB wire)]",
+                                           "(%llu kB data/%llu kB wire)] recv[%s compression "
+                                           "(%llu kB data/%llu kB wire)]",
                                            target_p->name,
-                                           buf, zipstats.outK, zipstats.outK_wire,
-                                           buf1, zipstats.inK, zipstats.inK_wire);
+                                           buf, zipstats->out >> 10, 
+                                           zipstats->out_wire >> 10, buf1, 
+                                           zipstats->in >> 10, zipstats->in_wire >> 10);
                        sent_data++;
                }
        }
index 06e051c191506ee614bf2abc8d8df44e5a25e041..b383dbee98edc011e055a5fabee3256040991757 100644 (file)
@@ -2037,22 +2037,10 @@ close_connection(struct Client *client_p)
        {
                struct server_conf *server_p;
 
-               ServerStats.is_sv++;
-               ServerStats.is_sbs += client_p->localClient->sendB;
-               ServerStats.is_sbr += client_p->localClient->receiveB;
-               ServerStats.is_sks += client_p->localClient->sendK;
-               ServerStats.is_skr += client_p->localClient->receiveK;
+               ServerStats.is_sv++;\r
+               ServerStats.is_sbs += client_p->localClient->sendB;\r
+               ServerStats.is_sbr += client_p->localClient->receiveB;\r
                ServerStats.is_sti += rb_current_time() - client_p->localClient->firsttime;
-               if(ServerStats.is_sbs > 2047)
-               {
-                       ServerStats.is_sks += (ServerStats.is_sbs >> 10);
-                       ServerStats.is_sbs &= 0x3ff;
-               }
-               if(ServerStats.is_sbr > 2047)
-               {
-                       ServerStats.is_skr += (ServerStats.is_sbr >> 10);
-                       ServerStats.is_sbr &= 0x3ff;
-               }
 
                /*
                 * If the connection has been up for a long amount of time, schedule
@@ -2075,22 +2063,10 @@ close_connection(struct Client *client_p)
        }
        else if(IsClient(client_p))
        {
-               ServerStats.is_cl++;
-               ServerStats.is_cbs += client_p->localClient->sendB;
-               ServerStats.is_cbr += client_p->localClient->receiveB;
-               ServerStats.is_cks += client_p->localClient->sendK;
-               ServerStats.is_ckr += client_p->localClient->receiveK;
+               ServerStats.is_cl++;\r
+               ServerStats.is_cbs += client_p->localClient->sendB;\r
+               ServerStats.is_cbr += client_p->localClient->receiveB;\r
                ServerStats.is_cti += rb_current_time() - client_p->localClient->firsttime;
-               if(ServerStats.is_cbs > 2047)
-               {
-                       ServerStats.is_cks += (ServerStats.is_cbs >> 10);
-                       ServerStats.is_cbs &= 0x3ff;
-               }
-               if(ServerStats.is_cbr > 2047)
-               {
-                       ServerStats.is_ckr += (ServerStats.is_cbr >> 10);
-                       ServerStats.is_cbr &= 0x3ff;
-               }
        }
        else
                ServerStats.is_ni++;