diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-24 01:43:19 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-24 01:43:19 +0000 |
commit | 397a77259a21f730c8fe06d2df65ecf51119549c (patch) | |
tree | 0566e2778dbc76c08430e607a42ec6dfa79e9d5e /src | |
parent | c78bff4fb1592f75206093a9d3d7b2100366a569 (diff) |
Add whowas usage to stats z.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6090 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd_stats.cpp | 24 |
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"); |