diff options
-rw-r--r-- | src/commands/cmd_stats.cpp | 26 | ||||
-rw-r--r-- | win/inspircd_namedpipe.cpp | 7 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 7cb2586a7..f9bb0d634 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -13,14 +13,16 @@ #include "inspircd.h" #ifndef WIN32 -#include <sys/resource.h> - -/* This is just to be completely certain that the change which fixed getrusage on RH7 doesn't break anything else -- Om */ -#ifndef RUSAGE_SELF -#define RUSAGE_SELF 0 + #include <sys/resource.h> + /* This is just to be completely certain that the change which fixed getrusage on RH7 doesn't break anything else -- Om */ + #ifndef RUSAGE_SELF + #define RUSAGE_SELF 0 + #endif +#else + #include <psapi.h> + #pragma comment(lib, "psapi.lib") #endif -#endif #include "xline.h" #include "commands/cmd_stats.h" #include "commands/cmd_whowas.h" @@ -206,13 +208,13 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str 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); + snprintf(kbitpersec_total_s, 30, "%03.5f%%", kbitpersec_total); + snprintf(kbitpersec_out_s, 30, "%03.5f%%", kbitpersec_out); + snprintf(kbitpersec_in_s, 30, "%03.5f%%", kbitpersec_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"); + results.push_back(sn+" 249 "+user->nick+" :Bandwidth total: "+ConvToStr(kbitpersec_total_s)+" kilobits/sec"); + results.push_back(sn+" 249 "+user->nick+" :Bandwidth out: "+ConvToStr(kbitpersec_out_s)+" kilobits/sec"); + results.push_back(sn+" 249 "+user->nick+" :Bandwidth in: "+ConvToStr(kbitpersec_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. diff --git a/win/inspircd_namedpipe.cpp b/win/inspircd_namedpipe.cpp index f86b70c1e..3f0f47fdf 100644 --- a/win/inspircd_namedpipe.cpp +++ b/win/inspircd_namedpipe.cpp @@ -63,7 +63,6 @@ void IPCThread::Run() std::stringstream stat;
DWORD Written = 0;
float kbitpersec_in, kbitpersec_out, kbitpersec_total;
- char kbitpersec_in_s[30], kbitpersec_out_s[30], kbitpersec_total_s[30];
PROCESS_MEMORY_COUNTERS MemCounters;
@@ -81,9 +80,9 @@ void IPCThread::Run() stat << "pid " << GetProcessId(GetCurrentProcess()) << std::endl;
stat << "request " << oldrequest << std::endl;
stat << "result " << this->GetResult() << std::endl;
- stat << "kbitspersectotal " << kbitpersec_total_s << std::endl;
- stat << "kbitspersecout " << kbitpersec_out_s << std::endl;
- stat << "kbitspersecin " << kbitpersec_in_s << std::endl;
+ stat << "kbitspersectotal " << kbitpersec_total << std::endl;
+ stat << "kbitspersecout " << kbitpersec_out << std::endl;
+ stat << "kbitspersecin " << kbitpersec_in << std::endl;
if (HaveMemoryStats)
{
stat << "workingset " << MemCounters.WorkingSetSize << std::endl;
|