summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-13 15:03:56 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-13 15:03:56 +0200
commit12027601cf4422366b0cef632ff0158c9410cc9a (patch)
treefa259bed522394e1acd2bf1ef34ae6610fda2ffe /src/coremods
parentc7759c765cdd3eb086daedd3222d2d8d67791147 (diff)
Change allocation of InspIRCd::stats to be physically part of the object containing it
While at it, remove "stats" from all field names
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_dns.cpp10
-rw-r--r--src/coremods/core_hostname_lookup.cpp4
-rw-r--r--src/coremods/core_stats.cpp22
3 files changed, 18 insertions, 18 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 30c736757..17e489794 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -603,7 +603,7 @@ class MyManager : public Manager, public Timer, public EventHandler
if (recv_packet.flags & QUERYFLAGS_OPCODE)
{
ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "Resolver: Received a nonstandard query");
- ServerInstance->stats->statsDnsBad++;
+ ServerInstance->stats.DnsBad++;
recv_packet.error = ERROR_NONSTANDARD_QUERY;
request->OnError(&recv_packet);
}
@@ -637,26 +637,26 @@ class MyManager : public Manager, public Timer, public EventHandler
break;
}
- ServerInstance->stats->statsDnsBad++;
+ ServerInstance->stats.DnsBad++;
recv_packet.error = error;
request->OnError(&recv_packet);
}
else if (recv_packet.questions.empty() || recv_packet.answers.empty())
{
ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "Resolver: No resource records returned");
- ServerInstance->stats->statsDnsBad++;
+ ServerInstance->stats.DnsBad++;
recv_packet.error = ERROR_NO_RECORDS;
request->OnError(&recv_packet);
}
else
{
ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "Resolver: Lookup complete for " + request->name);
- ServerInstance->stats->statsDnsGood++;
+ ServerInstance->stats.DnsGood++;
request->OnLookupComplete(&recv_packet);
this->AddCache(recv_packet);
}
- ServerInstance->stats->statsDns++;
+ ServerInstance->stats.Dns++;
/* Request's destructor removes it from the request map */
delete request;
diff --git a/src/coremods/core_hostname_lookup.cpp b/src/coremods/core_hostname_lookup.cpp
index 3d3e9703a..7f3f23149 100644
--- a/src/coremods/core_hostname_lookup.cpp
+++ b/src/coremods/core_hostname_lookup.cpp
@@ -170,7 +170,7 @@ class UserResolver : public DNS::Request
{
bound_user->WriteNotice("*** Could not resolve your hostname: " + this->manager->GetErrorStr(query->error) + "; using your IP address (" + bound_user->GetIPString() + ") instead.");
dl->set(bound_user, 0);
- ServerInstance->stats->statsDnsBad++;
+ ServerInstance->stats.DnsBad++;
}
}
};
@@ -215,7 +215,7 @@ class ModuleHostnameLookup : public Module
this->dnsLookup.set(user, 0);
delete res_reverse;
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason());
- ServerInstance->stats->statsDnsBad++;
+ ServerInstance->stats.DnsBad++;
}
}
diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp
index e0e5b3a0f..b8ea21731 100644
--- a/src/coremods/core_stats.cpp
+++ b/src/coremods/core_stats.cpp
@@ -236,9 +236,9 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
char percent[30];
- float n_elapsed = (ServerInstance->Time() - ServerInstance->stats->LastSampled.tv_sec) * 1000000
- + (ServerInstance->Time_ns() - ServerInstance->stats->LastSampled.tv_nsec) / 1000;
- float n_eaten = ((R.ru_utime.tv_sec - ServerInstance->stats->LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - ServerInstance->stats->LastCPU.tv_usec);
+ float n_elapsed = (ServerInstance->Time() - ServerInstance->stats.LastSampled.tv_sec) * 1000000
+ + (ServerInstance->Time_ns() - ServerInstance->stats.LastSampled.tv_nsec) / 1000;
+ float n_eaten = ((R.ru_utime.tv_sec - ServerInstance->stats.LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - ServerInstance->stats.LastCPU.tv_usec);
float per = (n_eaten / n_elapsed) * 100;
snprintf(percent, 30, "%03.5f%%", per);
@@ -269,8 +269,8 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
{
KernelTime.dwHighDateTime += UserTime.dwHighDateTime;
KernelTime.dwLowDateTime += UserTime.dwLowDateTime;
- double n_eaten = (double)( ( (uint64_t)(KernelTime.dwHighDateTime - ServerInstance->stats->LastCPU.dwHighDateTime) << 32 ) + (uint64_t)(KernelTime.dwLowDateTime - ServerInstance->stats->LastCPU.dwLowDateTime) )/100000;
- double n_elapsed = (double)(ThisSample.QuadPart - ServerInstance->stats->LastSampled.QuadPart) / ServerInstance->stats->QPFrequency.QuadPart;
+ double n_eaten = (double)( ( (uint64_t)(KernelTime.dwHighDateTime - ServerInstance->stats.LastCPU.dwHighDateTime) << 32 ) + (uint64_t)(KernelTime.dwLowDateTime - ServerInstance->stats.LastCPU.dwLowDateTime) )/100000;
+ double n_elapsed = (double)(ThisSample.QuadPart - ServerInstance->stats.LastSampled.QuadPart) / ServerInstance->stats.QPFrequency.QuadPart;
double per = (n_eaten/n_elapsed);
char percent[30];
@@ -290,13 +290,13 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
case 'T':
{
- results.push_back("249 "+user->nick+" :accepts "+ConvToStr(ServerInstance->stats->statsAccept)+" refused "+ConvToStr(ServerInstance->stats->statsRefused));
- results.push_back("249 "+user->nick+" :unknown commands "+ConvToStr(ServerInstance->stats->statsUnknown));
- results.push_back("249 "+user->nick+" :nick collisions "+ConvToStr(ServerInstance->stats->statsCollisions));
- results.push_back("249 "+user->nick+" :dns requests "+ConvToStr(ServerInstance->stats->statsDnsGood+ServerInstance->stats->statsDnsBad)+" succeeded "+ConvToStr(ServerInstance->stats->statsDnsGood)+" failed "+ConvToStr(ServerInstance->stats->statsDnsBad));
- results.push_back("249 "+user->nick+" :connection count "+ConvToStr(ServerInstance->stats->statsConnects));
+ results.push_back("249 "+user->nick+" :accepts "+ConvToStr(ServerInstance->stats.Accept)+" refused "+ConvToStr(ServerInstance->stats.Refused));
+ results.push_back("249 "+user->nick+" :unknown commands "+ConvToStr(ServerInstance->stats.Unknown));
+ results.push_back("249 "+user->nick+" :nick collisions "+ConvToStr(ServerInstance->stats.Collisions));
+ results.push_back("249 "+user->nick+" :dns requests "+ConvToStr(ServerInstance->stats.DnsGood+ServerInstance->stats.DnsBad)+" succeeded "+ConvToStr(ServerInstance->stats.DnsGood)+" failed "+ConvToStr(ServerInstance->stats.DnsBad));
+ results.push_back("249 "+user->nick+" :connection count "+ConvToStr(ServerInstance->stats.Connects));
results.push_back(InspIRCd::Format("249 %s :bytes sent %5.2fK recv %5.2fK", user->nick.c_str(),
- ServerInstance->stats->statsSent / 1024.0, ServerInstance->stats->statsRecv / 1024.0));
+ ServerInstance->stats.Sent / 1024.0, ServerInstance->stats.Recv / 1024.0));
}
break;