summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd_stats.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index f609864a9..5985703ea 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -167,14 +167,34 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
/* stats z (debug and memory info) */
case 'z':
{
+
rusage R;
results.push_back(sn+" 240 "+user->nick+" :InspIRCd(CLASS) "+ConvToStr(sizeof(InspIRCd))+" bytes");
results.push_back(sn+" 249 "+user->nick+" :Users(HASH_MAP) "+ConvToStr(ServerInstance->clientlist->size())+" ("+ConvToStr(ServerInstance->clientlist->size()*sizeof(userrec))+" bytes, "+ConvToStr(ServerInstance->clientlist->bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Channels(HASH_MAP) "+ConvToStr(ServerInstance->chanlist->size())+" ("+ConvToStr(ServerInstance->chanlist->size()*sizeof(chanrec))+" bytes, "+ConvToStr(ServerInstance->chanlist->bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Commands(VECTOR) "+ConvToStr(ServerInstance->Parser->cmdlist.size())+" ("+ConvToStr(ServerInstance->Parser->cmdlist.size()*sizeof(command_t))+" bytes)");
+
+ if (!ServerInstance->Config->WhoWasGroupSize == 0 && !ServerInstance->Config->WhoWasMaxGroups == 0)
+ {
+ int whowas_size = 0;
+ int whowas_bytes = 0;
+ irc::whowas::whowas_users_fifo::iterator iter;
+ for (iter = ServerInstance->whowas_fifo.begin(); iter != ServerInstance->whowas_fifo.end(); iter++)
+ {
+ irc::whowas::whowas_set* n = (irc::whowas::whowas_set*)ServerInstance->whowas.find(iter->second)->second;
+ if (n->size())
+ {
+ whowas_size += n->size();
+ whowas_bytes += (sizeof(irc::whowas::whowas_set) + ( sizeof(irc::whowas::WhoWasGroup) * n->size() ) );
+ }
+ }
+ results.push_back(sn+" 249 "+user->nick+" :Whowas(MAPSETS) "+ConvToStr(whowas_size)+" ("+ConvToStr(whowas_bytes)+" bytes)");
+ }
+
results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(ServerInstance->Config->RULES.size()));
- results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(ServerInstance->modules.size())+" ("+ConvToStr(ServerInstance->modules.size()*sizeof(Module))+")");
- results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(ServerInstance->factory.size())+" ("+ConvToStr(ServerInstance->factory.size()*sizeof(ircd_module))+")");
+ results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(ServerInstance->modules.size())+" ("+ConvToStr(ServerInstance->modules.size()*sizeof(Module))+") bytes");
+ results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(ServerInstance->factory.size())+" ("+ConvToStr(ServerInstance->factory.size()*sizeof(ircd_module))+") bytes");
+
if (!getrusage(0,&R)) /* RUSAGE_SELF */
{
results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr(R.ru_maxrss)+"K");