* Patch from Misterblue to fix Environment.TickCount for statistics purposes. Resolves the wrap-around of the 32 bit uint.

* Teravus moved the Environment methods to the Util class
mysql-performance
Teravus Ovares (Dan Olivares) 2009-11-29 05:06:25 -05:00
parent 9fd9211a38
commit 4338f4e1d7
6 changed files with 305 additions and 254 deletions

View File

@ -1,172 +1,173 @@
The following people have contributed to OpenSim (Thank you The following people have contributed to OpenSim (Thank you
for your effort!) for your effort!)
Add your name in here if you have committed to OpenSim Add your name in here if you have committed to OpenSim
= Current OpenSim Developers (in very rough order of appearance) = = Current OpenSim Developers (in very rough order of appearance) =
These folks represent the current core team for OpenSim, and are the These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen. people that make the day to day of OpenSim happen.
* MW (Tribal Media AB) * MW (Tribal Media AB)
* Adam Frisby (DeepThink Pty Ltd) * Adam Frisby (DeepThink Pty Ltd)
* MingChen (DeepThink Pty Ltd) * MingChen (DeepThink Pty Ltd)
* lbsa71 (Tribal Media AB) * lbsa71 (Tribal Media AB)
* Sean Dague / sdague (IBM) * Sean Dague / sdague (IBM)
* Tedd * Tedd
* justincc * justincc
* Teravus (w3z) * Teravus (w3z)
* Johan Berntsson (3Di) * Johan Berntsson (3Di)
* Ckrinke (Charles Krinke) * Ckrinke (Charles Krinke)
* chi11ken (Genkii) * chi11ken (Genkii)
* adjohn (Genkii) * adjohn (Genkii)
* Dr Scofield aka Dirk Husemann (IBM Research - Zurich) * Dr Scofield aka Dirk Husemann (IBM Research - Zurich)
* dahlia * dahlia
* mikem (3Di) * mikem (3Di)
* Melanie Thielker * Melanie Thielker
* Homer_Horwitz * Homer_Horwitz
* idb (Ian Brown) * idb (Ian Brown)
* Diva (Crista Lopes, University of California, Irvine) * Diva (Crista Lopes, University of California, Irvine)
* nlin (3Di) * nlin (3Di)
* Arthur Rodrigo S Valadares (IBM) * Arthur Rodrigo S Valadares (IBM)
= Past Open Sim Developers = = Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now These folks are alumns of the OpenSim core group, but are now
currently not active. Their great contributions helped get us to currently not active. Their great contributions helped get us to
where we are today. where we are today.
* Gareth * Gareth
* Andy- * Andy-
* MorphW * MorphW
* CW * CW
* Babblefrog * Babblefrog
* Danx0r * Danx0r
* Dalien * Dalien
* Darok * Darok
* Alondria * Alondria
= Additional OpenSim Contributors = = Additional OpenSim Contributors =
These folks have contributed code patches to OpenSim to help make it These folks have contributed code patches to OpenSim to help make it
what it is today. what it is today.
* aduffy70 * aduffy70
* A_Biondi * A_Biondi
* alex_carnell * alex_carnell
* Alan Webb (IBM) * Alan Webb (IBM)
* BigFootAg * BigFootAg
* BlueWall Slade * BlueWall Slade
* brianw/Sir_Ahzz * brianw/Sir_Ahzz
* CharlieO * CharlieO
* ChrisDown * ChrisDown
* Chris Yeoh (IBM) * Chris Yeoh (IBM)
* coyled * coyled
* Daedius * Daedius
* Dong Jun Lan (IBM) * Dong Jun Lan (IBM)
* DoranZemlja * DoranZemlja
* daTwitch * daTwitch
* devalnor-#708 * devalnor-#708
* dmiles (Daxtron Labs) * dmiles (Daxtron Labs)
* dslake (Intel) * dslake (Intel)
* FredoChaplin * FredoChaplin
* Gerhard * Gerhard
* Godfrey * Godfrey
* Grumly57 * Grumly57
* Ewe Loon * Ewe Loon
* Fly-Man * Fly-Man
* Flyte Xevious * Flyte Xevious
* Imaze Rhiano * Imaze Rhiano
* Intimidated * Intimidated
* Jeremy Bongio (IBM) * Jeremy Bongio (IBM)
* jhurliman * jhurliman
* John R Sohn (XenReborn) * John R Sohn (XenReborn)
* jonc * jonc
* Junta Kohime * Junta Kohime
* Kayne * Kayne
* Kevin Cozens * Kevin Cozens
* kinoc (Daxtron Labs) * kinoc (Daxtron Labs)
* Kitto Flora * Kitto Flora
* KittyLiu * KittyLiu
* Kurt Taylor (IBM) * Kurt Taylor (IBM)
* lulurun * lulurun
* M.Igarashi * M.Igarashi
* maimedleech * maimedleech
* Mic Bowman * Mic Bowman
* Michelle Argus * Michelle Argus
* Michael Cortez (The Flotsam Project, http://osflotsam.org/) * Michael Cortez (The Flotsam Project, http://osflotsam.org/)
* Mike Osias (IBM) * Mike Osias (IBM)
* Mike Pitman (IBM) * Mike Pitman (IBM)
* mikkopa/_someone - RealXtend * mikkopa/_someone - RealXtend
* Mircea Kitsune * Misterblue (Intel)
* mpallari * Mircea Kitsune
* nornalbion * mpallari
* Omar Vera Ustariz (IBM) * nornalbion
* openlifegrid.com * Omar Vera Ustariz (IBM)
* otakup0pe * openlifegrid.com
* ralphos * otakup0pe
* RemedyTomm * ralphos
* Revolution * RemedyTomm
* Richard Alimi (IBM) * Revolution
* Rick Alther (IBM) * Richard Alimi (IBM)
* Rob Smart (IBM) * Rick Alther (IBM)
* rtomita * Rob Smart (IBM)
* Ruud Lathorp * rtomita
* SachaMagne * Ruud Lathorp
* Salahzar Stenvaag * SachaMagne
* sempuki * Salahzar Stenvaag
* Snoopy * sempuki
* Strawberry Fride * Snoopy
* tglion * Strawberry Fride
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) * tglion
* tyre * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* Vytek * tyre
* webmage (IBM) * Vytek
* Xantor * webmage (IBM)
* Y. Nitta * Xantor
* YZh * Y. Nitta
* Zackary Geers aka Kunnis Basiat * YZh
* Zha Ewry * Zackary Geers aka Kunnis Basiat
* Zha Ewry
= LSL Devs =
= LSL Devs =
* Alondria
* CharlieO * Alondria
* Tedd * CharlieO
* Melanie Thielker * Tedd
* Melanie Thielker
= Testers =
= Testers =
* Ai Austin
* CharlieO (LSL) * Ai Austin
* Ckrinke * CharlieO (LSL)
* openlifegrid.com * Ckrinke
* openlifegrid.com
This software uses components from the following developers:
* Sleepycat Software (Berkeley DB) This software uses components from the following developers:
* SQLite (Public Domain) * Sleepycat Software (Berkeley DB)
* XmlRpcCS (http://xmlrpccs.sf.net/) * SQLite (Public Domain)
* MySQL, Inc. (MySQL Connector/NET) * XmlRpcCS (http://xmlrpccs.sf.net/)
* NUnit (http://www.nunit.org) * MySQL, Inc. (MySQL Connector/NET)
* AGEIA Inc. (PhysX) * NUnit (http://www.nunit.org)
* Russel L. Smith (ODE) * AGEIA Inc. (PhysX)
* Prebuild (http://sourceforge.net/projects/dnpb/) * Russel L. Smith (ODE)
* LibOpenMetaverse (http://lib.openmetaverse.org/) * Prebuild (http://sourceforge.net/projects/dnpb/)
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net) * LibOpenMetaverse (http://lib.openmetaverse.org/)
* Prototype JavaScript Framework ajax (http://www.prototypejs.org/) * DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI * Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
* Nini (http://nini.sourceforge.net/) * C5 GENERIC COLLECTION LIBRARY FOR C#/CLI
* log4net (http://logging.apache.org/log4net/) * Nini (http://nini.sourceforge.net/)
* GlynnTucker.Cache (http://gtcache.sourceforge.net/) * log4net (http://logging.apache.org/log4net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options) * GlynnTucker.Cache (http://gtcache.sourceforge.net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
Some plugins are based on Cable Beach
Cable Beach is Copyright (c) 2008 Intel Corporation Some plugins are based on Cable Beach
see http://forge.opensimulator.org/gf/project/assetserver/ Cable Beach is Copyright (c) 2008 Intel Corporation
see http://forge.opensimulator.org/gf/project/assetserver/
In addition, we would like to thank:
* The Mono Project In addition, we would like to thank:
* The NANT Developers * The Mono Project
* Microsoft (.NET, MSSQL-Adapters) * The NANT Developers
* Microsoft (.NET, MSSQL-Adapters)

View File

@ -1389,6 +1389,30 @@ namespace OpenSim.Framework
return null; return null;
} }
#endregion FireAndForget Threading Pattern #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);
}
} }
} }

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Threading;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenMetaverse; using OpenMetaverse;
@ -429,7 +430,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send the packet // Send the packet
m_udpServer.SendPacketFinal(nextPacket); m_udpServer.SendPacketFinal(nextPacket);
m_nextPackets[i] = null; m_nextPackets[i] = null;
packetSent = true; packetSent = true;
this.PacketsSent++;
} }
} }
else else
@ -446,6 +448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send the packet // Send the packet
m_udpServer.SendPacketFinal(packet); m_udpServer.SendPacketFinal(packet);
packetSent = true; packetSent = true;
this.PacketsSent++;
} }
else else
{ {

View File

@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
private Thread HeartbeatThread; private Thread HeartbeatThread;
private volatile bool shuttingdown; private volatile bool shuttingdown;
private int m_lastUpdate = Environment.TickCount; private int m_lastUpdate;
private bool m_firstHeartbeat = true; private bool m_firstHeartbeat = true;
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
@ -526,6 +526,7 @@ namespace OpenSim.Region.Framework.Scenes
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName; m_regionName = m_regInfo.RegionName;
m_datastore = m_regInfo.DataStore; m_datastore = m_regInfo.DataStore;
m_lastUpdate = Util.EnvironmentTickCount();
m_physicalPrim = physicalPrim; m_physicalPrim = physicalPrim;
m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
@ -735,6 +736,8 @@ namespace OpenSim.Region.Framework.Scenes
m_regInfo = regInfo; m_regInfo = regInfo;
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_lastUpdate = Util.EnvironmentTickCount();
} }
#endregion #endregion
@ -1089,7 +1092,7 @@ namespace OpenSim.Region.Framework.Scenes
HeartbeatThread.Abort(); HeartbeatThread.Abort();
HeartbeatThread = null; HeartbeatThread = null;
} }
m_lastUpdate = Environment.TickCount; m_lastUpdate = Util.EnvironmentTickCount();
HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false); HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
} }
@ -1130,7 +1133,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Update(); Update();
m_lastUpdate = Environment.TickCount; m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false; m_firstHeartbeat = false;
} }
catch (ThreadAbortException) catch (ThreadAbortException)
@ -1156,10 +1159,11 @@ namespace OpenSim.Region.Framework.Scenes
while (!shuttingdown) while (!shuttingdown)
{ {
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
physicsFPS = 0f; physicsFPS = 0f;
maintc = otherMS = Environment.TickCount; maintc = Util.EnvironmentTickCount();
int tmpFrameMS = maintc; int tmpFrameMS = maintc;
tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
// Increment the frame counter // Increment the frame counter
++m_frame; ++m_frame;
@ -1179,74 +1183,65 @@ namespace OpenSim.Region.Framework.Scenes
if (m_frame % m_update_presences == 0) if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences(); m_sceneGraph.UpdatePresences();
int TempPhysicsMS2 = Environment.TickCount; int tmpPhysicsMS2 = Util.EnvironmentTickCount();
if ((m_frame % m_update_physics == 0) && m_physics_enabled) if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_sceneGraph.UpdatePreparePhysics(); m_sceneGraph.UpdatePreparePhysics();
TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2; physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
physicsMS2 = TempPhysicsMS2;
if (m_frame % m_update_entitymovement == 0) if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement(); m_sceneGraph.UpdateScenePresenceMovement();
int TempPhysicsMS = Environment.TickCount; int tmpPhysicsMS = Util.EnvironmentTickCount();
if (m_frame % m_update_physics == 0) if (m_frame % m_update_physics == 0)
{ {
if (m_physics_enabled) if (m_physics_enabled)
physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
if (SynchronizeScene != null) if (SynchronizeScene != null)
SynchronizeScene(this); SynchronizeScene(this);
} }
TempPhysicsMS = Environment.TickCount - TempPhysicsMS; physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
physicsMS = TempPhysicsMS;
// Delete temp-on-rez stuff // Delete temp-on-rez stuff
if (m_frame % m_update_backup == 0) if (m_frame % m_update_backup == 0)
{ {
int tozMS = Environment.TickCount; int tmpTempOnRezMS = Util.EnvironmentTickCount();
CleanTempObjects(); CleanTempObjects();
tozMS -= Environment.TickCount; tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
tempOnRezMS = tozMS;
} }
if (RegionStatus != RegionStatus.SlaveScene) if (RegionStatus != RegionStatus.SlaveScene)
{ {
if (m_frame % m_update_events == 0) if (m_frame % m_update_events == 0)
{ {
int evMS = Environment.TickCount; int evMS = Util.EnvironmentTickCount();
UpdateEvents(); UpdateEvents();
evMS -= Environment.TickCount; eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
eventMS = evMS;
} }
if (m_frame % m_update_backup == 0) if (m_frame % m_update_backup == 0)
{ {
int backMS = Environment.TickCount; int backMS = Util.EnvironmentTickCount();
UpdateStorageBackup(); UpdateStorageBackup();
backMS -= Environment.TickCount; backupMS = Util.EnvironmentTickCountSubtract(backMS);
backupMS = backMS;
} }
if (m_frame % m_update_terrain == 0) if (m_frame % m_update_terrain == 0)
{ {
int terMS = Environment.TickCount; int terMS = Util.EnvironmentTickCount();
UpdateTerrain(); UpdateTerrain();
terMS -= Environment.TickCount; terrainMS = Util.EnvironmentTickCountSubtract(terMS);
terrainMS = terMS;
} }
if (m_frame % m_update_land == 0) if (m_frame % m_update_land == 0)
{ {
int ldMS = Environment.TickCount; int ldMS = Util.EnvironmentTickCount();
UpdateLand(); UpdateLand();
ldMS -= Environment.TickCount; landMS = Util.EnvironmentTickCountSubtract(ldMS);
landMS = ldMS; }
}
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
int tickCount = Environment.TickCount; otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
otherMS = tickCount - otherMS; lastCompletedFrame = Util.EnvironmentTickCount();
tmpFrameMS -= tickCount;
frameMS = tmpFrameMS;
lastCompletedFrame = tickCount;
// if (m_frame%m_update_avatars == 0) // if (m_frame%m_update_avatars == 0)
// UpdateInWorldTime(); // UpdateInWorldTime();
@ -1298,9 +1293,9 @@ namespace OpenSim.Region.Framework.Scenes
finally finally
{ {
m_lastupdate = DateTime.UtcNow; m_lastupdate = DateTime.UtcNow;
} }
maintc = Environment.TickCount - maintc; maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(m_timespan * 1000) - maintc; maintc = (int)(m_timespan * 1000) - maintc;
if ((maintc < (m_timespan * 1000)) && maintc > 0) if ((maintc < (m_timespan * 1000)) && maintc > 0)
@ -1311,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void AddGroupTarget(SceneObjectGroup grp) public void AddGroupTarget(SceneObjectGroup grp)
{ {
@ -2585,9 +2581,9 @@ namespace OpenSim.Region.Framework.Scenes
sp.IsChildAgent = false; sp.IsChildAgent = false;
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
} }
} }
m_LastLogin = Environment.TickCount; m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }
@ -4654,16 +4650,16 @@ namespace OpenSim.Region.Framework.Scenes
// 3 = We have seen a new user enter within the past 4 minutes // 3 = We have seen a new user enter within the past 4 minutes
// which can be seen as positive confirmation of sim health // which can be seen as positive confirmation of sim health
// //
int health=1; // Start at 1, means we're up int health=1; // Start at 1, means we're up
if ((Environment.TickCount - m_lastUpdate) < 1000) if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
health+=1; health+=1;
else else
return health; return health;
// A login in the last 4 mins? We can't be doing too badly // 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++; health++;
else else
return health; return health;
@ -4859,9 +4855,9 @@ namespace OpenSim.Region.Framework.Scenes
private void CheckHeartbeat() private void CheckHeartbeat()
{ {
if (m_firstHeartbeat) if (m_firstHeartbeat)
return; return;
if (System.Environment.TickCount - m_lastUpdate > 2000) if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
StartTimer(); StartTimer();
} }
} }

