X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/212380e3f42f585dc1ea927402252eb943f91f7b..af81d5a0b09446188fd6f9c292b51519f2c1cedd:/src/s_stats.c diff --git a/src/s_stats.c b/src/s_stats.c index 66ccce9..17a1d6e 100644 --- a/src/s_stats.c +++ b/src/s_stats.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_stats.c 1409 2006-05-21 14:46:17Z jilles $ + * $Id: s_stats.c 3249 2007-03-05 18:51:17Z nenolod $ */ #include "stdinc.h" @@ -65,7 +65,7 @@ tstats(struct Client *source_p) struct Client *target_p; struct ServerStatistics *sp; struct ServerStatistics tmp; - dlink_node *ptr; + rb_dlink_node *ptr; sp = &tmp; memcpy(sp, ServerStats, sizeof(struct ServerStatistics)); @@ -124,7 +124,7 @@ tstats(struct Client *source_p) "T :accepts %u refused %u", sp->is_ac, sp->is_ref); sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :rejected %u delaying %lu", - sp->is_rej, dlink_list_length(&delay_exit)); + sp->is_rej, rb_dlink_list_length(&delay_exit)); sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :nicks being delayed %lu", get_nd_count()); @@ -139,6 +139,9 @@ tstats(struct Client *source_p) sp->is_wrdi, sp->is_empt); sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :numerics seen %u", sp->is_num); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :tgchange blocked msgs %u restricted addrs %lu", + sp->is_tgch, rb_dlink_list_length(&tgchange_list)); sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :auth successes %u fails %u", sp->is_asuc, sp->is_abad); @@ -167,8 +170,8 @@ count_memory(struct Client *source_p) struct Client *target_p; struct Channel *chptr; struct Ban *actualBan; - dlink_node *dlink; - dlink_node *ptr; + rb_dlink_node *rb_dlink; + rb_dlink_node *ptr; int channel_count = 0; int local_client_conf_count = 0; /* local client conf links */ int users_counted = 0; /* user structs */ @@ -180,7 +183,6 @@ count_memory(struct Client *source_p) int channel_invex = 0; int channel_quiets = 0; - size_t wwu = 0; /* whowas users */ int class_count = 0; /* classes */ int conf_count = 0; /* conf lines */ int users_invited_count = 0; /* users invited */ @@ -195,6 +197,7 @@ count_memory(struct Client *source_p) size_t channel_quiet_memory = 0; size_t away_memory = 0; /* memory used by aways */ + size_t ww = 0; /* whowas array count */ size_t wwm = 0; /* whowas array memory used */ size_t conf_memory = 0; /* memory used by conf lines */ size_t mem_servers_cached; /* memory used by scache */ @@ -213,7 +216,7 @@ count_memory(struct Client *source_p) size_t total_memory = 0; - count_whowas_memory(&wwu, &wwm); + count_whowas_memory(&ww, &wwm); DLINK_FOREACH(ptr, global_client_list.head) { @@ -226,8 +229,8 @@ count_memory(struct Client *source_p) if(target_p->user) { users_counted++; - users_invited_count += dlink_list_length(&target_p->user->invited); - user_channels += dlink_list_length(&target_p->user->channel); + users_invited_count += rb_dlink_list_length(&target_p->user->invited); + user_channels += rb_dlink_list_length(&target_p->user->channel); if(target_p->user->away) { aways_counted++; @@ -243,45 +246,45 @@ count_memory(struct Client *source_p) channel_count++; channel_memory += (strlen(chptr->chname) + sizeof(struct Channel)); - channel_users += dlink_list_length(&chptr->members); - channel_invites += dlink_list_length(&chptr->invites); + channel_users += rb_dlink_list_length(&chptr->members); + channel_invites += rb_dlink_list_length(&chptr->invites); - DLINK_FOREACH(dlink, chptr->banlist.head) + DLINK_FOREACH(rb_dlink, chptr->banlist.head) { - actualBan = dlink->data; + actualBan = rb_dlink->data; channel_bans++; - channel_ban_memory += sizeof(dlink_node) + sizeof(struct Ban); + channel_ban_memory += sizeof(rb_dlink_node) + sizeof(struct Ban); } - DLINK_FOREACH(dlink, chptr->exceptlist.head) + DLINK_FOREACH(rb_dlink, chptr->exceptlist.head) { - actualBan = dlink->data; + actualBan = rb_dlink->data; channel_except++; - channel_except_memory += (sizeof(dlink_node) + sizeof(struct Ban)); + channel_except_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban)); } - DLINK_FOREACH(dlink, chptr->invexlist.head) + DLINK_FOREACH(rb_dlink, chptr->invexlist.head) { - actualBan = dlink->data; + actualBan = rb_dlink->data; channel_invex++; - channel_invex_memory += (sizeof(dlink_node) + sizeof(struct Ban)); + channel_invex_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban)); } - DLINK_FOREACH(dlink, chptr->quietlist.head) + DLINK_FOREACH(rb_dlink, chptr->quietlist.head) { - actualBan = dlink->data; + actualBan = rb_dlink->data; channel_quiets++; - channel_quiet_memory += (sizeof(dlink_node) + sizeof(struct Ban)); + channel_quiet_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban)); } } /* count up all classes */ - class_count = dlink_list_length(&class_list) + 1; + class_count = rb_dlink_list_length(&class_list) + 1; count_linebuf_memory(&linebuf_count, &linebuf_memory_used); @@ -290,18 +293,18 @@ count_memory(struct Client *source_p) users_counted, (unsigned long) users_counted * sizeof(struct User), users_invited_count, - (unsigned long) users_invited_count * sizeof(dlink_node)); + (unsigned long) users_invited_count * sizeof(rb_dlink_node)); sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :User channels %u(%lu) Aways %u(%d)", user_channels, - (unsigned long) user_channels * sizeof(dlink_node), + (unsigned long) user_channels * sizeof(rb_dlink_node), aways_counted, (int) away_memory); sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :Attached confs %u(%lu)", local_client_conf_count, - (unsigned long) local_client_conf_count * sizeof(dlink_node)); + (unsigned long) local_client_conf_count * sizeof(rb_dlink_node)); sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :Conflines %u(%d)", conf_count, (int) conf_memory); @@ -325,28 +328,24 @@ count_memory(struct Client *source_p) sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :Channel members %u(%lu) invite %u(%lu)", channel_users, - (unsigned long) channel_users * sizeof(dlink_node), + (unsigned long) channel_users * sizeof(rb_dlink_node), channel_invites, - (unsigned long) channel_invites * sizeof(dlink_node)); + (unsigned long) channel_invites * sizeof(rb_dlink_node)); total_channel_memory = channel_memory + channel_ban_memory + - channel_users * sizeof(dlink_node) + channel_invites * sizeof(dlink_node); - - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "z :Whowas users %ld(%ld)", - (long)wwu, (long) (wwu * sizeof(struct User))); + channel_users * sizeof(rb_dlink_node) + channel_invites * sizeof(rb_dlink_node); sendto_one_numeric(source_p, RPL_STATSDEBUG, - "z :Whowas array %u(%d)", - NICKNAMEHISTORYLENGTH, (int) wwm); + "z :Whowas array %ld(%ld)", + (long)ww, (long)wwm); - totww = wwu * sizeof(struct User) + wwm; + totww = wwm; sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :Hash: client %u(%ld) chan %u(%ld)", - U_MAX, (long)(U_MAX * sizeof(dlink_list)), - CH_MAX, (long)(CH_MAX * sizeof(dlink_list))); + U_MAX, (long)(U_MAX * sizeof(rb_dlink_list)), + CH_MAX, (long)(CH_MAX * sizeof(rb_dlink_list))); sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :linebuf %ld(%ld)", @@ -360,7 +359,7 @@ count_memory(struct Client *source_p) sendto_one_numeric(source_p, RPL_STATSDEBUG, "z :hostname hash %d(%ld)", - HOST_MAX, (long)HOST_MAX * sizeof(dlink_list)); + HOST_MAX, (long)HOST_MAX * sizeof(rb_dlink_list)); total_memory = totww + total_channel_memory + conf_memory + class_count * sizeof(struct Class); @@ -386,8 +385,4 @@ count_memory(struct Client *source_p) "z :Remote client Memory in use: %ld(%ld)", (long)remote_client_count, (long)remote_client_memory_used); - - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "z :TOTAL: %d Available: Current max RSS: %lu", - (int) total_memory, get_maxrss()); }