aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDan Lake2011-10-06 12:22:15 -0700
committerDan Lake2011-10-06 12:22:15 -0700
commit08f264d096e1dca535a64e683fa5ab5918368085 (patch)
tree0e898f21be0cca8a6249f78e534c9ec3a98528e2 /OpenSim
parentRefactor ScenePresence so gets and sets are through properties. Added private... (diff)
parentAdded back UserAccount that creates random UUID for new account. (diff)
downloadopensim-SC-08f264d096e1dca535a64e683fa5ab5918368085.zip
opensim-SC-08f264d096e1dca535a64e683fa5ab5918368085.tar.gz
opensim-SC-08f264d096e1dca535a64e683fa5ab5918368085.tar.bz2
opensim-SC-08f264d096e1dca535a64e683fa5ab5918368085.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs35
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs3
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs63
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs11
8 files changed, 87 insertions, 109 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index a6b91a3..6fba71e 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -462,7 +462,7 @@ namespace OpenSim
462 string password = MainConsole.Instance.PasswdPrompt("Password"); 462 string password = MainConsole.Instance.PasswdPrompt("Password");
463 string email = MainConsole.Instance.CmdPrompt("Email", ""); 463 string email = MainConsole.Instance.CmdPrompt("Email", "");
464 464
465 string rawPrincipalId = MainConsole.Instance.CmdPrompt("ID", UUID.Random().ToString()); 465 string rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
466 466
467 UUID principalId = UUID.Zero; 467 UUID principalId = UUID.Zero;
468 if (!UUID.TryParse(rawPrincipalId, out principalId)) 468 if (!UUID.TryParse(rawPrincipalId, out principalId))
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 29a54e8..b1755ac 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,8 +137,6 @@ namespace OpenSim.Region.Framework.Scenes
137 protected IDialogModule m_dialogModule; 137 protected IDialogModule m_dialogModule;
138 protected IEntityTransferModule m_teleportModule; 138 protected IEntityTransferModule m_teleportModule;
139 protected ICapabilitiesModule m_capsModule; 139 protected ICapabilitiesModule m_capsModule;
140 // Central Update Loop
141 protected int m_fps = 10;
142 140
143 /// <summary> 141 /// <summary>
144 /// Current scene frame number 142 /// Current scene frame number
@@ -149,8 +147,20 @@ namespace OpenSim.Region.Framework.Scenes
149 protected set; 147 protected set;
150 } 148 }
151 149
152 protected float m_timespan = 0.089f; 150 /// <summary>
153 protected DateTime m_lastupdate = DateTime.UtcNow; 151 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we
152 /// will sleep for the remaining period.
153 /// </summary>
154 /// <remarks>
155 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
156 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
157 /// </remarks>
158 protected float m_minFrameTimespan = 0.089f;
159
160 /// <summary>
161 /// The time of the last frame update.
162 /// </summary>
163 protected DateTime m_lastFrameUpdate = DateTime.UtcNow;
154 164
155 // TODO: Possibly stop other classes being able to manipulate this directly. 165 // TODO: Possibly stop other classes being able to manipulate this directly.
156 private SceneGraph m_sceneGraph; 166 private SceneGraph m_sceneGraph;
@@ -173,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
173// private int m_update_land = 1; 183// private int m_update_land = 1;
174 private int m_update_coarse_locations = 50; 184 private int m_update_coarse_locations = 50;
175 185
186 private int agentMS;
176 private int frameMS; 187 private int frameMS;
177 private int physicsMS2; 188 private int physicsMS2;
178 private int physicsMS; 189 private int physicsMS;
@@ -1211,17 +1222,20 @@ namespace OpenSim.Region.Framework.Scenes
1211 1222
1212 public override void Update() 1223 public override void Update()
1213 { 1224 {
1214 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1225 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
1215 float physicsFPS = 0f; 1226 float physicsFPS = 0f;
1216 1227
1217 int maintc = Util.EnvironmentTickCount(); 1228 int maintc = Util.EnvironmentTickCount();
1218 int tmpFrameMS = maintc; 1229 int tmpFrameMS = maintc;
1219 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1230 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1220 1231
1232 // TODO: ADD AGENT TIME HERE
1221 // Increment the frame counter 1233 // Increment the frame counter
1222 ++Frame; 1234 ++Frame;
1223 try 1235 try
1224 { 1236 {
1237 int tmpAgentMS = Util.EnvironmentTickCount();
1238
1225 // Check if any objects have reached their targets 1239 // Check if any objects have reached their targets
1226 CheckAtTargets(); 1240 CheckAtTargets();
1227 1241
@@ -1248,6 +1262,8 @@ namespace OpenSim.Region.Framework.Scenes
1248 }); 1262 });
1249 } 1263 }
1250 1264
1265 agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS);
1266
1251 int tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1267 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1252 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1268 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1253 m_sceneGraph.UpdatePreparePhysics(); 1269 m_sceneGraph.UpdatePreparePhysics();
@@ -1255,7 +1271,11 @@ namespace OpenSim.Region.Framework.Scenes
1255 1271
1256 // Apply any pending avatar force input to the avatar's velocity 1272 // Apply any pending avatar force input to the avatar's velocity
1257 if (Frame % m_update_entitymovement == 0) 1273 if (Frame % m_update_entitymovement == 0)
1274 {
1275 tmpAgentMS = Util.EnvironmentTickCount();
1258 m_sceneGraph.UpdateScenePresenceMovement(); 1276 m_sceneGraph.UpdateScenePresenceMovement();
1277 agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS);
1278 }
1259 1279
1260 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1280 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1261 // velocity 1281 // velocity
@@ -1263,7 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes
1263 if (Frame % m_update_physics == 0) 1283 if (Frame % m_update_physics == 0)
1264 { 1284 {
1265 if (m_physics_enabled) 1285 if (m_physics_enabled)
1266 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1286 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan));
1267 if (SynchronizeScene != null) 1287 if (SynchronizeScene != null)
1268 SynchronizeScene(this); 1288 SynchronizeScene(this);
1269 } 1289 }
@@ -1320,6 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes
1320 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); 1340 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
1321 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); 1341 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
1322 StatsReporter.addFrameMS(frameMS); 1342 StatsReporter.addFrameMS(frameMS);
1343 StatsReporter.addAgentMS(agentMS);
1323 StatsReporter.addPhysicsMS(physicsMS + physicsMS2); 1344 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1324 StatsReporter.addOtherMS(otherMS); 1345 StatsReporter.addOtherMS(otherMS);
1325 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); 1346 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
@@ -1379,11 +1400,11 @@ namespace OpenSim.Region.Framework.Scenes
1379 } 1400 }
1380 finally 1401 finally
1381 { 1402 {
1382 m_lastupdate = DateTime.UtcNow; 1403 m_lastFrameUpdate = DateTime.UtcNow;
1383 } 1404 }
1384 1405
1385 maintc = Util.EnvironmentTickCountSubtract(maintc); 1406 maintc = Util.EnvironmentTickCountSubtract(maintc);
1386 maintc = (int)(m_timespan * 1000) - maintc; 1407 maintc = (int)(m_minFrameTimespan * 1000) - maintc;
1387 1408
1388 if (maintc > 0) 1409 if (maintc > 0)
1389 Thread.Sleep(maintc); 1410 Thread.Sleep(maintc);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 36c5c52..caec704 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -166,6 +166,12 @@ namespace OpenSim.Region.Framework.Scenes
166 } 166 }
167 } 167 }
168 168
169 /// <summary>
170 /// Update the position of all the scene presences.
171 /// </summary>
172 /// <remarks>
173 /// Called only from the main scene loop.
174 /// </remarks>
169 protected internal void UpdatePresences() 175 protected internal void UpdatePresences()
170 { 176 {
171 ForEachScenePresence(delegate(ScenePresence presence) 177 ForEachScenePresence(delegate(ScenePresence presence)
@@ -174,6 +180,11 @@ namespace OpenSim.Region.Framework.Scenes
174 }); 180 });
175 } 181 }
176 182
183 /// <summary>
184 /// Perform a physics frame update.
185 /// </summary>
186 /// <param name="elapsed"></param>
187 /// <returns></returns>
177 protected internal float UpdatePhysics(double elapsed) 188 protected internal float UpdatePhysics(double elapsed)
178 { 189 {
179 lock (m_syncRoot) 190 lock (m_syncRoot)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0290576..ce63946 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -870,11 +870,7 @@ namespace OpenSim.Region.Framework.Scenes
870 /// </summary> 870 /// </summary>
871 public void SendPrimUpdates() 871 public void SendPrimUpdates()
872 { 872 {
873 m_perfMonMS = Util.EnvironmentTickCount();
874
875 SceneViewer.SendPrimUpdates(); 873 SceneViewer.SendPrimUpdates();
876
877 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
878 } 874 }
879 875
880 #region Status Methods 876 #region Status Methods
@@ -1276,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes
1276 // return; 1272 // return;
1277 //} 1273 //}
1278 1274
1279 m_perfMonMS = Util.EnvironmentTickCount(); 1275// m_perfMonMS = Util.EnvironmentTickCount();
1280 1276
1281 ++m_movementUpdateCount; 1277 ++m_movementUpdateCount;
1282 if (m_movementUpdateCount < 1) 1278 if (m_movementUpdateCount < 1)
@@ -1565,7 +1561,8 @@ namespace OpenSim.Region.Framework.Scenes
1565 1561
1566 m_scene.EventManager.TriggerOnClientMovement(this); 1562 m_scene.EventManager.TriggerOnClientMovement(this);
1567 1563
1568 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 1564 // It doesn't make sense to add this to frame stats as this update is processed indepedently of the scene loop
1565// m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
1569 } 1566 }
1570 1567
1571 /// <summary> 1568 /// <summary>
@@ -2341,8 +2338,6 @@ namespace OpenSim.Region.Framework.Scenes
2341 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2338 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2342 public void AddNewMovement(Vector3 vec) 2339 public void AddNewMovement(Vector3 vec)
2343 { 2340 {
2344 m_perfMonMS = Util.EnvironmentTickCount();
2345
2346 Vector3 direc = vec * Rotation; 2341 Vector3 direc = vec * Rotation;
2347 direc.Normalize(); 2342 direc.Normalize();
2348 2343
@@ -2379,8 +2374,6 @@ namespace OpenSim.Region.Framework.Scenes
2379 2374
2380 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2375 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2381 m_forceToApply = direc; 2376 m_forceToApply = direc;
2382
2383 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2384 } 2377 }
2385 2378
2386 #endregion 2379 #endregion
@@ -2443,8 +2436,6 @@ namespace OpenSim.Region.Framework.Scenes
2443 // server. 2436 // server.
2444 if (remoteClient.IsActive) 2437 if (remoteClient.IsActive)
2445 { 2438 {
2446 m_perfMonMS = Util.EnvironmentTickCount();
2447
2448 Vector3 pos = m_pos; 2439 Vector3 pos = m_pos;
2449 pos.Z += Appearance.HipOffset; 2440 pos.Z += Appearance.HipOffset;
2450 2441
@@ -2455,7 +2446,6 @@ namespace OpenSim.Region.Framework.Scenes
2455 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity 2446 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2456 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2447 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2457 2448
2458 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2459 m_scene.StatsReporter.AddAgentUpdates(1); 2449 m_scene.StatsReporter.AddAgentUpdates(1);
2460 } 2450 }
2461 } 2451 }
@@ -2496,14 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes
2496 || Math.Abs(distanceError) > distanceErrorThreshold 2486 || Math.Abs(distanceError) > distanceErrorThreshold
2497 || velocidyDiff > 0.01f) // did velocity change from last update? 2487 || velocidyDiff > 0.01f) // did velocity change from last update?
2498 { 2488 {
2499 m_perfMonMS = currentTick;
2500 lastVelocitySentToAllClients = Velocity; 2489 lastVelocitySentToAllClients = Velocity;
2501 lastTerseUpdateToAllClientsTick = currentTick; 2490 lastTerseUpdateToAllClientsTick = currentTick;
2502 lastPositionSentToAllClients = OffsetPosition; 2491 lastPositionSentToAllClients = OffsetPosition;
2503 2492
2504 m_scene.ForEachClient(SendTerseUpdateToClient); 2493 m_scene.ForEachClient(SendTerseUpdateToClient);
2505
2506 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2507 } 2494 }
2508 } 2495 }
2509 2496
@@ -2524,9 +2511,7 @@ namespace OpenSim.Region.Framework.Scenes
2524 2511
2525 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2512 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2526 { 2513 {
2527 m_perfMonMS = Util.EnvironmentTickCount();
2528 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 2514 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2529 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2530 } 2515 }
2531 2516
2532 /// <summary> 2517 /// <summary>
@@ -2587,8 +2572,6 @@ namespace OpenSim.Region.Framework.Scenes
2587 m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); 2572 m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent");
2588 return; 2573 return;
2589 } 2574 }
2590
2591 m_perfMonMS = Util.EnvironmentTickCount();
2592 2575
2593 int count = 0; 2576 int count = 0;
2594 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2577 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2598,7 +2581,6 @@ namespace OpenSim.Region.Framework.Scenes
2598 }); 2581 });
2599 2582
2600 m_scene.StatsReporter.AddAgentUpdates(count); 2583 m_scene.StatsReporter.AddAgentUpdates(count);
2601 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2602 } 2584 }
2603 2585
2604 /// <summary> 2586 /// <summary>
@@ -2607,8 +2589,6 @@ namespace OpenSim.Region.Framework.Scenes
2607 /// </summary> 2589 /// </summary>
2608 public void SendOtherAgentsAvatarDataToMe() 2590 public void SendOtherAgentsAvatarDataToMe()
2609 { 2591 {
2610 m_perfMonMS = Util.EnvironmentTickCount();
2611
2612 int count = 0; 2592 int count = 0;
2613 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2593 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2614 { 2594 {
@@ -2625,7 +2605,6 @@ namespace OpenSim.Region.Framework.Scenes
2625 }); 2605 });
2626 2606
2627 m_scene.StatsReporter.AddAgentUpdates(count); 2607 m_scene.StatsReporter.AddAgentUpdates(count);
2628 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2629 } 2608 }
2630 2609
2631 /// <summary> 2610 /// <summary>
@@ -2654,8 +2633,6 @@ namespace OpenSim.Region.Framework.Scenes
2654 m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); 2633 m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent");
2655 return; 2634 return;
2656 } 2635 }
2657
2658 m_perfMonMS = Util.EnvironmentTickCount();
2659 2636
2660 int count = 0; 2637 int count = 0;
2661 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2638 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2668,7 +2645,6 @@ namespace OpenSim.Region.Framework.Scenes
2668 }); 2645 });
2669 2646
2670 m_scene.StatsReporter.AddAgentUpdates(count); 2647 m_scene.StatsReporter.AddAgentUpdates(count);
2671 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2672 } 2648 }
2673 2649
2674 /// <summary> 2650 /// <summary>
@@ -2678,7 +2654,6 @@ namespace OpenSim.Region.Framework.Scenes
2678 public void SendOtherAgentsAppearanceToMe() 2654 public void SendOtherAgentsAppearanceToMe()
2679 { 2655 {
2680 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); 2656 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
2681 m_perfMonMS = Util.EnvironmentTickCount();
2682 2657
2683 int count = 0; 2658 int count = 0;
2684 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2659 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2696,7 +2671,6 @@ namespace OpenSim.Region.Framework.Scenes
2696 }); 2671 });
2697 2672
2698 m_scene.StatsReporter.AddAgentUpdates(count); 2673 m_scene.StatsReporter.AddAgentUpdates(count);
2699 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2700 } 2674 }
2701 2675
2702 /// <summary> 2676 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 87dcdee..282b677 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -37,6 +37,9 @@ namespace OpenSim.Region.Framework.Scenes
37{ 37{
38 public class SimStatsReporter 38 public class SimStatsReporter
39 { 39 {
40// private static readonly log4net.ILog m_log
41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
40 public delegate void SendStatResult(SimStats stats); 43 public delegate void SendStatResult(SimStats stats);
41 44
42 public delegate void YourStatsAreWrong(); 45 public delegate void YourStatsAreWrong();
@@ -165,18 +168,9 @@ namespace OpenSim.Region.Framework.Scenes
165 168
166#region various statistic googly moogly 169#region various statistic googly moogly
167 170
168 // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
169 // 0-50 is pretty close to 0-45
170 float simfps = (int) ((m_fps * 5));
171 // save the reported value so there is something available for llGetRegionFPS 171 // save the reported value so there is something available for llGetRegionFPS
172 lastReportedSimFPS = (float)simfps / statsUpdateFactor; 172 lastReportedSimFPS = (float)m_fps / statsUpdateFactor;
173
174 //if (simfps > 45)
175 //simfps = simfps - (simfps - 45);
176 //if (simfps < 0)
177 //simfps = 0;
178 173
179 //
180 float physfps = ((m_pfps / 1000)); 174 float physfps = ((m_pfps / 1000));
181 175
182 //if (physfps > 600) 176 //if (physfps > 600)
@@ -197,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes
197 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change 191 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
198 // values to X-per-second values. 192 // values to X-per-second values.
199 193
200 for (int i = 0; i<21;i++) 194 for (int i = 0; i < 21; i++)
201 { 195 {
202 sb[i] = new SimStatsPacket.StatBlock(); 196 sb[i] = new SimStatsPacket.StatBlock();
203 } 197 }
@@ -206,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes
206 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 200 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
207 201
208 sb[1].StatID = (uint) Stats.SimFPS; 202 sb[1].StatID = (uint) Stats.SimFPS;
209 sb[1].StatValue = simfps/statsUpdateFactor; 203 sb[1].StatValue = m_fps/statsUpdateFactor;
210 204
211 sb[2].StatID = (uint) Stats.PhysicsFPS; 205 sb[2].StatID = (uint) Stats.PhysicsFPS;
212 sb[2].StatValue = physfps / statsUpdateFactor; 206 sb[2].StatValue = physfps / statsUpdateFactor;
@@ -272,7 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
272 266
273 SimStats simStats 267 SimStats simStats
274 = new SimStats( 268 = new SimStats(
275 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); 269 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity,
270 rb, sb, m_scene.RegionInfo.originRegionID);
276 271
277 handlerSendStatResult = OnSendStatsResult; 272 handlerSendStatResult = OnSendStatsResult;
278 if (handlerSendStatResult != null) 273 if (handlerSendStatResult != null)
@@ -395,30 +390,32 @@ namespace OpenSim.Region.Framework.Scenes
395 { 390 {
396 m_frameMS += ms; 391 m_frameMS += ms;
397 } 392 }
393
398 public void addNetMS(int ms) 394 public void addNetMS(int ms)
399 { 395 {
400 m_netMS += ms; 396 m_netMS += ms;
401 } 397 }
398
402 public void addAgentMS(int ms) 399 public void addAgentMS(int ms)
403 { 400 {
404 m_agentMS += ms; 401 m_agentMS += ms;
405 } 402 }
403
406 public void addPhysicsMS(int ms) 404 public void addPhysicsMS(int ms)
407 { 405 {
408 m_physicsMS += ms; 406 m_physicsMS += ms;
409 } 407 }
408
410 public void addImageMS(int ms) 409 public void addImageMS(int ms)
411 { 410 {
412 m_imageMS += ms; 411 m_imageMS += ms;
413 } 412 }
413
414 public void addOtherMS(int ms) 414 public void addOtherMS(int ms)
415 { 415 {
416 m_otherMS += ms; 416 m_otherMS += ms;
417 } 417 }
418 418
419// private static readonly log4net.ILog m_log
420// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
421
422 public void AddPendingDownloads(int count) 419 public void AddPendingDownloads(int count)
423 { 420 {
424 m_pendingDownloads += count; 421 m_pendingDownloads += count;
@@ -455,12 +452,6 @@ namespace OpenSim.Region.Framework.Scenes
455 AddOutPackets(outPackets); 452 AddOutPackets(outPackets);
456 AddunAckedBytes(unAckedBytes); 453 AddunAckedBytes(unAckedBytes);
457 } 454 }
458
459 public void AddAgentTime(int ms)
460 {
461 addFrameMS(ms);
462 addAgentMS(ms);
463 }
464 455
465 #endregion 456 #endregion
466 } 457 }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 6e603e8..2da922b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -2651,8 +2651,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2651 //base.TriggerPhysicsBasedRestart(); 2651 //base.TriggerPhysicsBasedRestart();
2652 //} 2652 //}
2653 2653
2654 int i = 0;
2655
2656 // Figure out the Frames Per Second we're going at. 2654 // Figure out the Frames Per Second we're going at.
2657 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size 2655 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
2658 2656
@@ -2810,7 +2808,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2810 } 2808 }
2811 2809
2812 step_time -= ODE_STEPSIZE; 2810 step_time -= ODE_STEPSIZE;
2813 i++;
2814 //} 2811 //}
2815 //else 2812 //else
2816 //{ 2813 //{
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 3139b8a..9d87c45 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.UserStatistics
58 58
59 private static SqliteConnection dbConn; 59 private static SqliteConnection dbConn;
60 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); 60 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
61 private List<Scene> m_scene = new List<Scene>(); 61 private List<Scene> m_scenes = new List<Scene>();
62 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); 62 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
63 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>(); 63 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
64 private const int updateStatsMod = 6; 64 private const int updateStatsMod = 6;
@@ -71,25 +71,17 @@ namespace OpenSim.Region.UserStatistics
71 71
72 public virtual void Initialise(Scene scene, IConfigSource config) 72 public virtual void Initialise(Scene scene, IConfigSource config)
73 { 73 {
74 IConfig cnfg; 74 IConfig cnfg = config.Configs["WebStats"];
75 try 75
76 { 76 if (cnfg != null)
77 cnfg = config.Configs["WebStats"];
78 enabled = cnfg.GetBoolean("enabled", false); 77 enabled = cnfg.GetBoolean("enabled", false);
79 }
80 catch (Exception)
81 {
82 enabled = false;
83 }
84 78
85 if (!enabled) 79 if (!enabled)
86 {
87 return; 80 return;
88 }
89 81
90 lock (m_scene) 82 lock (m_scenes)
91 { 83 {
92 if (m_scene.Count == 0) 84 if (m_scenes.Count == 0)
93 { 85 {
94 //IConfig startupConfig = config.Configs["Startup"]; 86 //IConfig startupConfig = config.Configs["Startup"];
95 87
@@ -115,22 +107,19 @@ namespace OpenSim.Region.UserStatistics
115 reports.Add("clients.report", clientReport); 107 reports.Add("clients.report", clientReport);
116 reports.Add("sessions.report", sessionsReport); 108 reports.Add("sessions.report", sessionsReport);
117 109
118
119
120 //// 110 ////
121 // Add Your own Reports here (Do Not Modify Lines here Devs!) 111 // Add Your own Reports here (Do Not Modify Lines here Devs!)
122 //// 112 ////
123 113
124 //// 114 ////
125 // End Own reports section 115 // End Own reports section
126 //// 116 ////
127
128 117
129 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); 118 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
130 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); 119 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
131 } 120 }
132 121
133 m_scene.Add(scene); 122 m_scenes.Add(scene);
134 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) 123 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
135 m_simstatsCounters.Remove(scene.RegionInfo.RegionID); 124 m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
136 125
@@ -214,7 +203,7 @@ namespace OpenSim.Region.UserStatistics
214 203
215 204
216 repParams["DatabaseConnection"] = dbConn; 205 repParams["DatabaseConnection"] = dbConn;
217 repParams["Scenes"] = m_scene; 206 repParams["Scenes"] = m_scenes;
218 repParams["SimStats"] = m_simstatsCounters; 207 repParams["SimStats"] = m_simstatsCounters;
219 repParams["LogLines"] = m_loglines; 208 repParams["LogLines"] = m_loglines;
220 repParams["Reports"] = reports; 209 repParams["Reports"] = reports;
@@ -265,7 +254,6 @@ namespace OpenSim.Region.UserStatistics
265 CreateTables(db); 254 CreateTables(db);
266 } 255 }
267 } 256 }
268
269 } 257 }
270 258
271 public void CreateTables(SqliteConnection db) 259 public void CreateTables(SqliteConnection db)
@@ -277,8 +265,6 @@ namespace OpenSim.Region.UserStatistics
277 createcmd.ExecuteNonQuery(); 265 createcmd.ExecuteNonQuery();
278 } 266 }
279 267
280
281
282 public virtual void PostInitialise() 268 public virtual void PostInitialise()
283 { 269 {
284 if (!enabled) 270 if (!enabled)
@@ -297,7 +283,7 @@ namespace OpenSim.Region.UserStatistics
297 dbConn.Close(); 283 dbConn.Close();
298 dbConn.Dispose(); 284 dbConn.Dispose();
299 m_sessions.Clear(); 285 m_sessions.Clear();
300 m_scene.Clear(); 286 m_scenes.Clear();
301 reports.Clear(); 287 reports.Clear();
302 m_simstatsCounters.Clear(); 288 m_simstatsCounters.Clear();
303 } 289 }
@@ -333,10 +319,10 @@ namespace OpenSim.Region.UserStatistics
333 319
334 protected virtual void AddHandlers() 320 protected virtual void AddHandlers()
335 { 321 {
336 lock (m_scene) 322 lock (m_scenes)
337 { 323 {
338 updateLogMod = m_scene.Count * 2; 324 updateLogMod = m_scenes.Count * 2;
339 foreach (Scene scene in m_scene) 325 foreach (Scene scene in m_scenes)
340 { 326 {
341 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 327 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
342 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; 328 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
@@ -376,15 +362,11 @@ namespace OpenSim.Region.UserStatistics
376 } 362 }
377 } 363 }
378 364
379
380
381
382 public void OnMakeChildAgent(ScenePresence agent) 365 public void OnMakeChildAgent(ScenePresence agent)
383 { 366 {
384 367
385 } 368 }
386 369
387
388 public void OnClientClosed(UUID agentID, Scene scene) 370 public void OnClientClosed(UUID agentID, Scene scene)
389 { 371 {
390 lock (m_sessions) 372 lock (m_sessions)
@@ -394,7 +376,6 @@ namespace OpenSim.Region.UserStatistics
394 m_sessions.Remove(agentID); 376 m_sessions.Remove(agentID);
395 } 377 }
396 } 378 }
397
398 } 379 }
399 380
400 public string readLogLines(int amount) 381 public string readLogLines(int amount)
@@ -433,14 +414,13 @@ namespace OpenSim.Region.UserStatistics
433 fs.Close(); 414 fs.Close();
434 fs.Dispose(); 415 fs.Dispose();
435 return encoding.GetString(buffer); 416 return encoding.GetString(buffer);
436
437 } 417 }
438 418
439 public UUID GetRegionUUIDFromHandle(ulong regionhandle) 419 public UUID GetRegionUUIDFromHandle(ulong regionhandle)
440 { 420 {
441 lock (m_scene) 421 lock (m_scenes)
442 { 422 {
443 foreach (Scene scene in m_scene) 423 foreach (Scene scene in m_scenes)
444 { 424 {
445 if (scene.RegionInfo.RegionHandle == regionhandle) 425 if (scene.RegionInfo.RegionHandle == regionhandle)
446 return scene.RegionInfo.RegionID; 426 return scene.RegionInfo.RegionID;
@@ -448,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
448 } 428 }
449 return UUID.Zero; 429 return UUID.Zero;
450 } 430 }
431
451 /// <summary> 432 /// <summary>
452 /// Callback for a viewerstats cap 433 /// Callback for a viewerstats cap
453 /// </summary> 434 /// </summary>
@@ -523,8 +504,6 @@ namespace OpenSim.Region.UserStatistics
523 504
524 usd = uid.session_data; 505 usd = uid.session_data;
525 506
526
527
528 if (message.Type != OSDType.Map) 507 if (message.Type != OSDType.Map)
529 return new UserSessionID(); 508 return new UserSessionID();
530 509
@@ -699,7 +678,6 @@ namespace OpenSim.Region.UserStatistics
699 678
700 } 679 }
701 } 680 }
702
703 } 681 }
704 682
705 #region SQL 683 #region SQL
@@ -824,6 +802,7 @@ set session_id=:session_id,
824WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"; 802WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key";
825 #endregion 803 #endregion
826 } 804 }
805
827 public static class UserSessionUtil 806 public static class UserSessionUtil
828 { 807 {
829 public static UserSessionData newUserSessionData() 808 public static UserSessionData newUserSessionData()
@@ -941,7 +920,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
941 return result / cnt; 920 return result / cnt;
942 } 921 }
943 922
944
945 public static float ArrayMode_f(float[] arr) 923 public static float ArrayMode_f(float[] arr)
946 { 924 {
947 List<float> mode = new List<float>(); 925 List<float> mode = new List<float>();
@@ -995,10 +973,8 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
995 } 973 }
996 974
997 return mode.ToArray()[0]; 975 return mode.ToArray()[0];
998
999 } 976 }
1000 977
1001
1002 public static int ArrayMode_i(int[] arr) 978 public static int ArrayMode_i(int[] arr)
1003 { 979 {
1004 List<int> mode = new List<int>(); 980 List<int> mode = new List<int>();
@@ -1052,7 +1028,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1052 } 1028 }
1053 1029
1054 return mode.ToArray()[0]; 1030 return mode.ToArray()[0];
1055
1056 } 1031 }
1057 1032
1058 #endregion 1033 #endregion
@@ -1178,7 +1153,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1178 public List<float> _sim_fps; 1153 public List<float> _sim_fps;
1179 public List<int> _agents_in_view; 1154 public List<int> _agents_in_view;
1180 } 1155 }
1181
1182 1156
1183 #endregion 1157 #endregion
1184 1158
@@ -1263,5 +1237,4 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1263 m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue; 1237 m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
1264 } 1238 }
1265 } 1239 }
1266 1240} \ No newline at end of file
1267}
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 20414f6..cadf297 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -44,6 +44,17 @@ namespace OpenSim.Services.Interfaces
44 PrincipalID = principalID; 44 PrincipalID = principalID;
45 } 45 }
46 46
47 public UserAccount(UUID scopeID, string firstName, string lastName, string email)
48 {
49 PrincipalID = UUID.Random();
50 ScopeID = scopeID;
51 FirstName = firstName;
52 LastName = lastName;
53 Email = email;
54 ServiceURLs = new Dictionary<string, object>();
55 Created = Util.UnixTimeSinceEpoch();
56 }
57
47 public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email) 58 public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email)
48 { 59 {
49 PrincipalID = principalID; 60 PrincipalID = principalID;