diff options
author | Justin Clark-Casey (justincc) | 2012-06-05 00:17:55 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-05 00:17:55 +0100 |
commit | 655625ab872659cd8aff1fe5b11dc568c91aee6d (patch) | |
tree | c531af096c55b9d37b555b5ee5b81838762b641e /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-655625ab872659cd8aff1fe5b11dc568c91aee6d.zip opensim-SC-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.gz opensim-SC-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.bz2 opensim-SC-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.xz |
Start sending spare frame time MS viewer stat. Make frame time correctly display total frame time, not just non-spare time.
This makes it easier to see when components of frame time exceed normal permitted frame time.
Currently reflect scene frame times.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 702e322..ae35cb9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -219,6 +219,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
219 | private int backupMS; | 219 | private int backupMS; |
220 | private int terrainMS; | 220 | private int terrainMS; |
221 | private int landMS; | 221 | private int landMS; |
222 | private int spareMS; | ||
222 | 223 | ||
223 | /// <summary> | 224 | /// <summary> |
224 | /// Tick at which the last frame was processed. | 225 | /// Tick at which the last frame was processed. |
@@ -1360,43 +1361,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | endFrame = Frame + frames; | 1361 | endFrame = Frame + frames; |
1361 | 1362 | ||
1362 | float physicsFPS = 0f; | 1363 | float physicsFPS = 0f; |
1363 | int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; | 1364 | int previousFrameTick, tmpMS; |
1364 | int previousFrameTick; | 1365 | int maintc = Util.EnvironmentTickCount(); |
1365 | int maintc; | ||
1366 | 1366 | ||
1367 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) | 1367 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) |
1368 | { | 1368 | { |
1369 | maintc = Util.EnvironmentTickCount(); | ||
1370 | ++Frame; | 1369 | ++Frame; |
1371 | 1370 | ||
1372 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1371 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1373 | 1372 | ||
1374 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1373 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1375 | 1374 | ||
1376 | try | 1375 | try |
1377 | { | 1376 | { |
1378 | // Apply taints in terrain module to terrain in physics scene | 1377 | // Apply taints in terrain module to terrain in physics scene |
1379 | if (Frame % m_update_terrain == 0) | 1378 | if (Frame % m_update_terrain == 0) |
1380 | { | 1379 | { |
1381 | terMS = Util.EnvironmentTickCount(); | 1380 | tmpMS = Util.EnvironmentTickCount(); |
1382 | UpdateTerrain(); | 1381 | UpdateTerrain(); |
1383 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | 1382 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1384 | } | 1383 | } |
1385 | 1384 | ||
1386 | tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1385 | tmpMS = Util.EnvironmentTickCount(); |
1387 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1386 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1388 | m_sceneGraph.UpdatePreparePhysics(); | 1387 | m_sceneGraph.UpdatePreparePhysics(); |
1389 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); | 1388 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1390 | 1389 | ||
1391 | // Apply any pending avatar force input to the avatar's velocity | 1390 | // Apply any pending avatar force input to the avatar's velocity |
1392 | tmpAgentMS = Util.EnvironmentTickCount(); | 1391 | tmpMS = Util.EnvironmentTickCount(); |
1393 | if (Frame % m_update_entitymovement == 0) | 1392 | if (Frame % m_update_entitymovement == 0) |
1394 | m_sceneGraph.UpdateScenePresenceMovement(); | 1393 | m_sceneGraph.UpdateScenePresenceMovement(); |
1395 | agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); | 1394 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1396 | 1395 | ||
1397 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1396 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1398 | // velocity | 1397 | // velocity |
1399 | tmpPhysicsMS = Util.EnvironmentTickCount(); | 1398 | tmpMS = Util.EnvironmentTickCount(); |
1400 | if (Frame % m_update_physics == 0) | 1399 | if (Frame % m_update_physics == 0) |
1401 | { | 1400 | { |
1402 | if (m_physics_enabled) | 1401 | if (m_physics_enabled) |
@@ -1405,9 +1404,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1405 | if (SynchronizeScene != null) | 1404 | if (SynchronizeScene != null) |
1406 | SynchronizeScene(this); | 1405 | SynchronizeScene(this); |
1407 | } | 1406 | } |
1408 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | 1407 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1409 | 1408 | ||
1410 | tmpAgentMS = Util.EnvironmentTickCount(); | 1409 | tmpMS = Util.EnvironmentTickCount(); |
1411 | 1410 | ||
1412 | // Check if any objects have reached their targets | 1411 | // Check if any objects have reached their targets |
1413 | CheckAtTargets(); | 1412 | CheckAtTargets(); |
@@ -1422,29 +1421,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1422 | if (Frame % m_update_presences == 0) | 1421 | if (Frame % m_update_presences == 0) |
1423 | m_sceneGraph.UpdatePresences(); | 1422 | m_sceneGraph.UpdatePresences(); |
1424 | 1423 | ||
1425 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); | 1424 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1426 | 1425 | ||
1427 | // Delete temp-on-rez stuff | 1426 | // Delete temp-on-rez stuff |
1428 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1427 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1429 | { | 1428 | { |
1430 | tmpTempOnRezMS = Util.EnvironmentTickCount(); | 1429 | tmpMS = Util.EnvironmentTickCount(); |
1431 | m_cleaningTemps = true; | 1430 | m_cleaningTemps = true; |
1432 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | 1431 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); |
1433 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | 1432 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1434 | } | 1433 | } |
1435 | 1434 | ||
1436 | if (Frame % m_update_events == 0) | 1435 | if (Frame % m_update_events == 0) |
1437 | { | 1436 | { |
1438 | evMS = Util.EnvironmentTickCount(); | 1437 | tmpMS = Util.EnvironmentTickCount(); |
1439 | UpdateEvents(); | 1438 | UpdateEvents(); |
1440 | eventMS = Util.EnvironmentTickCountSubtract(evMS); | 1439 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1441 | } | 1440 | } |
1442 | 1441 | ||
1443 | if (Frame % m_update_backup == 0) | 1442 | if (Frame % m_update_backup == 0) |
1444 | { | 1443 | { |
1445 | backMS = Util.EnvironmentTickCount(); | 1444 | tmpMS = Util.EnvironmentTickCount(); |
1446 | UpdateStorageBackup(); | 1445 | UpdateStorageBackup(); |
1447 | backupMS = Util.EnvironmentTickCountSubtract(backMS); | 1446 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1448 | } | 1447 | } |
1449 | 1448 | ||
1450 | //if (Frame % m_update_land == 0) | 1449 | //if (Frame % m_update_land == 0) |
@@ -1453,24 +1452,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1453 | // UpdateLand(); | 1452 | // UpdateLand(); |
1454 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1453 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1455 | //} | 1454 | //} |
1456 | |||
1457 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1458 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1459 | |||
1460 | // if (Frame%m_update_avatars == 0) | ||
1461 | // UpdateInWorldTime(); | ||
1462 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1463 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1464 | StatsReporter.AddFPS(1); | ||
1465 | |||
1466 | // frameMS currently records work frame times, not total frame times (work + any required sleep to | ||
1467 | // reach min frame time. | ||
1468 | StatsReporter.addFrameMS(frameMS); | ||
1469 | |||
1470 | StatsReporter.addAgentMS(agentMS); | ||
1471 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1472 | StatsReporter.addOtherMS(otherMS); | ||
1473 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1474 | 1455 | ||
1475 | if (LoginsDisabled && Frame == 20) | 1456 | if (LoginsDisabled && Frame == 20) |
1476 | { | 1457 | { |
@@ -1521,13 +1502,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1521 | 1502 | ||
1522 | previousFrameTick = m_lastFrameTick; | 1503 | previousFrameTick = m_lastFrameTick; |
1523 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1504 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1524 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1505 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1525 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1506 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1526 | 1507 | ||
1527 | if (maintc > 0) | 1508 | if (tmpMS > 0) |
1528 | Thread.Sleep(maintc); | 1509 | { |
1510 | Thread.Sleep(tmpMS); | ||
1511 | spareMS += tmpMS; | ||
1512 | } | ||
1529 | 1513 | ||
1530 | // Optionally warn if a frame takes double the amount of time that it should. | 1514 | frameMS = Util.EnvironmentTickCountSubtract(maintc); |
1515 | maintc = Util.EnvironmentTickCount(); | ||
1516 | |||
1517 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1518 | |||
1519 | // if (Frame%m_update_avatars == 0) | ||
1520 | // UpdateInWorldTime(); | ||
1521 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1522 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1523 | StatsReporter.AddFPS(1); | ||
1524 | |||
1525 | StatsReporter.addFrameMS(frameMS); | ||
1526 | StatsReporter.addAgentMS(agentMS); | ||
1527 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1528 | StatsReporter.addOtherMS(otherMS); | ||
1529 | StatsReporter.AddSpareMS(spareMS); | ||
1530 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1531 | |||
1532 | // Optionally warn if a frame takes double the amount of time that it should. | ||
1531 | if (DebugUpdates | 1533 | if (DebugUpdates |
1532 | && Util.EnvironmentTickCountSubtract( | 1534 | && Util.EnvironmentTickCountSubtract( |
1533 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 1535 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) |