Added temporary debug statistics of the RelEntMoveLook packet removal efficiency
git-svn-id: http://mc-server.googlecode.com/svn/trunk@740 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
16dda8e037
commit
5bc07ba743
@ -1298,11 +1298,14 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Optimize away multiple queued RelativeEntityMoveLook packets:
|
// Optimize away multiple queued RelativeEntityMoveLook packets:
|
||||||
|
static int NumRelEntMoveLookTotal = 0;
|
||||||
|
static int NumRelEntMoveLookRemoved = 0;
|
||||||
cCSLock Lock(m_CSPackets);
|
cCSLock Lock(m_CSPackets);
|
||||||
if (a_Priority == E_PRIORITY_NORMAL)
|
if (a_Priority == E_PRIORITY_NORMAL)
|
||||||
{
|
{
|
||||||
if (a_Packet.m_PacketID == E_REL_ENT_MOVE_LOOK)
|
if (a_Packet.m_PacketID == E_REL_ENT_MOVE_LOOK)
|
||||||
{
|
{
|
||||||
|
NumRelEntMoveLookTotal++;
|
||||||
PacketList & Packets = m_PendingNrmSendPackets;
|
PacketList & Packets = m_PendingNrmSendPackets;
|
||||||
const cPacket_RelativeEntityMoveLook & ThisPacketData = reinterpret_cast< const cPacket_RelativeEntityMoveLook &>(a_Packet);
|
const cPacket_RelativeEntityMoveLook & ThisPacketData = reinterpret_cast< const cPacket_RelativeEntityMoveLook &>(a_Packet);
|
||||||
for (PacketList::iterator itr = Packets.begin(); itr != Packets.end(); ++itr)
|
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);
|
Packets.erase(itr);
|
||||||
bBreak = true;
|
bBreak = true;
|
||||||
delete PacketData;
|
delete PacketData;
|
||||||
|
NumRelEntMoveLookRemoved++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1328,6 +1332,14 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // for itr - Packets[]
|
} // 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
|
} // if (E_REL_ENT_MOVE_LOOK
|
||||||
m_PendingNrmSendPackets.push_back(a_Packet.Clone());
|
m_PendingNrmSendPackets.push_back(a_Packet.Clone());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user