From: Valery Yatsko Date: Wed, 2 Apr 2008 12:04:43 +0000 (+0400) Subject: tstats stuff gone to m_stats.c X-Git-Tag: charybdis-3.0.0-beta1~156 X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/commitdiff_plain/8750c6e6b75203c587d0b318250ea08b24df92a8 tstats stuff gone to m_stats.c --- diff --git a/include/s_stats.h b/include/s_stats.h index d65f165..2c611a4 100644 --- a/include/s_stats.h +++ b/include/s_stats.h @@ -76,9 +76,6 @@ struct ServerStatistics extern struct ServerStatistics ServerStats; -extern void init_stats(void); -extern void tstats(struct Client *client); - extern void count_memory(struct Client *); #endif /* INCLUDED_s_stats_h */ diff --git a/modules/m_stats.c b/modules/m_stats.c index f264e35..94b367f 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -924,10 +924,73 @@ stats_usage (struct Client *source_p) (int) rus.ru_nivcsw); } -static void -stats_tstats (struct Client *source_p) -{ - tstats (source_p); +static void +stats_tstats(struct Client *source_p) +{ + struct Client *target_p; + struct ServerStatistics sp; + rb_dlink_node *ptr; + + memcpy(&sp, &ServerStats, sizeof(struct ServerStatistics)); + + RB_DLINK_FOREACH(ptr, serv_list.head) + { + target_p = ptr->data; + + sp.is_sbs += target_p->localClient->sendB; + sp.is_sbr += target_p->localClient->receiveB; + sp.is_sti += rb_current_time() - target_p->localClient->firsttime; + sp.is_sv++; + } + + RB_DLINK_FOREACH(ptr, lclient_list.head) + { + target_p = ptr->data; + + sp.is_cbs += target_p->localClient->sendB; + sp.is_cbr += target_p->localClient->receiveB; + sp.is_cti += rb_current_time() - target_p->localClient->firsttime; + sp.is_cl++; + } + + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "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, delay_exit_length()); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :nicks being delayed %lu", get_nd_count()); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :unknown commands %u prefixes %u", + sp.is_unco, sp.is_unpf); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :nick collisions %u saves %u unknown closes %u", + sp.is_kill, sp.is_save, sp.is_ni); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :wrong direction %u empty %u", + 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 :auth successes %u fails %u", + sp.is_asuc, sp.is_abad); + sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :Client Server"); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :connected %u %u", + sp.is_cl, sp.is_sv); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :bytes sent %lluK %lluK", + sp.is_cbs / 1024, + sp.is_sbs / 1024); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :bytes recv %lluK %lluK", + sp.is_cbr / 1024, + sp.is_sbr / 1024); + sendto_one_numeric(source_p, RPL_STATSDEBUG, + "T :time connected %lu %lu", + sp.is_cti, sp.is_sti); } static void diff --git a/src/ircd.c b/src/ircd.c index b369b7e..e3c2cb9 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -578,7 +578,6 @@ main(int argc, char *argv[]) init_channels(); initclass(); initwhowas(); - init_stats(); init_reject(); init_cache(); init_monitor(); diff --git a/src/s_stats.c b/src/s_stats.c index 42e4dec..86bf37f 100644 --- a/src/s_stats.c +++ b/src/s_stats.c @@ -43,88 +43,6 @@ */ struct ServerStatistics ServerStats; -void -init_stats() -{ - /* XXX nothing to do - was ServerStats init -- dwr */ -} - -/* - * tstats - * - * inputs - client to report to - * output - NONE - * side effects - - */ -void -tstats(struct Client *source_p) -{ - struct Client *target_p; - struct ServerStatistics sp; - rb_dlink_node *ptr; - - memcpy(&sp, &ServerStats, sizeof(struct ServerStatistics)); - - RB_DLINK_FOREACH(ptr, serv_list.head) - { - target_p = ptr->data; - - sp.is_sbs += target_p->localClient->sendB; - sp.is_sbr += target_p->localClient->receiveB; - sp.is_sti += rb_current_time() - target_p->localClient->firsttime; - sp.is_sv++; - } - - RB_DLINK_FOREACH(ptr, lclient_list.head) - { - target_p = ptr->data; - - sp.is_cbs += target_p->localClient->sendB; - sp.is_cbr += target_p->localClient->receiveB; - sp.is_cti += rb_current_time() - target_p->localClient->firsttime; - sp.is_cl++; - } - - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "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, delay_exit_length()); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :nicks being delayed %lu", get_nd_count()); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :unknown commands %u prefixes %u", - sp.is_unco, sp.is_unpf); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :nick collisions %u saves %u unknown closes %u", - sp.is_kill, sp.is_save, sp.is_ni); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :wrong direction %u empty %u", - 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 :auth successes %u fails %u", - sp.is_asuc, sp.is_abad); - sendto_one_numeric(source_p, RPL_STATSDEBUG, "T :Client Server"); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :connected %u %u", - sp.is_cl, sp.is_sv); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :bytes sent %lluK %lluK", - sp.is_cbs / 1024, - sp.is_sbs / 1024); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :bytes recv %lluK %lluK", - sp.is_cbr / 1024, - sp.is_sbr / 1024); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "T :time connected %lu %lu", - sp.is_cti, sp.is_sti); -} - void count_memory(struct Client *source_p) {