Added packet stats

This commit is contained in:
KimLS
2019-03-11 15:24:32 -07:00
parent 675a67b676
commit 67b228a91c
6 changed files with 70 additions and 1 deletions
+20 -1
View File
@@ -9489,7 +9489,8 @@ void command_netstats(Client *c, const Seperator *sep)
auto connection = c->Connection();
auto &opts = connection->GetRawConnection()->GetManager()->GetOptions();
auto stats = connection->GetRawConnection()->GetStats();
auto eqs_stats = connection->GetStats();
auto &stats = eqs_stats.DaybreakStats;
auto now = EQ::Net::Clock::now();
auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(now - stats.created).count();
@@ -9520,6 +9521,24 @@ void command_netstats(Client *c, const Seperator *sep)
c->Message(0, "Outgoing Link Saturation %.2f%% (%.2fkb/sec)", 100.0 * (1.0 - ((opts.outgoing_data_rate - stats.datarate_remaining) / opts.outgoing_data_rate)), opts.outgoing_data_rate);
}
c->Message(0, "--------------------------------------------------------------------");
c->Message(0, "Sent Packet Types");
for (auto i = 0; i < _maxEmuOpcode; ++i) {
auto cnt = eqs_stats.SentCount[i];
if (cnt > 0) {
c->Message(0, "%s: %u", OpcodeNames[i], cnt);
}
}
c->Message(0, "--------------------------------------------------------------------");
c->Message(0, "Recv Packet Types");
for (auto i = 0; i < _maxEmuOpcode; ++i) {
auto cnt = eqs_stats.RecvCount[i];
if (cnt > 0) {
c->Message(0, "%s: %u", OpcodeNames[i], cnt);
}
}
c->Message(0, "--------------------------------------------------------------------");
}
}