aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-11-30 08:25:40 +0000
committerMelanie2009-11-30 08:25:40 +0000
commit69d83e1548b4e18bdee15f2ff558d386e68ec489 (patch)
treed7b2399a1d5bc343116671e2c436d72569899936
parentMerge branch 'master' into careminster (diff)
parent* Patch from Misterblue to fix Environment.TickCount for statistics purposes.... (diff)
downloadopensim-SC-69d83e1548b4e18bdee15f2ff558d386e68ec489.zip
opensim-SC-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.gz
opensim-SC-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.bz2
opensim-SC-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.xz
Merge branch 'master' into careminster
-rw-r--r--CONTRIBUTORS.txt345
-rw-r--r--OpenSim/Framework/Util.cs26
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs68
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs5
6 files changed, 281 insertions, 229 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 174ce0a..0d78928 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -1,172 +1,173 @@
1The following people have contributed to OpenSim (Thank you 1The following people have contributed to OpenSim (Thank you
2for your effort!) 2for your effort!)
3 3
4Add your name in here if you have committed to OpenSim 4Add your name in here if you have committed to OpenSim
5 5
6= Current OpenSim Developers (in very rough order of appearance) = 6= Current OpenSim Developers (in very rough order of appearance) =
7These folks represent the current core team for OpenSim, and are the 7These folks represent the current core team for OpenSim, and are the
8people that make the day to day of OpenSim happen. 8people that make the day to day of OpenSim happen.
9 9
10* MW (Tribal Media AB) 10* MW (Tribal Media AB)
11* Adam Frisby (DeepThink Pty Ltd) 11* Adam Frisby (DeepThink Pty Ltd)
12* MingChen (DeepThink Pty Ltd) 12* MingChen (DeepThink Pty Ltd)
13* lbsa71 (Tribal Media AB) 13* lbsa71 (Tribal Media AB)
14* Sean Dague / sdague (IBM) 14* Sean Dague / sdague (IBM)
15* Tedd 15* Tedd
16* justincc 16* justincc
17* Teravus (w3z) 17* Teravus (w3z)
18* Johan Berntsson (3Di) 18* Johan Berntsson (3Di)
19* Ckrinke (Charles Krinke) 19* Ckrinke (Charles Krinke)
20* chi11ken (Genkii) 20* chi11ken (Genkii)
21* adjohn (Genkii) 21* adjohn (Genkii)
22* Dr Scofield aka Dirk Husemann (IBM Research - Zurich) 22* Dr Scofield aka Dirk Husemann (IBM Research - Zurich)
23* dahlia 23* dahlia
24* mikem (3Di) 24* mikem (3Di)
25* Melanie Thielker 25* Melanie Thielker
26* Homer_Horwitz 26* Homer_Horwitz
27* idb (Ian Brown) 27* idb (Ian Brown)
28* Diva (Crista Lopes, University of California, Irvine) 28* Diva (Crista Lopes, University of California, Irvine)
29* nlin (3Di) 29* nlin (3Di)
30* Arthur Rodrigo S Valadares (IBM) 30* Arthur Rodrigo S Valadares (IBM)
31 31
32 32
33= Past Open Sim Developers = 33= Past Open Sim Developers =
34These folks are alumns of the OpenSim core group, but are now 34These folks are alumns of the OpenSim core group, but are now
35currently not active. Their great contributions helped get us to 35currently not active. Their great contributions helped get us to
36where we are today. 36where we are today.
37 37
38* Gareth 38* Gareth
39* Andy- 39* Andy-
40* MorphW 40* MorphW
41* CW 41* CW
42* Babblefrog 42* Babblefrog
43* Danx0r 43* Danx0r
44* Dalien 44* Dalien
45* Darok 45* Darok
46* Alondria 46* Alondria
47 47
48 48
49= Additional OpenSim Contributors = 49= Additional OpenSim Contributors =
50These folks have contributed code patches to OpenSim to help make it 50These folks have contributed code patches to OpenSim to help make it
51what it is today. 51what it is today.
52 52
53* aduffy70 53* aduffy70
54* A_Biondi 54* A_Biondi
55* alex_carnell 55* alex_carnell
56* Alan Webb (IBM) 56* Alan Webb (IBM)
57* BigFootAg 57* BigFootAg
58* BlueWall Slade 58* BlueWall Slade
59* brianw/Sir_Ahzz 59* brianw/Sir_Ahzz
60* CharlieO 60* CharlieO
61* ChrisDown 61* ChrisDown
62* Chris Yeoh (IBM) 62* Chris Yeoh (IBM)
63* coyled 63* coyled
64* Daedius 64* Daedius
65* Dong Jun Lan (IBM) 65* Dong Jun Lan (IBM)
66* DoranZemlja 66* DoranZemlja
67* daTwitch 67* daTwitch
68* devalnor-#708 68* devalnor-#708
69* dmiles (Daxtron Labs) 69* dmiles (Daxtron Labs)
70* dslake (Intel) 70* dslake (Intel)
71* FredoChaplin 71* FredoChaplin
72* Gerhard 72* Gerhard
73* Godfrey 73* Godfrey
74* Grumly57 74* Grumly57
75* Ewe Loon 75* Ewe Loon
76* Fly-Man 76* Fly-Man
77* Flyte Xevious 77* Flyte Xevious
78* Imaze Rhiano 78* Imaze Rhiano
79* Intimidated 79* Intimidated
80* Jeremy Bongio (IBM) 80* Jeremy Bongio (IBM)
81* jhurliman 81* jhurliman
82* John R Sohn (XenReborn) 82* John R Sohn (XenReborn)
83* jonc 83* jonc
84* Junta Kohime 84* Junta Kohime
85* Kayne 85* Kayne
86* Kevin Cozens 86* Kevin Cozens
87* kinoc (Daxtron Labs) 87* kinoc (Daxtron Labs)
88* Kitto Flora 88* Kitto Flora
89* KittyLiu 89* KittyLiu
90* Kurt Taylor (IBM) 90* Kurt Taylor (IBM)
91* lulurun 91* lulurun
92* M.Igarashi 92* M.Igarashi
93* maimedleech 93* maimedleech
94* Mic Bowman 94* Mic Bowman
95* Michelle Argus 95* Michelle Argus
96* Michael Cortez (The Flotsam Project, http://osflotsam.org/) 96* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
97* Mike Osias (IBM) 97* Mike Osias (IBM)
98* Mike Pitman (IBM) 98* Mike Pitman (IBM)
99* mikkopa/_someone - RealXtend 99* mikkopa/_someone - RealXtend
100* Mircea Kitsune 100* Misterblue (Intel)
101* mpallari 101* Mircea Kitsune
102* nornalbion 102* mpallari
103* Omar Vera Ustariz (IBM) 103* nornalbion
104* openlifegrid.com 104* Omar Vera Ustariz (IBM)
105* otakup0pe 105* openlifegrid.com
106* ralphos 106* otakup0pe
107* RemedyTomm 107* ralphos
108* Revolution 108* RemedyTomm
109* Richard Alimi (IBM) 109* Revolution
110* Rick Alther (IBM) 110* Richard Alimi (IBM)
111* Rob Smart (IBM) 111* Rick Alther (IBM)
112* rtomita 112* Rob Smart (IBM)
113* Ruud Lathorp 113* rtomita
114* SachaMagne 114* Ruud Lathorp
115* Salahzar Stenvaag 115* SachaMagne
116* sempuki 116* Salahzar Stenvaag
117* Snoopy 117* sempuki
118* Strawberry Fride 118* Snoopy
119* tglion 119* Strawberry Fride
120* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) 120* tglion
121* tyre 121* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
122* Vytek 122* tyre
123* webmage (IBM) 123* Vytek
124* Xantor 124* webmage (IBM)
125* Y. Nitta 125* Xantor
126* YZh 126* Y. Nitta
127* Zackary Geers aka Kunnis Basiat 127* YZh
128* Zha Ewry 128* Zackary Geers aka Kunnis Basiat
129 129* Zha Ewry
130 130
131= LSL Devs = 131
132 132= LSL Devs =
133* Alondria 133
134* CharlieO 134* Alondria
135* Tedd 135* CharlieO
136* Melanie Thielker 136* Tedd
137 137* Melanie Thielker
138 138
139= Testers = 139
140 140= Testers =
141* Ai Austin 141
142* CharlieO (LSL) 142* Ai Austin
143* Ckrinke 143* CharlieO (LSL)
144* openlifegrid.com 144* Ckrinke
145 145* openlifegrid.com
146 146
147This software uses components from the following developers: 147
148* Sleepycat Software (Berkeley DB) 148This software uses components from the following developers:
149* SQLite (Public Domain) 149* Sleepycat Software (Berkeley DB)
150* XmlRpcCS (http://xmlrpccs.sf.net/) 150* SQLite (Public Domain)
151* MySQL, Inc. (MySQL Connector/NET) 151* XmlRpcCS (http://xmlrpccs.sf.net/)
152* NUnit (http://www.nunit.org) 152* MySQL, Inc. (MySQL Connector/NET)
153* AGEIA Inc. (PhysX) 153* NUnit (http://www.nunit.org)
154* Russel L. Smith (ODE) 154* AGEIA Inc. (PhysX)
155* Prebuild (http://sourceforge.net/projects/dnpb/) 155* Russel L. Smith (ODE)
156* LibOpenMetaverse (http://lib.openmetaverse.org/) 156* Prebuild (http://sourceforge.net/projects/dnpb/)
157* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net) 157* LibOpenMetaverse (http://lib.openmetaverse.org/)
158* Prototype JavaScript Framework ajax (http://www.prototypejs.org/) 158* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
159* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI 159* Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
160* Nini (http://nini.sourceforge.net/) 160* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI
161* log4net (http://logging.apache.org/log4net/) 161* Nini (http://nini.sourceforge.net/)
162* GlynnTucker.Cache (http://gtcache.sourceforge.net/) 162* log4net (http://logging.apache.org/log4net/)
163* NDesk.Options 0.2.1 (http://www.ndesk.org/Options) 163* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
164 164* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
165Some plugins are based on Cable Beach 165
166Cable Beach is Copyright (c) 2008 Intel Corporation 166Some plugins are based on Cable Beach
167see http://forge.opensimulator.org/gf/project/assetserver/ 167Cable Beach is Copyright (c) 2008 Intel Corporation
168 168see http://forge.opensimulator.org/gf/project/assetserver/
169In addition, we would like to thank: 169
170* The Mono Project 170In addition, we would like to thank:
171* The NANT Developers 171* The Mono Project
172* Microsoft (.NET, MSSQL-Adapters) 172* The NANT Developers
173* Microsoft (.NET, MSSQL-Adapters)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c052745..7b90239 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1389,6 +1389,30 @@ namespace OpenSim.Framework
1389 return null; 1389 return null;
1390 } 1390 }
1391 1391
1392 #endregion FireAndForget Threading Pattern 1392 #endregion FireAndForget Threading Pattern
1393 /// <summary>
1394 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
1395 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
1396 /// for the callers.
1397 /// This trims it to a 12 day interval so don't let your frame time get too long.
1398 /// </summary>
1399 /// <returns></returns>
1400 public static Int32 EnvironmentTickCount()
1401 {
1402 return Environment.TickCount & EnvironmentTickCountMask;
1403 }
1404 const Int32 EnvironmentTickCountMask = 0x3fffffff;
1405
1406 /// <summary>
1407 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
1408 /// and negative every 24.9 days. Subtracts the passed value (previously fetched by
1409 /// 'EnvironmentTickCount()') and accounts for any wrapping.
1410 /// </summary>
1411 /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
1412 public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
1413 {
1414 Int32 diff = EnvironmentTickCount() - prevValue;
1415 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
1416 }
1393 } 1417 }
1394} 1418}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 9856a1c..1e5f15a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Threading;
31using log4net; 32using log4net;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenMetaverse; 34using OpenMetaverse;
@@ -429,7 +430,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
429 // Send the packet 430 // Send the packet
430 m_udpServer.SendPacketFinal(nextPacket); 431 m_udpServer.SendPacketFinal(nextPacket);
431 m_nextPackets[i] = null; 432 m_nextPackets[i] = null;
432 packetSent = true; 433 packetSent = true;
434 this.PacketsSent++;
433 } 435 }
434 } 436 }
435 else 437 else
@@ -446,6 +448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
446 // Send the packet 448 // Send the packet
447 m_udpServer.SendPacketFinal(packet); 449 m_udpServer.SendPacketFinal(packet);
448 packetSent = true; 450 packetSent = true;
451 this.PacketsSent++;
449 } 452 }
450 else 453 else
451 { 454 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c12c81b..f5a1e74 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
310 private Thread HeartbeatThread; 310 private Thread HeartbeatThread;
311 private volatile bool shuttingdown; 311 private volatile bool shuttingdown;
312 312
313 private int m_lastUpdate = Environment.TickCount; 313 private int m_lastUpdate;
314 private bool m_firstHeartbeat = true; 314 private bool m_firstHeartbeat = true;
315 315
316 private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; 316 private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
@@ -526,6 +526,7 @@ namespace OpenSim.Region.Framework.Scenes
526 m_regionHandle = m_regInfo.RegionHandle; 526 m_regionHandle = m_regInfo.RegionHandle;
527 m_regionName = m_regInfo.RegionName; 527 m_regionName = m_regInfo.RegionName;
528 m_datastore = m_regInfo.DataStore; 528 m_datastore = m_regInfo.DataStore;
529 m_lastUpdate = Util.EnvironmentTickCount();
529 530
530 m_physicalPrim = physicalPrim; 531 m_physicalPrim = physicalPrim;
531 m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; 532 m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
@@ -735,6 +736,8 @@ namespace OpenSim.Region.Framework.Scenes
735 736
736 m_regInfo = regInfo; 737 m_regInfo = regInfo;
737 m_eventManager = new EventManager(); 738 m_eventManager = new EventManager();
739
740 m_lastUpdate = Util.EnvironmentTickCount();
738 } 741 }
739 742
740 #endregion 743 #endregion
@@ -1101,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes
1101 HeartbeatThread.Abort(); 1104 HeartbeatThread.Abort();
1102 HeartbeatThread = null; 1105 HeartbeatThread = null;
1103 } 1106 }
1104 m_lastUpdate = Environment.TickCount; 1107 m_lastUpdate = Util.EnvironmentTickCount();
1105 1108
1106 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false); 1109 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
1107 } 1110 }
@@ -1142,7 +1145,7 @@ namespace OpenSim.Region.Framework.Scenes
1142 { 1145 {
1143 Update(); 1146 Update();
1144 1147
1145 m_lastUpdate = Environment.TickCount; 1148 m_lastUpdate = Util.EnvironmentTickCount();
1146 m_firstHeartbeat = false; 1149 m_firstHeartbeat = false;
1147 } 1150 }
1148 catch (ThreadAbortException) 1151 catch (ThreadAbortException)
@@ -1170,8 +1173,9 @@ namespace OpenSim.Region.Framework.Scenes
1170 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1173 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1171 physicsFPS = 0f; 1174 physicsFPS = 0f;
1172 1175
1173 maintc = otherMS = Environment.TickCount; 1176 maintc = Util.EnvironmentTickCount();
1174 int tmpFrameMS = maintc; 1177 int tmpFrameMS = maintc;
1178 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1175 1179
1176 // Increment the frame counter 1180 // Increment the frame counter
1177 ++m_frame; 1181 ++m_frame;
@@ -1191,16 +1195,15 @@ namespace OpenSim.Region.Framework.Scenes
1191 if (m_frame % m_update_objects == 0) 1195 if (m_frame % m_update_objects == 0)
1192 m_sceneGraph.UpdateObjectGroups(); 1196 m_sceneGraph.UpdateObjectGroups();
1193 1197
1194 int TempPhysicsMS2 = Environment.TickCount; 1198 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1195 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1199 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1196 m_sceneGraph.UpdatePreparePhysics(); 1200 m_sceneGraph.UpdatePreparePhysics();
1197 TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2; 1201 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1198 physicsMS2 = TempPhysicsMS2;
1199 1202
1200 if (m_frame % m_update_entitymovement == 0) 1203 if (m_frame % m_update_entitymovement == 0)
1201 m_sceneGraph.UpdateScenePresenceMovement(); 1204 m_sceneGraph.UpdateScenePresenceMovement();
1202 1205
1203 int TempPhysicsMS = Environment.TickCount; 1206 int tmpPhysicsMS = Util.EnvironmentTickCount();
1204 if (m_frame % m_update_physics == 0) 1207 if (m_frame % m_update_physics == 0)
1205 { 1208 {
1206 if (m_physics_enabled) 1209 if (m_physics_enabled)
@@ -1208,57 +1211,49 @@ namespace OpenSim.Region.Framework.Scenes
1208 if (SynchronizeScene != null) 1211 if (SynchronizeScene != null)
1209 SynchronizeScene(this); 1212 SynchronizeScene(this);
1210 } 1213 }
1211 TempPhysicsMS = Environment.TickCount - TempPhysicsMS; 1214 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1212 physicsMS = TempPhysicsMS;
1213 1215
1214 // Delete temp-on-rez stuff 1216 // Delete temp-on-rez stuff
1215 if (m_frame % m_update_backup == 0) 1217 if (m_frame % m_update_backup == 0)
1216 { 1218 {
1217 int tozMS = Environment.TickCount; 1219 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1218 CleanTempObjects(); 1220 CleanTempObjects();
1219 tozMS -= Environment.TickCount; 1221 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1220 tempOnRezMS = tozMS;
1221 } 1222 }
1222 1223
1223 if (RegionStatus != RegionStatus.SlaveScene) 1224 if (RegionStatus != RegionStatus.SlaveScene)
1224 { 1225 {
1225 if (m_frame % m_update_events == 0) 1226 if (m_frame % m_update_events == 0)
1226 { 1227 {
1227 int evMS = Environment.TickCount; 1228 int evMS = Util.EnvironmentTickCount();
1228 UpdateEvents(); 1229 UpdateEvents();
1229 evMS -= Environment.TickCount; 1230 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1230 eventMS = evMS;
1231 } 1231 }
1232 1232
1233 if (m_frame % m_update_backup == 0) 1233 if (m_frame % m_update_backup == 0)
1234 { 1234 {
1235 int backMS = Environment.TickCount; 1235 int backMS = Util.EnvironmentTickCount();
1236 UpdateStorageBackup(); 1236 UpdateStorageBackup();
1237 backMS -= Environment.TickCount; 1237 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1238 backupMS = backMS;
1239 } 1238 }
1240 1239
1241 if (m_frame % m_update_terrain == 0) 1240 if (m_frame % m_update_terrain == 0)
1242 { 1241 {
1243 int terMS = Environment.TickCount; 1242 int terMS = Util.EnvironmentTickCount();
1244 UpdateTerrain(); 1243 UpdateTerrain();
1245 terMS -= Environment.TickCount; 1244 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1246 terrainMS = terMS;
1247 } 1245 }
1248 1246
1249 if (m_frame % m_update_land == 0) 1247 if (m_frame % m_update_land == 0)
1250 { 1248 {
1251 int ldMS = Environment.TickCount; 1249 int ldMS = Util.EnvironmentTickCount();
1252 UpdateLand(); 1250 UpdateLand();
1253 ldMS -= Environment.TickCount; 1251 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1254 landMS = ldMS;
1255 } 1252 }
1256 1253
1257 int tickCount = Environment.TickCount; 1254 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1258 otherMS = tickCount - otherMS; 1255 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1259 tmpFrameMS -= tickCount; 1256 lastCompletedFrame = Util.EnvironmentTickCount();
1260 frameMS = tmpFrameMS;
1261 lastCompletedFrame = tickCount;
1262 1257
1263 // if (m_frame%m_update_avatars == 0) 1258 // if (m_frame%m_update_avatars == 0)
1264 // UpdateInWorldTime(); 1259 // UpdateInWorldTime();
@@ -1311,8 +1306,8 @@ namespace OpenSim.Region.Framework.Scenes
1311 { 1306 {
1312 m_lastupdate = DateTime.UtcNow; 1307 m_lastupdate = DateTime.UtcNow;
1313 } 1308 }
1314 1309
1315 maintc = Environment.TickCount - maintc; 1310 maintc = Util.EnvironmentTickCountSubtract(maintc);
1316 maintc = (int)(m_timespan * 1000) - maintc; 1311 maintc = (int)(m_timespan * 1000) - maintc;
1317 1312
1318 if ((maintc < (m_timespan * 1000)) && maintc > 0) 1313 if ((maintc < (m_timespan * 1000)) && maintc > 0)
@@ -1323,6 +1318,7 @@ namespace OpenSim.Region.Framework.Scenes
1323 } 1318 }
1324 } 1319 }
1325 1320
1321
1326 1322
1327 public void AddGroupTarget(SceneObjectGroup grp) 1323 public void AddGroupTarget(SceneObjectGroup grp)
1328 { 1324 {
@@ -2599,7 +2595,7 @@ namespace OpenSim.Region.Framework.Scenes
2599 } 2595 }
2600 } 2596 }
2601 2597
2602 m_LastLogin = Environment.TickCount; 2598 m_LastLogin = Util.EnvironmentTickCount();
2603 EventManager.TriggerOnNewClient(client); 2599 EventManager.TriggerOnNewClient(client);
2604 } 2600 }
2605 2601
@@ -4668,14 +4664,14 @@ namespace OpenSim.Region.Framework.Scenes
4668 // 4664 //
4669 int health=1; // Start at 1, means we're up 4665 int health=1; // Start at 1, means we're up
4670 4666
4671 if ((Environment.TickCount - m_lastUpdate) < 1000) 4667 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
4672 health+=1; 4668 health+=1;
4673 else 4669 else
4674 return health; 4670 return health;
4675 4671
4676 // A login in the last 4 mins? We can't be doing too badly 4672 // A login in the last 4 mins? We can't be doing too badly
4677 // 4673 //
4678 if ((Environment.TickCount - m_LastLogin) < 240000) 4674 if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
4679 health++; 4675 health++;
4680 else 4676 else
4681 return health; 4677 return health;
@@ -4873,7 +4869,7 @@ namespace OpenSim.Region.Framework.Scenes
4873 if (m_firstHeartbeat) 4869 if (m_firstHeartbeat)
4874 return; 4870 return;
4875 4871
4876 if (System.Environment.TickCount - m_lastUpdate > 2000) 4872 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4877 StartTimer(); 4873 StartTimer();
4878 } 4874 }
4879 } 4875 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cebd108..6812914 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -790,13 +790,37 @@ namespace OpenSim.Region.Framework.Scenes
790 /// </summary> 790 /// </summary>
791 public void SendPrimUpdates() 791 public void SendPrimUpdates()
792 { 792 {
793 m_perfMonMS = Environment.TickCount; 793 m_perfMonMS = EnvironmentTickCount();
794 794
795 m_sceneViewer.SendPrimUpdates(); 795 m_sceneViewer.SendPrimUpdates();
796 796
797 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 797 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
798 } 798 }
799 799
800 /// <summary>
801 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
802 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
803 /// for the callers.
804 /// This trims it to a 12 day interval so don't let your frame time get too long.
805 /// </summary>
806 /// <returns></returns>
807 const Int32 EnvironmentTickCountMask = 0x3fffffff;
808 private static Int32 EnvironmentTickCount() {
809 return Environment.TickCount & EnvironmentTickCountMask;
810 }
811
812 /// <summary>
813 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
814 /// and negative every 24.9 days. Subtracts the passed value (previously fetched by
815 /// 'EnvironmentTickCount()') and accounts for any wrapping.
816 /// </summary>
817 /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
818 private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
819 Int32 diff = EnvironmentTickCount() - prevValue;
820 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
821 }
822
823
800 #region Status Methods 824 #region Status Methods
801 825
802 /// <summary> 826 /// <summary>
@@ -1184,7 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes
1184 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1208 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
1185 // return; 1209 // return;
1186 //} 1210 //}
1187 m_perfMonMS = Environment.TickCount; 1211
1212 m_perfMonMS = EnvironmentTickCount();
1188 1213
1189 ++m_movementUpdateCount; 1214 ++m_movementUpdateCount;
1190 if (m_movementUpdateCount < 1) 1215 if (m_movementUpdateCount < 1)
@@ -1514,7 +1539,7 @@ namespace OpenSim.Region.Framework.Scenes
1514 1539
1515 m_scene.EventManager.TriggerOnClientMovement(this); 1540 m_scene.EventManager.TriggerOnClientMovement(this);
1516 1541
1517 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 1542 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
1518 } 1543 }
1519 1544
1520 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) 1545 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@@ -2032,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes
2032 return; 2057 return;
2033 } 2058 }
2034 2059
2035 m_perfMonMS = Environment.TickCount; 2060 m_perfMonMS = EnvironmentTickCount();
2036 2061
2037 Rotation = rotation; 2062 Rotation = rotation;
2038 Vector3 direc = vec * rotation; 2063 Vector3 direc = vec * rotation;
@@ -2074,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes
2074 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2099 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2075 m_forceToApply = direc; 2100 m_forceToApply = direc;
2076 m_isNudging = Nudging; 2101 m_isNudging = Nudging;
2077 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2102 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCount() - m_perfMonMS);
2078 } 2103 }
2079 2104
2080 #endregion 2105 #endregion
@@ -2143,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes
2143 // server. 2168 // server.
2144 if (remoteClient.IsActive) 2169 if (remoteClient.IsActive)
2145 { 2170 {
2146 m_perfMonMS = Environment.TickCount; 2171 m_perfMonMS = EnvironmentTickCount();
2147 2172
2148 PhysicsActor actor = m_physicsActor; 2173 PhysicsActor actor = m_physicsActor;
2149 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; 2174 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@@ -2156,7 +2181,7 @@ namespace OpenSim.Region.Framework.Scenes
2156 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2181 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2157 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); 2182 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
2158 2183
2159 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2184 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2160 m_scene.StatsReporter.AddAgentUpdates(1); 2185 m_scene.StatsReporter.AddAgentUpdates(1);
2161 } 2186 }
2162 } 2187 }
@@ -2166,11 +2191,11 @@ namespace OpenSim.Region.Framework.Scenes
2166 /// </summary> 2191 /// </summary>
2167 public void SendTerseUpdateToAllClients() 2192 public void SendTerseUpdateToAllClients()
2168 { 2193 {
2169 m_perfMonMS = Environment.TickCount; 2194 m_perfMonMS = EnvironmentTickCount();
2170 2195
2171 m_scene.ForEachClient(SendTerseUpdateToClient); 2196 m_scene.ForEachClient(SendTerseUpdateToClient);
2172 2197
2173 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2198 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2174 } 2199 }
2175 2200
2176 public void SendCoarseLocations() 2201 public void SendCoarseLocations()
@@ -2190,7 +2215,7 @@ namespace OpenSim.Region.Framework.Scenes
2190 2215
2191 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) 2216 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
2192 { 2217 {
2193 m_perfMonMS = Environment.TickCount; 2218 m_perfMonMS = EnvironmentTickCount();
2194 2219
2195 List<Vector3> CoarseLocations = new List<Vector3>(); 2220 List<Vector3> CoarseLocations = new List<Vector3>();
2196 List<UUID> AvatarUUIDs = new List<UUID>(); 2221 List<UUID> AvatarUUIDs = new List<UUID>();
@@ -2226,7 +2251,7 @@ namespace OpenSim.Region.Framework.Scenes
2226 2251
2227 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); 2252 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2228 2253
2229 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2254 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2230 } 2255 }
2231 2256
2232 public void CoarseLocationChange() 2257 public void CoarseLocationChange()
@@ -2263,7 +2288,7 @@ namespace OpenSim.Region.Framework.Scenes
2263 /// </summary> 2288 /// </summary>
2264 public void SendInitialFullUpdateToAllClients() 2289 public void SendInitialFullUpdateToAllClients()
2265 { 2290 {
2266 m_perfMonMS = Environment.TickCount; 2291 m_perfMonMS = EnvironmentTickCount();
2267 2292
2268 ScenePresence[] avatars = m_scene.GetScenePresences(); 2293 ScenePresence[] avatars = m_scene.GetScenePresences();
2269 2294
@@ -2289,14 +2314,14 @@ namespace OpenSim.Region.Framework.Scenes
2289 } 2314 }
2290 2315
2291 m_scene.StatsReporter.AddAgentUpdates(avatars.Length); 2316 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2292 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2317 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2293 2318
2294 //Animator.SendAnimPack(); 2319 //Animator.SendAnimPack();
2295 } 2320 }
2296 2321
2297 public void SendFullUpdateToAllClients() 2322 public void SendFullUpdateToAllClients()
2298 { 2323 {
2299 m_perfMonMS = Environment.TickCount; 2324 m_perfMonMS = EnvironmentTickCount();
2300 2325
2301 // only send update from root agents to other clients; children are only "listening posts" 2326 // only send update from root agents to other clients; children are only "listening posts"
2302 List<ScenePresence> avatars = m_scene.GetAvatars(); 2327 List<ScenePresence> avatars = m_scene.GetAvatars();
@@ -2306,7 +2331,7 @@ namespace OpenSim.Region.Framework.Scenes
2306 2331
2307 } 2332 }
2308 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2333 m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
2309 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2334 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2310 2335
2311 Animator.SendAnimPack(); 2336 Animator.SendAnimPack();
2312 } 2337 }
@@ -2348,7 +2373,7 @@ namespace OpenSim.Region.Framework.Scenes
2348 /// </summary> 2373 /// </summary>
2349 public void SendAppearanceToAllOtherAgents() 2374 public void SendAppearanceToAllOtherAgents()
2350 { 2375 {
2351 m_perfMonMS = Environment.TickCount; 2376 m_perfMonMS = EnvironmentTickCount();
2352 2377
2353 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2378 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2354 { 2379 {
@@ -2358,7 +2383,7 @@ namespace OpenSim.Region.Framework.Scenes
2358 } 2383 }
2359 }); 2384 });
2360 2385
2361 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2386 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2362 } 2387 }
2363 2388
2364 /// <summary> 2389 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 3b5455f..f92f440 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -193,6 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
193 // / 10 divides the value by the number of times the sim heartbeat runs (10fps) 193 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
194 // Then we divide the whole amount by the amount of seconds pass in between stats updates. 194 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
195 195
196 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
197 // values to X-per-second values.
198
196 for (int i = 0; i<21;i++) 199 for (int i = 0; i<21;i++)
197 { 200 {
198 sb[i] = new SimStatsPacket.StatBlock(); 201 sb[i] = new SimStatsPacket.StatBlock();
@@ -237,7 +240,7 @@ namespace OpenSim.Region.Framework.Scenes
237 sb[12].StatID = (uint)Stats.OtherMS; 240 sb[12].StatID = (uint)Stats.OtherMS;
238 sb[12].StatValue = m_otherMS / statsUpdateFactor; 241 sb[12].StatValue = m_otherMS / statsUpdateFactor;
239 242
240 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 243 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
241 sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); 244 sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
242 245
243 sb[14].StatID = (uint)Stats.OutPacketsPerSecond; 246 sb[14].StatID = (uint)Stats.OutPacketsPerSecond;