From a3802dee4bdfcf3dc11df09c59e6ed1912fbadd9 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 18 Jun 2008 20:27:47 +0000 Subject: Measure bandwidth statistics from the socket engine (kiloBITS per second in, out, total) and display them in /stats z plus send them via the named pipe to the windows gui git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9918 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands/cmd_stats.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/commands') diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 1296bf08a..0857adb44 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -201,6 +201,17 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(ServerInstance->Config->RULES.size())); + float kbitpersec_in, kbitpersec_out, kbitpersec_total; + ServerInstance->SE->GetStats(kbitpersec_in, kbitpersec_out, kbitpersec_total); + + snprintf(kbitspersec_total_s, 30, "%03.5f%%", kbitspersec_total); + snprintf(kbitspersec_out_s, 30, "%03.5f%%", kbitspersec_out); + snprintf(kbitspersec_in_s, 30, "%03.5f%%", kbitspersec_in); + + results.push_back(sn+" 249 "+user->nick+" :Bandwidth total: "+ConvToStr(kbitspersec_total_s)+" kilobits/sec"); + results.push_back(sn+" 249 "+user->nick+" :Bandwidth out: "+ConvToStr(kbitspersec_out_s)+" kilobits/sec"); + results.push_back(sn+" 249 "+user->nick+" :Bandwidth in: "+ConvToStr(kbitspersec_in_s)+" kilobits/sec"); + #ifndef WIN32 /* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef. * Also cuts out some identical code in both branches of the ifndef. -- Om -- cgit v1.2.3