protected virtual void PhysicsStatsHeartbeat(object sender, ElapsedEventArgs e) { if (!m_collectingStats) { return; } lock (m_currentPhysicsStats) { foreach (KeyValuePair <UUID, PhysicsStats> kvp in m_currentPhysicsStats) { //Save the stats in the last one so we can keep them for the console commands //Divide by 10 so we get per second m_lastPhysicsStats[kvp.Key] = kvp.Value; m_lastPhysicsStats[kvp.Key].StatAvatarUpdatePosAndVelocity /= 10; m_lastPhysicsStats[kvp.Key].StatCollisionOptimizedTime /= 10; m_lastPhysicsStats[kvp.Key].StatPhysicsMoveTime /= 10; m_lastPhysicsStats[kvp.Key].StatPhysicsTaintTime /= 10; m_lastPhysicsStats[kvp.Key].StatPrimUpdatePosAndVelocity /= 10; m_lastPhysicsStats[kvp.Key].StatSendCollisionsTime /= 10; m_lastPhysicsStats[kvp.Key].StatUnlockedArea /= 10; m_lastPhysicsStats[kvp.Key].StatFindContactsTime /= 10; m_lastPhysicsStats[kvp.Key].StatContactLoopTime /= 10; m_lastPhysicsStats[kvp.Key].StatCollisionAccountingTime /= 10; //Add the stats to the profiler Profiler p = ProfilerManager.GetProfiler(); p.AddStat("StatAvatarUpdatePosAndVelocity " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatAvatarUpdatePosAndVelocity); p.AddStat("StatCollisionOptimizedTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatCollisionOptimizedTime); p.AddStat("StatPhysicsMoveTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatPhysicsMoveTime); p.AddStat("StatPhysicsTaintTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatPhysicsTaintTime); p.AddStat("StatPrimUpdatePosAndVelocity " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatPrimUpdatePosAndVelocity); p.AddStat("StatSendCollisionsTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatSendCollisionsTime); p.AddStat("StatUnlockedArea " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatUnlockedArea); p.AddStat("StatFindContactsTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatFindContactsTime); p.AddStat("StatContactLoopTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatContactLoopTime); p.AddStat("StatCollisionAccountingTime " + kvp.Key, m_lastPhysicsStats[kvp.Key].StatCollisionAccountingTime); } m_currentPhysicsStats.Clear(); } m_lastUpdated = DateTime.Now; //If there are stats waiting, we just pulled them m_waitingForCollectionOfStats = false; }
public virtual void AddPhysicsStats(UUID RegionID, PhysicsScene scene) { if (!m_collectingStats) { return; } lock (m_currentPhysicsStats) { PhysicsStats stats; if (!m_currentPhysicsStats.TryGetValue(RegionID, out stats)) { stats = new PhysicsStats(); stats.StatAvatarUpdatePosAndVelocity = scene.StatAvatarUpdatePosAndVelocity; stats.StatCollisionOptimizedTime = scene.StatCollisionOptimizedTime; stats.StatPhysicsMoveTime = scene.StatPhysicsMoveTime; stats.StatPhysicsTaintTime = scene.StatPhysicsTaintTime; stats.StatPrimUpdatePosAndVelocity = scene.StatPrimUpdatePosAndVelocity; stats.StatSendCollisionsTime = scene.StatSendCollisionsTime; stats.StatUnlockedArea = scene.StatUnlockedArea; stats.StatFindContactsTime = scene.StatFindContactsTime; stats.StatContactLoopTime = scene.StatContactLoopTime; stats.StatCollisionAccountingTime = scene.StatCollisionAccountingTime; } else { stats.StatAvatarUpdatePosAndVelocity += scene.StatAvatarUpdatePosAndVelocity; stats.StatCollisionOptimizedTime += scene.StatCollisionOptimizedTime; stats.StatPhysicsMoveTime += scene.StatPhysicsMoveTime; stats.StatPhysicsTaintTime += scene.StatPhysicsTaintTime; stats.StatPrimUpdatePosAndVelocity += scene.StatPrimUpdatePosAndVelocity; stats.StatSendCollisionsTime += scene.StatSendCollisionsTime; stats.StatUnlockedArea += scene.StatUnlockedArea; stats.StatFindContactsTime += scene.StatFindContactsTime; stats.StatContactLoopTime += scene.StatContactLoopTime; stats.StatCollisionAccountingTime += scene.StatCollisionAccountingTime; } m_currentPhysicsStats[RegionID] = stats; PhysicsStats ProfilerStats = new PhysicsStats(); ProfilerStats.StatAvatarUpdatePosAndVelocity = scene.StatAvatarUpdatePosAndVelocity; ProfilerStats.StatCollisionOptimizedTime = scene.StatCollisionOptimizedTime; ProfilerStats.StatPhysicsMoveTime = scene.StatPhysicsMoveTime; ProfilerStats.StatPhysicsTaintTime = scene.StatPhysicsTaintTime; ProfilerStats.StatPrimUpdatePosAndVelocity = scene.StatPrimUpdatePosAndVelocity; ProfilerStats.StatSendCollisionsTime = scene.StatSendCollisionsTime; ProfilerStats.StatUnlockedArea = scene.StatUnlockedArea; ProfilerStats.StatFindContactsTime = scene.StatFindContactsTime; ProfilerStats.StatContactLoopTime = scene.StatContactLoopTime; ProfilerStats.StatCollisionAccountingTime = scene.StatCollisionAccountingTime; //Add the stats to the profiler Profiler p = ProfilerManager.GetProfiler(); p.AddStat("CurrentStatAvatarUpdatePosAndVelocity " + RegionID, ProfilerStats.StatAvatarUpdatePosAndVelocity); p.AddStat("CurrentStatCollisionOptimizedTime " + RegionID, ProfilerStats.StatCollisionOptimizedTime); p.AddStat("CurrentStatPhysicsMoveTime " + RegionID, ProfilerStats.StatPhysicsMoveTime); p.AddStat("CurrentStatPhysicsTaintTime " + RegionID, ProfilerStats.StatPhysicsTaintTime); p.AddStat("CurrentStatPrimUpdatePosAndVelocity " + RegionID, ProfilerStats.StatPrimUpdatePosAndVelocity); p.AddStat("CurrentStatSendCollisionsTime " + RegionID, ProfilerStats.StatSendCollisionsTime); p.AddStat("CurrentStatUnlockedArea " + RegionID, ProfilerStats.StatUnlockedArea); p.AddStat("CurrentStatFindContactsTime " + RegionID, ProfilerStats.StatFindContactsTime); p.AddStat("CurrentStatContactLoopTime " + RegionID, ProfilerStats.StatContactLoopTime); p.AddStat("CurrentStatCollisionAccountingTime " + RegionID, ProfilerStats.StatCollisionAccountingTime); } }