summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-15 22:37:08 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-15 22:37:08 +0200
commit5bc07ba7435f7b251063a6143da54546928ac48a (patch)
treedbdbe5438f3540ca5684bdbd4b59e975db3c0d4e /source
parentConsole command "chunkstats" now lists each world and also totals (diff)
downloadcuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar.gz
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar.bz2
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar.lz
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar.xz
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.tar.zst
cuberite-5bc07ba7435f7b251063a6143da54546928ac48a.zip
Diffstat (limited to 'source')
-rw-r--r--source/cClientHandle.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index b1a90f5b8..916fd781d 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -1298,11 +1298,14 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
}
// Optimize away multiple queued RelativeEntityMoveLook packets:
+ static int NumRelEntMoveLookTotal = 0;
+ static int NumRelEntMoveLookRemoved = 0;
cCSLock Lock(m_CSPackets);
if (a_Priority == E_PRIORITY_NORMAL)
{
if (a_Packet.m_PacketID == E_REL_ENT_MOVE_LOOK)
{
+ NumRelEntMoveLookTotal++;
PacketList & Packets = m_PendingNrmSendPackets;
const cPacket_RelativeEntityMoveLook & ThisPacketData = reinterpret_cast< const cPacket_RelativeEntityMoveLook &>(a_Packet);
for (PacketList::iterator itr = Packets.begin(); itr != Packets.end(); ++itr)
@@ -1318,6 +1321,7 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
Packets.erase(itr);
bBreak = true;
delete PacketData;
+ NumRelEntMoveLookRemoved++;
break;
}
break;
@@ -1328,6 +1332,14 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
break;
}
} // for itr - Packets[]
+ if ((NumRelEntMoveLookTotal % 1000) == 10) // print out a debug statistics every 1000 packets sent
+ {
+ LOGD("RelEntMoveLook optimization: removed %d out of %d packets, saved %d bytes (%d KiB) of bandwidth",
+ NumRelEntMoveLookRemoved, NumRelEntMoveLookTotal,
+ NumRelEntMoveLookRemoved * sizeof(cPacket_RelativeEntityMoveLook),
+ NumRelEntMoveLookRemoved * sizeof(cPacket_RelativeEntityMoveLook) / 1024
+ );
+ }
} // if (E_REL_ENT_MOVE_LOOK
m_PendingNrmSendPackets.push_back(a_Packet.Clone());
}