View File

@ -755,13 +755,37 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendPrimUpdates() public void SendPrimUpdates()
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
m_sceneViewer.SendPrimUpdates(); 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 #region Status Methods
/// <summary> /// <summary>
@ -1148,7 +1172,7 @@ namespace OpenSim.Region.Framework.Scenes
// return; // return;
//} //}
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
++m_movementUpdateCount; ++m_movementUpdateCount;
if (m_movementUpdateCount < 1) if (m_movementUpdateCount < 1)
@ -1464,7 +1488,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerOnClientMovement(this); 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) public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@ -1924,7 +1948,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
Rotation = rotation; Rotation = rotation;
Vector3 direc = vec * rotation; Vector3 direc = vec * rotation;
@ -1966,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
// TODO: Add the force instead of only setting it to support multiple forces per frame? // TODO: Add the force instead of only setting it to support multiple forces per frame?
m_forceToApply = direc; m_forceToApply = direc;
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
} }
#endregion #endregion
@ -2032,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
// server. // server.
if (remoteClient.IsActive) if (remoteClient.IsActive)
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
PhysicsActor actor = m_physicsActor; PhysicsActor actor = m_physicsActor;
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@ -2045,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 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))); 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); m_scene.StatsReporter.AddAgentUpdates(1);
} }
} }
@ -2055,11 +2079,11 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToAllClients() public void SendTerseUpdateToAllClients()
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
m_scene.ForEachClient(SendTerseUpdateToClient); m_scene.ForEachClient(SendTerseUpdateToClient);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
} }
public void SendCoarseLocations() public void SendCoarseLocations()
@ -2079,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
List<Vector3> CoarseLocations = new List<Vector3>(); List<Vector3> CoarseLocations = new List<Vector3>();
List<UUID> AvatarUUIDs = new List<UUID>(); List<UUID> AvatarUUIDs = new List<UUID>();
@ -2115,7 +2139,7 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
} }
public void CoarseLocationChange() public void CoarseLocationChange()
@ -2152,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendInitialFullUpdateToAllClients() public void SendInitialFullUpdateToAllClients()
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
ScenePresence[] avatars = m_scene.GetScenePresences(); ScenePresence[] avatars = m_scene.GetScenePresences();
@ -2178,14 +2202,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_scene.StatsReporter.AddAgentUpdates(avatars.Length); m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
//Animator.SendAnimPack(); //Animator.SendAnimPack();
} }
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
// only send update from root agents to other clients; children are only "listening posts" // only send update from root agents to other clients; children are only "listening posts"
List<ScenePresence> avatars = m_scene.GetAvatars(); List<ScenePresence> avatars = m_scene.GetAvatars();
@ -2195,7 +2219,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_scene.StatsReporter.AddAgentUpdates(avatars.Count); m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
Animator.SendAnimPack(); Animator.SendAnimPack();
} }
@ -2237,7 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendAppearanceToAllOtherAgents() public void SendAppearanceToAllOtherAgents()
{ {
m_perfMonMS = Environment.TickCount; m_perfMonMS = EnvironmentTickCount();
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{ {
@ -2247,7 +2271,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
}); });
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
} }
/// <summary> /// <summary>

View File

@ -193,6 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
// / 10 divides the value by the number of times the sim heartbeat runs (10fps) // / 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. // 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++) for (int i = 0; i<21;i++)
{ {
sb[i] = new SimStatsPacket.StatBlock(); sb[i] = new SimStatsPacket.StatBlock();
@ -237,7 +240,7 @@ namespace OpenSim.Region.Framework.Scenes
sb[12].StatID = (uint)Stats.OtherMS; sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor; sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint)Stats.InPacketsPerSecond; sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
sb[14].StatID = (uint)Stats.OutPacketsPerSecond; sb[14].StatID = (uint)Stats.OutPacketsPerSecond;