Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ MCCP on SWRIP1.0, SWR, or SMAUG

MCCP on SWRIP1.0, SWR, or SMAUG

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kasji   (35 posts)  Bio
Date Tue 14 Jun 2005 09:48 PM (UTC)
Message
Does anyone know how to add MCCP compression stats to a statistics command? I just used a patch to install the MCCP, though I had to do it manually, no autopatching such a heavily modified code.

I'm looking to see the total bytes compressed out and in if possible, and the compression ratio. Anyone know if this information is stored somewhere already, or if it has to be added from scratch?
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Tue 14 Jun 2005 10:28 PM (UTC)
Message
Well I know MUSHclient shows that data, but I don't know any snippets for the actual MUD.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Wed 15 Jun 2005 02:53 AM (UTC)
Message
I think the MCCP snippets just compress the data. I'm pretty sure they have the before/after sizes there (you need them to compress/send, after all), but I imagine that you'll have to compute the ratios and store it all manually.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #3 on Wed 15 Jun 2005 02:05 PM (UTC)
Message
This is the code that I use for my compression stats, feel free to take and modify:

                send_to_char("Compression Info:\n\r", ch);
                send_to_char("Compression: &B[&w", ch);
                if (IS_MXP(ch))
                        send_to_char(MXPTAG("mxptoggle compress"), ch);
                if (ch->desc->compressing)
                        send_to_char("ON ", ch);
                else
                {
                        send_to_char("OFF", ch);
                }
                if (IS_MXP(ch))
                        send_to_char(MXPTAG("/mxptoggle"), ch);
                send_to_char("&B]&D\n\r", ch);
                if (ch->desc->out_compress
                    && ch->desc->out_compress->total_in)
                        ch_printf(ch,
                                  "Total size of input compressed:  &B[&w%d&B]&D\n\r",
                                  ch->desc->out_compress->total_in);
                if (ch->desc->out_compress
                    && ch->desc->out_compress->total_out)
                        ch_printf(ch,
                                  "Total size of output compressed: &B[&w%d&B]&D\n\r",
                                  ch->desc->out_compress->total_out);
                if (ch->desc->out_compress && ch->desc->out_compress->total_in
                    && ch->desc->out_compress->total_out)
                        ch_printf(ch,
                                  "Current compression ratio:       &B[&w%.2f%&B]&D&D\n\r",
                                  (float) ((float) ch->desc->out_compress->
                                           total_out /
                                           (float) ch->desc->out_compress->
                                           total_in * 100));


I also know that the casting is terrible, I just never got around to fixing it... love that pedantic flag.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Wed 15 Jun 2005 06:24 PM (UTC)
Message
You actually don't need to cast both operands of a multiplication/division to float/double to get double precision. If the compiler detects that just one of them is floating point, it'll use fp-math. I tend to cast both as well, but it can sometimes save space.

Also, C++ lets you use the (IMO, at least) nicer format of casting: float(foo) instead of (float) foo. (Well, technically this isn't a cast, but it has the same effects.) Not sure if you're using C++ or not; I think I remember something about you moving to it a while ago. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,393 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.