Merge branch 'master' into careminster
commit
69d83e1548
|
@ -97,6 +97,7 @@ what it is today.
|
|||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikkopa/_someone - RealXtend
|
||||
* Misterblue (Intel)
|
||||
* Mircea Kitsune
|
||||
* mpallari
|
||||
* nornalbion
|
||||
|
|
|
@ -1390,5 +1390,29 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
#endregion FireAndForget Threading Pattern
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
|
||||
/// for the callers.
|
||||
/// This trims it to a 12 day interval so don't let your frame time get too long.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Int32 EnvironmentTickCount()
|
||||
{
|
||||
return Environment.TickCount & EnvironmentTickCountMask;
|
||||
}
|
||||
const Int32 EnvironmentTickCountMask = 0x3fffffff;
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
|
||||
/// 'EnvironmentTickCount()') and accounts for any wrapping.
|
||||
/// </summary>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
|
||||
{
|
||||
Int32 diff = EnvironmentTickCount() - prevValue;
|
||||
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
|
@ -430,6 +431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_udpServer.SendPacketFinal(nextPacket);
|
||||
m_nextPackets[i] = null;
|
||||
packetSent = true;
|
||||
this.PacketsSent++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -446,6 +448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// Send the packet
|
||||
m_udpServer.SendPacketFinal(packet);
|
||||
packetSent = true;
|
||||
this.PacketsSent++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private Thread HeartbeatThread;
|
||||
private volatile bool shuttingdown;
|
||||
|
||||
private int m_lastUpdate = Environment.TickCount;
|
||||
private int m_lastUpdate;
|
||||
private bool m_firstHeartbeat = true;
|
||||
|
||||
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
||||
|
@ -526,6 +526,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_regionHandle = m_regInfo.RegionHandle;
|
||||
m_regionName = m_regInfo.RegionName;
|
||||
m_datastore = m_regInfo.DataStore;
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
|
||||
m_physicalPrim = physicalPrim;
|
||||
m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
|
||||
|
@ -735,6 +736,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_regInfo = regInfo;
|
||||
m_eventManager = new EventManager();
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1101,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
HeartbeatThread.Abort();
|
||||
HeartbeatThread = null;
|
||||
}
|
||||
m_lastUpdate = Environment.TickCount;
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
|
||||
HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
|
||||
}
|
||||
|
@ -1142,7 +1145,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
Update();
|
||||
|
||||
m_lastUpdate = Environment.TickCount;
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
m_firstHeartbeat = false;
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
|
@ -1170,8 +1173,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
|
||||
physicsFPS = 0f;
|
||||
|
||||
maintc = otherMS = Environment.TickCount;
|
||||
maintc = Util.EnvironmentTickCount();
|
||||
int tmpFrameMS = maintc;
|
||||
tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
|
||||
|
||||
// Increment the frame counter
|
||||
++m_frame;
|
||||
|
@ -1191,16 +1195,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_frame % m_update_objects == 0)
|
||||
m_sceneGraph.UpdateObjectGroups();
|
||||
|
||||
int TempPhysicsMS2 = Environment.TickCount;
|
||||
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
|
||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2;
|
||||
physicsMS2 = TempPhysicsMS2;
|
||||
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
|
||||
|
||||
if (m_frame % m_update_entitymovement == 0)
|
||||
m_sceneGraph.UpdateScenePresenceMovement();
|
||||
|
||||
int TempPhysicsMS = Environment.TickCount;
|
||||
int tmpPhysicsMS = Util.EnvironmentTickCount();
|
||||
if (m_frame % m_update_physics == 0)
|
||||
{
|
||||
if (m_physics_enabled)
|
||||
|
@ -1208,57 +1211,49 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (SynchronizeScene != null)
|
||||
SynchronizeScene(this);
|
||||
}
|
||||
TempPhysicsMS = Environment.TickCount - TempPhysicsMS;
|
||||
physicsMS = TempPhysicsMS;
|
||||
physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
|
||||
|
||||
// Delete temp-on-rez stuff
|
||||
if (m_frame % m_update_backup == 0)
|
||||
{
|
||||
int tozMS = Environment.TickCount;
|
||||
int tmpTempOnRezMS = Util.EnvironmentTickCount();
|
||||
CleanTempObjects();
|
||||
tozMS -= Environment.TickCount;
|
||||
tempOnRezMS = tozMS;
|
||||
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
|
||||
}
|
||||
|
||||
if (RegionStatus != RegionStatus.SlaveScene)
|
||||
{
|
||||
if (m_frame % m_update_events == 0)
|
||||
{
|
||||
int evMS = Environment.TickCount;
|
||||
int evMS = Util.EnvironmentTickCount();
|
||||
UpdateEvents();
|
||||
evMS -= Environment.TickCount;
|
||||
eventMS = evMS;
|
||||
eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
|
||||
}
|
||||
|
||||
if (m_frame % m_update_backup == 0)
|
||||
{
|
||||
int backMS = Environment.TickCount;
|
||||
int backMS = Util.EnvironmentTickCount();
|
||||
UpdateStorageBackup();
|
||||
backMS -= Environment.TickCount;
|
||||
backupMS = backMS;
|
||||
backupMS = Util.EnvironmentTickCountSubtract(backMS);
|
||||
}
|
||||
|
||||
if (m_frame % m_update_terrain == 0)
|
||||
{
|
||||
int terMS = Environment.TickCount;
|
||||
int terMS = Util.EnvironmentTickCount();
|
||||
UpdateTerrain();
|
||||
terMS -= Environment.TickCount;
|
||||
terrainMS = terMS;
|
||||
terrainMS = Util.EnvironmentTickCountSubtract(terMS);
|
||||
}
|
||||
|
||||
if (m_frame % m_update_land == 0)
|
||||
{
|
||||
int ldMS = Environment.TickCount;
|
||||
int ldMS = Util.EnvironmentTickCount();
|
||||
UpdateLand();
|
||||
ldMS -= Environment.TickCount;
|
||||
landMS = ldMS;
|
||||
landMS = Util.EnvironmentTickCountSubtract(ldMS);
|
||||
}
|
||||
|
||||
int tickCount = Environment.TickCount;
|
||||
otherMS = tickCount - otherMS;
|
||||
tmpFrameMS -= tickCount;
|
||||
frameMS = tmpFrameMS;
|
||||
lastCompletedFrame = tickCount;
|
||||
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
|
||||
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
|
||||
lastCompletedFrame = Util.EnvironmentTickCount();
|
||||
|
||||
// if (m_frame%m_update_avatars == 0)
|
||||
// UpdateInWorldTime();
|
||||
|
@ -1312,7 +1307,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_lastupdate = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
maintc = Environment.TickCount - maintc;
|
||||
maintc = Util.EnvironmentTickCountSubtract(maintc);
|
||||
maintc = (int)(m_timespan * 1000) - maintc;
|
||||
|
||||
if ((maintc < (m_timespan * 1000)) && maintc > 0)
|
||||
|
@ -1324,6 +1319,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
|
||||
|
||||
public void AddGroupTarget(SceneObjectGroup grp)
|
||||
{
|
||||
lock (m_groupsWithTargets)
|
||||
|
@ -2599,7 +2595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
m_LastLogin = Environment.TickCount;
|
||||
m_LastLogin = Util.EnvironmentTickCount();
|
||||
EventManager.TriggerOnNewClient(client);
|
||||
}
|
||||
|
||||
|
@ -4668,14 +4664,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//
|
||||
int health=1; // Start at 1, means we're up
|
||||
|
||||
if ((Environment.TickCount - m_lastUpdate) < 1000)
|
||||
if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
|
||||
health+=1;
|
||||
else
|
||||
return health;
|
||||
|
||||
// A login in the last 4 mins? We can't be doing too badly
|
||||
//
|
||||
if ((Environment.TickCount - m_LastLogin) < 240000)
|
||||
if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
|
||||
health++;
|
||||
else
|
||||
return health;
|
||||
|
@ -4873,7 +4869,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_firstHeartbeat)
|
||||
return;
|
||||
|
||||
if (System.Environment.TickCount - m_lastUpdate > 2000)
|
||||
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -790,13 +790,37 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void SendPrimUpdates()
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
m_sceneViewer.SendPrimUpdates();
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
|
||||
/// for the callers.
|
||||
/// This trims it to a 12 day interval so don't let your frame time get too long.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
const Int32 EnvironmentTickCountMask = 0x3fffffff;
|
||||
private static Int32 EnvironmentTickCount() {
|
||||
return Environment.TickCount & EnvironmentTickCountMask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
|
||||
/// 'EnvironmentTickCount()') and accounts for any wrapping.
|
||||
/// </summary>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
|
||||
Int32 diff = EnvironmentTickCount() - prevValue;
|
||||
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
|
||||
|
||||
#region Status Methods
|
||||
|
||||
/// <summary>
|
||||
|
@ -1184,7 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
|
||||
// return;
|
||||
//}
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
++m_movementUpdateCount;
|
||||
if (m_movementUpdateCount < 1)
|
||||
|
@ -1514,7 +1539,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
|
||||
|
@ -2032,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
Rotation = rotation;
|
||||
Vector3 direc = vec * rotation;
|
||||
|
@ -2074,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// TODO: Add the force instead of only setting it to support multiple forces per frame?
|
||||
m_forceToApply = direc;
|
||||
m_isNudging = Nudging;
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCount() - m_perfMonMS);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -2143,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// server.
|
||||
if (remoteClient.IsActive)
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
PhysicsActor actor = m_physicsActor;
|
||||
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
|
||||
|
@ -2156,7 +2181,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||
pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||
}
|
||||
}
|
||||
|
@ -2166,11 +2191,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void SendTerseUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void SendCoarseLocations()
|
||||
|
@ -2190,7 +2215,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
List<UUID> AvatarUUIDs = new List<UUID>();
|
||||
|
@ -2226,7 +2251,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void CoarseLocationChange()
|
||||
|
@ -2263,7 +2288,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void SendInitialFullUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
ScenePresence[] avatars = m_scene.GetScenePresences();
|
||||
|
||||
|
@ -2289,14 +2314,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
|
||||
//Animator.SendAnimPack();
|
||||
}
|
||||
|
||||
public void SendFullUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
// only send update from root agents to other clients; children are only "listening posts"
|
||||
List<ScenePresence> avatars = m_scene.GetAvatars();
|
||||
|
@ -2306,7 +2331,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
}
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
|
||||
Animator.SendAnimPack();
|
||||
}
|
||||
|
@ -2348,7 +2373,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void SendAppearanceToAllOtherAgents()
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
{
|
||||
|
@ -2358,7 +2383,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
});
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -193,6 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// / 10 divides the value by the number of times the sim heartbeat runs (10fps)
|
||||
// Then we divide the whole amount by the amount of seconds pass in between stats updates.
|
||||
|
||||
// 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
|
||||
// values to X-per-second values.
|
||||
|
||||
for (int i = 0; i<21;i++)
|
||||
{
|
||||
sb[i] = new SimStatsPacket.StatBlock();
|
||||
|
|
Loading…
Reference in New Issue