本文整理汇总了C++中ObjectFactory::CountOfObjects方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectFactory::CountOfObjects方法的具体用法?C++ ObjectFactory::CountOfObjects怎么用?C++ ObjectFactory::CountOfObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectFactory
的用法示例。
在下文中一共展示了ObjectFactory::CountOfObjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
//.........这里部分代码省略.........
case 'D':
// Disconnect account 0 (useful when client crashes)
for( tSock = Network->LastSocket(); tSock != NULL; tSock = Network->PrevSocket() )
{
if( tSock->AcctNo() == 0 )
Network->Disconnect( tSock );
}
messageLoop << "CMD: Socket Disconnected(Account 0).";
break;
case 'K':
{
for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() )
{
Network->Disconnect( tSock );
}
messageLoop << "CMD: All Connections Closed.";
}
break;
case 'P':
{
UI32 networkTimeCount = cwmWorldState->ServerProfile()->NetworkTimeCount();
UI32 timerTimeCount = cwmWorldState->ServerProfile()->TimerTimeCount();
UI32 autoTimeCount = cwmWorldState->ServerProfile()->AutoTimeCount();
UI32 loopTimeCount = cwmWorldState->ServerProfile()->LoopTimeCount();
// 1/13/2003 - Dreoth - Log Performance Information enhancements
LogEcho( true );
Log( "--- Starting Performance Dump ---", "performance.log");
Log( "\tPerformace Dump:", "performance.log");
Log( "\tNetwork code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->NetworkTime()/(R32)networkTimeCount), networkTimeCount);
Log( "\tTimer code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->TimerTime()/(R32)timerTimeCount), timerTimeCount);
Log( "\tAuto code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->AutoTime()/(R32)autoTimeCount), autoTimeCount);
Log( "\tLoop Time: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount), loopTimeCount);
ObjectFactory *ourFac = ObjectFactory::getSingletonPtr();
Log( "\tCharacters: %i/%i - Items: %i/%i (Dynamic)", "performance.log", ourFac->CountOfObjects( OT_CHAR ), ourFac->SizeOfObjects( OT_CHAR ), ourFac->CountOfObjects( OT_ITEM ), ourFac->SizeOfObjects( OT_ITEM ) );
Log( "\tSimulation Cycles: %f per sec", "performance.log", (1000.0*(1.0/(R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount))));
Log( "\tBytes sent: %i", "performance.log", cwmWorldState->ServerProfile()->GlobalSent());
Log( "\tBytes Received: %i", "performance.log", cwmWorldState->ServerProfile()->GlobalReceived());
Log( "--- Performance Dump Complete ---", "performance.log");
LogEcho( false );
break;
}
case 'W':
// Display logged in chars
messageLoop << "CMD: Current Users in the World:";
j = 0;
CSocket *iSock;
Network->PushConn();
for( iSock = Network->FirstSocket(); !Network->FinishedSockets(); iSock = Network->NextSocket() )
{
++j;
CChar *mChar = iSock->CurrcharObj();
sprintf( temp, " %i) %s [%x %x %x %x]", j - 1, mChar->GetName().c_str(), mChar->GetSerial( 1 ), mChar->GetSerial( 2 ), mChar->GetSerial( 3 ), mChar->GetSerial( 4 ) );
messageLoop << temp;
}
Network->PopConn();
sprintf( temp, " Total users online: %i", j );
messageLoop << temp;
break;
case 'M':
size_t tmp, total;
total = 0;
tmp = 0;
messageLoop << "CMD: UOX Memory Information:";
messageLoop << " Cache:";
sprintf( temp, " Tiles: %u bytes", Map->GetTileMem() );
messageLoop << temp;