summaryrefslogtreecommitdiff
path: root/src/commands/cmd_stats.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-06-18 20:27:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-06-18 20:27:47 +0000
commita3802dee4bdfcf3dc11df09c59e6ed1912fbadd9 (patch)
tree0c8a3cc293f02828aebedbbb1f5228cd627f3b2a /src/commands/cmd_stats.cpp
parented6fcd4a50f3a0d84ae07a8a0011b193e00cf088 (diff)
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
Diffstat (limited to 'src/commands/cmd_stats.cpp')
-rw-r--r--src/commands/cmd_stats.cpp11
1 files changed, 11 insertions, 0 deletions
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