MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / recordPacketStats

Method recordPacketStats

src/openrct2/network/NetworkConnection.cpp:262–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 }
261
262 void Connection::recordPacketStats(const Packet& packet, bool sending)
263 {
264 uint32_t packetSize = static_cast<uint32_t>(packet.bytesTransferred);
265 StatisticsGroup trafficGroup;
266
267 switch (packet.getCommand())
268 {
269 case Command::gameAction:
270 trafficGroup = StatisticsGroup::commands;
271 break;
272 case Command::map:
273 trafficGroup = StatisticsGroup::mapData;
274 break;
275 default:
276 trafficGroup = StatisticsGroup::base;
277 break;
278 }
279
280 if (sending)
281 {
282 stats.bytesSent[EnumValue(trafficGroup)] += packetSize;
283 stats.bytesSent[EnumValue(StatisticsGroup::total)] += packetSize;
284 }
285 else
286 {
287 stats.bytesReceived[EnumValue(trafficGroup)] += packetSize;
288 stats.bytesReceived[EnumValue(StatisticsGroup::total)] += packetSize;
289 }
290 }
291
292 Command Connection::getPendingPacketCommand() const noexcept
293 {

Callers

nothing calls this directly

Calls 2

EnumValueFunction · 0.85
getCommandMethod · 0.80

Tested by

no test coverage detected