[Opentnl-cvs] tnl/tnl connectionStringTable.cpp,1.1,1.2 eventConnection.cpp,1.1,1.2 ghostConnection.
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-05-12 19:35:25
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22462/tnl Modified Files: connectionStringTable.cpp eventConnection.cpp ghostConnection.cpp netBase.cpp tnlNetBase.h Log Message: Fixed bug in connection string table causing strings to never be sent in compressed form Added bandwidth usage logging per net class Substantially reduced object update size in Zap Index: tnlNetBase.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlNetBase.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnlNetBase.h 20 Apr 2004 04:27:18 -0000 1.1 --- tnlNetBase.h 12 May 2004 19:35:11 -0000 1.2 *************** *** 197,200 **** --- 197,205 ---- char *mClassName; ///< The unmangled name of the class. + U32 mInitialUpdateBitsUsed; ///< Number of bits used on initial updates of objects of this class. + U32 mPartialUpdateBitsUsed; ///< Number of bits used on partial updates of objects of this class. + U32 mInitialUpdateCount; ///< Number of objects of this class constructed over a connection. + U32 mPartialUpdateCount; ///< Number of objects of this class updated over a connection. + /// Next declared NetClassRep. /// *************** *** 231,234 **** --- 236,253 ---- const char *getClassName() const; ///< Returns the string class name. + /// Records bits used in the initial update of objects of this class. + void addInitialUpdate(U32 bitCount) + { + mInitialUpdateCount++; + mInitialUpdateBitsUsed += bitCount; + } + + /// Records bits used in a partial update of an object of this class. + void addPartialUpdate(U32 bitCount) + { + mPartialUpdateCount++; + mPartialUpdateBitsUsed += bitCount; + } + virtual Object *create() const = 0; ///< Creates an instance of the class this represents. *************** *** 252,255 **** --- 271,276 ---- static void initialize(); + /// Logs the bit usage information of all the NetClassReps + static void logBitUsage(); }; Index: connectionStringTable.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/connectionStringTable.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** connectionStringTable.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- connectionStringTable.cpp 12 May 2004 19:35:11 -0000 1.2 *************** *** 100,104 **** entry->stringTableEntry = sendEntry; ! entry->string = entry->string; entry->nextInPacket = NULL; --- 100,104 ---- entry->stringTableEntry = sendEntry; ! entry->string = sendEntry->string; entry->nextInPacket = NULL; Index: eventConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/eventConnection.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** eventConnection.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- eventConnection.cpp 12 May 2004 19:35:11 -0000 1.2 *************** *** 304,318 **** prevSeq = ev->mSeqCount; - S32 start = bstream->getBitPosition(); if(mConnectionParameters.mDebugObjectSizes) bstream->advanceBitPosition(BitStreamPosBitSize); S32 classId = ev->mEvent->getClassId(getNetClassGroup()); bstream->writeInt(classId, mEventClassBitSize); ev->mEvent->pack(this, bstream); TNLLogMessageV(LogEventConnection, ("EventConnection %s: WroteEvent %s - %d bits", getNetAddressString(), ev->mEvent->getDebugName(), bstream->getBitPosition() - start)); if(mConnectionParameters.mDebugObjectSizes) ! bstream->writeIntAt(bstream->getBitPosition(), BitStreamPosBitSize, start); } for(EventNote *ev = packQueueHead; ev; ev = ev->mNextEvent) --- 304,321 ---- prevSeq = ev->mSeqCount; if(mConnectionParameters.mDebugObjectSizes) bstream->advanceBitPosition(BitStreamPosBitSize); + S32 start = bstream->getBitPosition(); + S32 classId = ev->mEvent->getClassId(getNetClassGroup()); bstream->writeInt(classId, mEventClassBitSize); ev->mEvent->pack(this, bstream); + + ev->mEvent->getClassRep()->addInitialUpdate(bstream->getBitPosition() - start); TNLLogMessageV(LogEventConnection, ("EventConnection %s: WroteEvent %s - %d bits", getNetAddressString(), ev->mEvent->getDebugName(), bstream->getBitPosition() - start)); if(mConnectionParameters.mDebugObjectSizes) ! bstream->writeIntAt(bstream->getBitPosition(), BitStreamPosBitSize, start - BitStreamPosBitSize); } for(EventNote *ev = packQueueHead; ev; ev = ev->mNextEvent) Index: netBase.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/netBase.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** netBase.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- netBase.cpp 12 May 2004 19:35:11 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #include "tnlNetBase.h" #include "tnlVector.h" + #include "tnlLog.h" namespace TNL *************** *** 44,48 **** NetClassRep::NetClassRep() { ! } --- 45,52 ---- NetClassRep::NetClassRep() { ! mInitialUpdateCount = 0; ! mInitialUpdateBitsUsed = 0; ! mPartialUpdateCount = 0; ! mPartialUpdateBitsUsed = 0; } *************** *** 120,126 **** --- 124,142 ---- } mInitialized = true; + } + void NetClassRep::logBitUsage() + { + logprintf("Net Class Bit Usage:"); + for(NetClassRep *walk = mClassLinkList; walk; walk = walk->mNextClass) + { + if(walk->mInitialUpdateCount) + logprintf("%s (Initial) - Count: %d Avg Size: %g", walk->mClassName, walk->mInitialUpdateCount, walk->mInitialUpdateBitsUsed / F32(walk->mInitialUpdateCount)); + if(walk->mPartialUpdateCount) + logprintf("%s (Partial) - Count: %d Avg Size: %g", walk->mClassName, walk->mPartialUpdateCount, walk->mPartialUpdateBitsUsed / F32(walk->mPartialUpdateCount)); + } } + Object::Object() { Index: ghostConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/ghostConnection.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ghostConnection.cpp 6 May 2004 00:33:38 -0000 1.5 --- ghostConnection.cpp 12 May 2004 19:35:11 -0000 1.6 *************** *** 407,411 **** continue; - //S32 startPos = bstream->getCurPos(); bstream->writeFlag(true); --- 407,410 ---- *************** *** 439,447 **** { bstream->writeFlag(false); ! S32 startPos = bstream->getBitPosition(); if(mConnectionParameters.mDebugObjectSizes) bstream->advanceBitPosition(BitStreamPosBitSize); if(walk->flags & GhostInfo::NotYetGhosted) { --- 438,448 ---- { bstream->writeFlag(false); ! bool isInitialUpdate = false; if(mConnectionParameters.mDebugObjectSizes) bstream->advanceBitPosition(BitStreamPosBitSize); + S32 startPos = bstream->getBitPosition(); + if(walk->flags & GhostInfo::NotYetGhosted) { *************** *** 452,455 **** --- 453,457 ---- walk->flags |= GhostInfo::Ghosting; upd->ghostInfoFlags = GhostInfo::Ghosting; + isInitialUpdate = true; } *************** *** 457,462 **** U32 retMask = walk->obj->packUpdate(this, updateMask, bstream); if(mConnectionParameters.mDebugObjectSizes) ! bstream->writeIntAt(bstream->getBitPosition(), BitStreamPosBitSize, startPos); TNLLogMessageV(LogGhostConnection, ("GhostConnection %s GHOST %d", walk->obj->getClassName(), bstream->getBitPosition() - 16 - startPos)); --- 459,469 ---- U32 retMask = walk->obj->packUpdate(this, updateMask, bstream); + if(isInitialUpdate) + walk->obj->getClassRep()->addInitialUpdate(bstream->getBitPosition() - startPos); + else + walk->obj->getClassRep()->addPartialUpdate(bstream->getBitPosition() - startPos); + if(mConnectionParameters.mDebugObjectSizes) ! bstream->writeIntAt(bstream->getBitPosition(), BitStreamPosBitSize, startPos - BitStreamPosBitSize); TNLLogMessageV(LogGhostConnection, ("GhostConnection %s GHOST %d", walk->obj->getClassName(), bstream->getBitPosition() - 16 - startPos)); *************** *** 469,474 **** upd->mask = updateMask & ~retMask; - - //PacketStream::getStats()->addBits(PacketStats::Send, bstream->getCurPos() - startPos, walk->obj->getPersistTag()); } walk->updateSkipCount = 0; --- 476,479 ---- |