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. |