void CServer::DoPulse() { UNCLOCK( "Top", "Other" ); if ( m_pGame ) { CLOCK( "Top", "Game->DoPulse" ); m_pGame->DoPulse (); UNCLOCK( "Top", "Game->DoPulse" ); } CLOCK( "Top", "Other" ); }
void CPlayer::MaybeUpdateOthersNearList ( void ) { // If too long since last update if ( m_UpdateNearListTimer.Get () > (uint)g_TickRateSettings.iNearListUpdate * 9 / 10 ) { CLOCK( "RelayPlayerPuresync", "UpdateNearList_Timer" ); UpdateOthersNearList (); UNCLOCK( "RelayPlayerPuresync", "UpdateNearList_Timer" ); } else // or player has moved too far if ( ( m_vecUpdateNearLastPosition - GetPosition () ).LengthSquared () > MOVEMENT_UPDATE_THRESH * MOVEMENT_UPDATE_THRESH ) { CLOCK( "RelayPlayerPuresync", "UpdateNearList_Movement" ); UpdateOthersNearList (); UNCLOCK( "RelayPlayerPuresync", "UpdateNearList_Movement" ); } }
/////////////////////////////////////////////////////////////// // // CStatResults::FrameEnd // // Save all stats in a ResultCollection // /////////////////////////////////////////////////////////////// void CStatResults::FrameEnd ( void ) { CLOCK( "Profiling", "Compile stats" ); SStatResultCollection& collection = m_CollectionCombo; bool bClearMax = false; float fNextLength = (float)GetSecondCount () - m_fNextMaxClearTime; if ( fNextLength >= 2.0f ) { bClearMax = true; m_fNextMaxClearTime = (float)GetSecondCount (); } // Clear max time thing for ( std::map < std::string, SStatResultSection > :: iterator itSection = collection.begin () ; itSection != collection.end () ; itSection++ ) { SStatResultSection& section = itSection->second; for ( std::map < std::string, SStatResultItem > :: iterator itItem = section.begin () ; itItem != section.end () ; itItem++ ) { SStatResultItem& item = itItem->second; item.iCounter = 0; item.fMs = 0; if ( bClearMax ) { item.fMsMax = item.fMsMaxNext; item.fMsMaxNext = 0; item.fMsTotal = item.fMsTotalAcc; item.fMsTotalPercent = item.fMsTotalAcc / fNextLength * 0.1f; item.fMsTotalAcc = 0; item.iCounterTotal = item.iCounterTotalAcc; item.iCounterTotalAcc = 0; } } } // Retrieve stats from g_StatEvents { SStatCollection collectionSrc; g_StatEvents.Sample ( collectionSrc ); const SStatCollection* pCollectionSrc = &collectionSrc; // Merge collections // Merge section maps for ( std::map < std::string, SStatSection > :: const_iterator itSectionSrc = pCollectionSrc->begin () ; itSectionSrc != pCollectionSrc->end () ; itSectionSrc++ ) { const std::string& strSectionNameSrc = itSectionSrc->first; const SStatSection& sectionSrc = itSectionSrc->second; // Merge sections SStatResultSection& sectionCombo = MapGet ( m_CollectionCombo, strSectionNameSrc ); // Merge item maps for ( std::map < std::string, SStatItem > :: const_iterator itItemSrc = sectionSrc.begin () ; itItemSrc != sectionSrc.end () ; itItemSrc++ ) { const std::string& strItemNameSrc = itItemSrc->first; const SStatItem& itemSrc = itItemSrc->second; // Merge item SStatResultItem& itemCombo = MapGet ( sectionCombo, strItemNameSrc ); itemCombo.iCounter += itemSrc.iCounter; itemCombo.fMs += itemSrc.fMs; } } } // Update some counters and stuff for ( std::map < std::string, SStatResultSection > :: iterator itSection = collection.begin () ; itSection != collection.end () ; itSection++ ) { SStatResultSection& section = itSection->second; for ( std::map < std::string, SStatResultItem > :: iterator itItem = section.begin () ; itItem != section.end () ; itItem++ ) { SStatResultItem& item = itItem->second; item.fMsMaxNext = Max ( item.fMsMaxNext, item.fMs ); item.fMsTotalAcc += item.fMs; item.iCounterTotalAcc += item.iCounter; } } UNCLOCK( "Profiling", "Compile stats" ); }