aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-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.cs118
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs5
6 files changed, 305 insertions, 254 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 87ba5a8..a459f8d 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 fbabb5c..a3f3d8f 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
@@ -1089,7 +1092,7 @@ namespace OpenSim.Region.Framework.Scenes
1089 HeartbeatThread.Abort(); 1092 HeartbeatThread.Abort();
1090 HeartbeatThread = null; 1093 HeartbeatThread = null;
1091 } 1094 }
1092 m_lastUpdate = Environment.TickCount; 1095 m_lastUpdate = Util.EnvironmentTickCount();
1093 1096
1094 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false); 1097 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
1095 } 1098 }
@@ -1130,7 +1133,7 @@ namespace OpenSim.Region.Framework.Scenes
1130 { 1133 {
1131 Update(); 1134 Update();
1132 1135
1133 m_lastUpdate = Environment.TickCount; 1136 m_lastUpdate = Util.EnvironmentTickCount();
1134 m_firstHeartbeat = false; 1137 m_firstHeartbeat = false;
1135 } 1138 }
1136 catch (ThreadAbortException) 1139 catch (ThreadAbortException)
@@ -1156,10 +1159,11 @@ namespace OpenSim.Region.Framework.Scenes
1156 while (!shuttingdown) 1159 while (!shuttingdown)
1157 { 1160 {
1158 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1161 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1159 physicsFPS = 0f; 1162 physicsFPS = 0f;
1160 1163
1161 maintc = otherMS = Environment.TickCount; 1164 maintc = Util.EnvironmentTickCount();
1162 int tmpFrameMS = maintc; 1165 int tmpFrameMS = maintc;
1166 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1163 1167
1164 // Increment the frame counter 1168 // Increment the frame counter
1165 ++m_frame; 1169 ++m_frame;
@@ -1179,74 +1183,65 @@ namespace OpenSim.Region.Framework.Scenes
1179 if (m_frame % m_update_presences == 0) 1183 if (m_frame % m_update_presences == 0)
1180 m_sceneGraph.UpdatePresences(); 1184 m_sceneGraph.UpdatePresences();
1181 1185
1182 int TempPhysicsMS2 = Environment.TickCount; 1186 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1183 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1187 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1184 m_sceneGraph.UpdatePreparePhysics(); 1188 m_sceneGraph.UpdatePreparePhysics();
1185 TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2; 1189 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1186 physicsMS2 = TempPhysicsMS2;
1187 1190
1188 if (m_frame % m_update_entitymovement == 0) 1191 if (m_frame % m_update_entitymovement == 0)
1189 m_sceneGraph.UpdateScenePresenceMovement(); 1192 m_sceneGraph.UpdateScenePresenceMovement();
1190 1193
1191 int TempPhysicsMS = Environment.TickCount; 1194 int tmpPhysicsMS = Util.EnvironmentTickCount();
1192 if (m_frame % m_update_physics == 0) 1195 if (m_frame % m_update_physics == 0)
1193 { 1196 {
1194 if (m_physics_enabled) 1197 if (m_physics_enabled)
1195 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1198 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
1196 if (SynchronizeScene != null) 1199 if (SynchronizeScene != null)
1197 SynchronizeScene(this); 1200 SynchronizeScene(this);
1198 } 1201 }
1199 TempPhysicsMS = Environment.TickCount - TempPhysicsMS; 1202 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1200 physicsMS = TempPhysicsMS;
1201 1203
1202 // Delete temp-on-rez stuff 1204 // Delete temp-on-rez stuff
1203 if (m_frame % m_update_backup == 0) 1205 if (m_frame % m_update_backup == 0)
1204 { 1206 {
1205 int tozMS = Environment.TickCount; 1207 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1206 CleanTempObjects(); 1208 CleanTempObjects();
1207 tozMS -= Environment.TickCount; 1209 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1208 tempOnRezMS = tozMS;
1209 } 1210 }
1210 1211
1211 if (RegionStatus != RegionStatus.SlaveScene) 1212 if (RegionStatus != RegionStatus.SlaveScene)
1212 { 1213 {
1213 if (m_frame % m_update_events == 0) 1214 if (m_frame % m_update_events == 0)
1214 { 1215 {
1215 int evMS = Environment.TickCount; 1216 int evMS = Util.EnvironmentTickCount();
1216 UpdateEvents(); 1217 UpdateEvents();
1217 evMS -= Environment.TickCount; 1218 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1218 eventMS = evMS;
1219 } 1219 }
1220 1220
1221 if (m_frame % m_update_backup == 0) 1221 if (m_frame % m_update_backup == 0)
1222 { 1222 {
1223 int backMS = Environment.TickCount; 1223 int backMS = Util.EnvironmentTickCount();
1224 UpdateStorageBackup(); 1224 UpdateStorageBackup();
1225 backMS -= Environment.TickCount; 1225 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1226 backupMS = backMS;
1227 } 1226 }
1228 1227
1229 if (m_frame % m_update_terrain == 0) 1228 if (m_frame % m_update_terrain == 0)
1230 { 1229 {
1231 int terMS = Environment.TickCount; 1230 int terMS = Util.EnvironmentTickCount();
1232 UpdateTerrain(); 1231 UpdateTerrain();
1233 terMS -= Environment.TickCount; 1232 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1234 terrainMS = terMS;
1235 } 1233 }
1236 1234
1237 if (m_frame % m_update_land == 0) 1235 if (m_frame % m_update_land == 0)
1238 { 1236 {
1239 int ldMS = Environment.TickCount; 1237 int ldMS = Util.EnvironmentTickCount();
1240 UpdateLand(); 1238 UpdateLand();
1241 ldMS -= Environment.TickCount; 1239 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1242 landMS = ldMS; 1240 }
1243 } 1241
1244 1242 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1245 int tickCount = Environment.TickCount; 1243 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1246 otherMS = tickCount - otherMS; 1244 lastCompletedFrame = Util.EnvironmentTickCount();
1247 tmpFrameMS -= tickCount;
1248 frameMS = tmpFrameMS;
1249 lastCompletedFrame = tickCount;
1250 1245
1251 // if (m_frame%m_update_avatars == 0) 1246 // if (m_frame%m_update_avatars == 0)
1252 // UpdateInWorldTime(); 1247 // UpdateInWorldTime();
@@ -1298,9 +1293,9 @@ namespace OpenSim.Region.Framework.Scenes
1298 finally 1293 finally
1299 { 1294 {
1300 m_lastupdate = DateTime.UtcNow; 1295 m_lastupdate = DateTime.UtcNow;
1301 } 1296 }
1302 1297
1303 maintc = Environment.TickCount - maintc; 1298 maintc = Util.EnvironmentTickCountSubtract(maintc);
1304 maintc = (int)(m_timespan * 1000) - maintc; 1299 maintc = (int)(m_timespan * 1000) - maintc;
1305 1300
1306 if ((maintc < (m_timespan * 1000)) && maintc > 0) 1301 if ((maintc < (m_timespan * 1000)) && maintc > 0)
@@ -1311,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
1311 } 1306 }
1312 } 1307 }
1313 1308
1309
1314 1310
1315 public void AddGroupTarget(SceneObjectGroup grp) 1311 public void AddGroupTarget(SceneObjectGroup grp)
1316 { 1312 {
@@ -2585,9 +2581,9 @@ namespace OpenSim.Region.Framework.Scenes
2585 sp.IsChildAgent = false; 2581 sp.IsChildAgent = false;
2586 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); 2582 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2587 } 2583 }
2588 } 2584 }
2589 2585
2590 m_LastLogin = Environment.TickCount; 2586 m_LastLogin = Util.EnvironmentTickCount();
2591 EventManager.TriggerOnNewClient(client); 2587 EventManager.TriggerOnNewClient(client);
2592 } 2588 }
2593 2589
@@ -4654,16 +4650,16 @@ namespace OpenSim.Region.Framework.Scenes
4654 // 3 = We have seen a new user enter within the past 4 minutes 4650 // 3 = We have seen a new user enter within the past 4 minutes
4655 // which can be seen as positive confirmation of sim health 4651 // which can be seen as positive confirmation of sim health
4656 // 4652 //
4657 int health=1; // Start at 1, means we're up 4653 int health=1; // Start at 1, means we're up
4658 4654
4659 if ((Environment.TickCount - m_lastUpdate) < 1000) 4655 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
4660 health+=1; 4656 health+=1;
4661 else 4657 else
4662 return health; 4658 return health;
4663 4659
4664 // A login in the last 4 mins? We can't be doing too badly 4660 // A login in the last 4 mins? We can't be doing too badly
4665 // 4661 //
4666 if ((Environment.TickCount - m_LastLogin) < 240000) 4662 if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
4667 health++; 4663 health++;
4668 else 4664 else
4669 return health; 4665 return health;
@@ -4859,9 +4855,9 @@ namespace OpenSim.Region.Framework.Scenes
4859 private void CheckHeartbeat() 4855 private void CheckHeartbeat()
4860 { 4856 {
4861 if (m_firstHeartbeat) 4857 if (m_firstHeartbeat)
4862 return; 4858 return;
4863 4859
4864 if (System.Environment.TickCount - m_lastUpdate > 2000) 4860 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4865 StartTimer(); 4861 StartTimer();
4866 } 4862 }
4867 } 4863 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5604e3d..bcad335 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -755,13 +755,37 @@ namespace OpenSim.Region.Framework.Scenes
755 /// </summary> 755 /// </summary>
756 public void SendPrimUpdates() 756 public void SendPrimUpdates()
757 { 757 {
758 m_perfMonMS = Environment.TickCount; 758 m_perfMonMS = EnvironmentTickCount();
759 759
760 m_sceneViewer.SendPrimUpdates(); 760 m_sceneViewer.SendPrimUpdates();
761 761
762 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 762 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
763 } 763 }
764 764
765 /// <summary>
766 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
767 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
768 /// for the callers.
769 /// This trims it to a 12 day interval so don't let your frame time get too long.
770 /// </summary>
771 /// <returns></returns>
772 const Int32 EnvironmentTickCountMask = 0x3fffffff;
773 private static Int32 EnvironmentTickCount() {
774 return Environment.TickCount & EnvironmentTickCountMask;
775 }
776
777 /// <summary>
778 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
779 /// and negative every 24.9 days. Subtracts the passed value (previously fetched by
780 /// 'EnvironmentTickCount()') and accounts for any wrapping.
781 /// </summary>
782 /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
783 private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
784 Int32 diff = EnvironmentTickCount() - prevValue;
785 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
786 }
787
788
765 #region Status Methods 789 #region Status Methods
766 790
767 /// <summary> 791 /// <summary>
@@ -1148,7 +1172,7 @@ namespace OpenSim.Region.Framework.Scenes
1148 // return; 1172 // return;
1149 //} 1173 //}
1150 1174
1151 m_perfMonMS = Environment.TickCount; 1175 m_perfMonMS = EnvironmentTickCount();
1152 1176
1153 ++m_movementUpdateCount; 1177 ++m_movementUpdateCount;
1154 if (m_movementUpdateCount < 1) 1178 if (m_movementUpdateCount < 1)
@@ -1464,7 +1488,7 @@ namespace OpenSim.Region.Framework.Scenes
1464 1488
1465 m_scene.EventManager.TriggerOnClientMovement(this); 1489 m_scene.EventManager.TriggerOnClientMovement(this);
1466 1490
1467 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 1491 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
1468 } 1492 }
1469 1493
1470 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) 1494 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@@ -1924,7 +1948,7 @@ namespace OpenSim.Region.Framework.Scenes
1924 return; 1948 return;
1925 } 1949 }
1926 1950
1927 m_perfMonMS = Environment.TickCount; 1951 m_perfMonMS = EnvironmentTickCount();
1928 1952
1929 Rotation = rotation; 1953 Rotation = rotation;
1930 Vector3 direc = vec * rotation; 1954 Vector3 direc = vec * rotation;
@@ -1966,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
1966 // TODO: Add the force instead of only setting it to support multiple forces per frame? 1990 // TODO: Add the force instead of only setting it to support multiple forces per frame?
1967 m_forceToApply = direc; 1991 m_forceToApply = direc;
1968 1992
1969 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 1993 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
1970 } 1994 }
1971 1995
1972 #endregion 1996 #endregion
@@ -2032,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
2032 // server. 2056 // server.
2033 if (remoteClient.IsActive) 2057 if (remoteClient.IsActive)
2034 { 2058 {
2035 m_perfMonMS = Environment.TickCount; 2059 m_perfMonMS = EnvironmentTickCount();
2036 2060
2037 PhysicsActor actor = m_physicsActor; 2061 PhysicsActor actor = m_physicsActor;
2038 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; 2062 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@@ -2045,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes
2045 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2069 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2046 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); 2070 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
2047 2071
2048 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2072 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2049 m_scene.StatsReporter.AddAgentUpdates(1); 2073 m_scene.StatsReporter.AddAgentUpdates(1);
2050 } 2074 }
2051 } 2075 }
@@ -2055,11 +2079,11 @@ namespace OpenSim.Region.Framework.Scenes
2055 /// </summary> 2079 /// </summary>
2056 public void SendTerseUpdateToAllClients() 2080 public void SendTerseUpdateToAllClients()
2057 { 2081 {
2058 m_perfMonMS = Environment.TickCount; 2082 m_perfMonMS = EnvironmentTickCount();
2059 2083
2060 m_scene.ForEachClient(SendTerseUpdateToClient); 2084 m_scene.ForEachClient(SendTerseUpdateToClient);
2061 2085
2062 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2086 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2063 } 2087 }
2064 2088
2065 public void SendCoarseLocations() 2089 public void SendCoarseLocations()
@@ -2079,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
2079 2103
2080 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) 2104 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
2081 { 2105 {
2082 m_perfMonMS = Environment.TickCount; 2106 m_perfMonMS = EnvironmentTickCount();
2083 2107
2084 List<Vector3> CoarseLocations = new List<Vector3>(); 2108 List<Vector3> CoarseLocations = new List<Vector3>();
2085 List<UUID> AvatarUUIDs = new List<UUID>(); 2109 List<UUID> AvatarUUIDs = new List<UUID>();
@@ -2115,7 +2139,7 @@ namespace OpenSim.Region.Framework.Scenes
2115 2139
2116 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); 2140 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2117 2141
2118 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2142 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2119 } 2143 }
2120 2144
2121 public void CoarseLocationChange() 2145 public void CoarseLocationChange()
@@ -2152,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes
2152 /// </summary> 2176 /// </summary>
2153 public void SendInitialFullUpdateToAllClients() 2177 public void SendInitialFullUpdateToAllClients()
2154 { 2178 {
2155 m_perfMonMS = Environment.TickCount; 2179 m_perfMonMS = EnvironmentTickCount();
2156 2180
2157 ScenePresence[] avatars = m_scene.GetScenePresences(); 2181 ScenePresence[] avatars = m_scene.GetScenePresences();
2158 2182
@@ -2178,14 +2202,14 @@ namespace OpenSim.Region.Framework.Scenes
2178 } 2202 }
2179 2203
2180 m_scene.StatsReporter.AddAgentUpdates(avatars.Length); 2204 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2181 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2205 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2182 2206
2183 //Animator.SendAnimPack(); 2207 //Animator.SendAnimPack();
2184 } 2208 }
2185 2209
2186 public void SendFullUpdateToAllClients() 2210 public void SendFullUpdateToAllClients()
2187 { 2211 {
2188 m_perfMonMS = Environment.TickCount; 2212 m_perfMonMS = EnvironmentTickCount();
2189 2213
2190 // only send update from root agents to other clients; children are only "listening posts" 2214 // only send update from root agents to other clients; children are only "listening posts"
2191 List<ScenePresence> avatars = m_scene.GetAvatars(); 2215 List<ScenePresence> avatars = m_scene.GetAvatars();
@@ -2195,7 +2219,7 @@ namespace OpenSim.Region.Framework.Scenes
2195 2219
2196 } 2220 }
2197 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2221 m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
2198 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2222 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2199 2223
2200 Animator.SendAnimPack(); 2224 Animator.SendAnimPack();
2201 } 2225 }
@@ -2237,7 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
2237 /// </summary> 2261 /// </summary>
2238 public void SendAppearanceToAllOtherAgents() 2262 public void SendAppearanceToAllOtherAgents()
2239 { 2263 {
2240 m_perfMonMS = Environment.TickCount; 2264 m_perfMonMS = EnvironmentTickCount();
2241 2265
2242 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2266 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2243 { 2267 {
@@ -2247,7 +2271,7 @@ namespace OpenSim.Region.Framework.Scenes
2247 } 2271 }
2248 }); 2272 });
2249 2273
2250 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2274 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2251 } 2275 }
2252 2276
2253 /// <summary> 2277 /// <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;