aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/IScene.cs8
-rw-r--r--OpenSim/Framework/Monitoring/AssetStatsCollector.cs (renamed from OpenSim/Framework/Statistics/AssetStatsCollector.cs)2
-rw-r--r--OpenSim/Framework/Monitoring/BaseStatsCollector.cs (renamed from OpenSim/Framework/Statistics/BaseStatsCollector.cs)3
-rw-r--r--OpenSim/Framework/Monitoring/Interfaces/IPullStatsProvider.cs (renamed from OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs)2
-rw-r--r--OpenSim/Framework/Monitoring/Interfaces/IStatsCollector.cs (renamed from OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs)2
-rw-r--r--OpenSim/Framework/Monitoring/MemoryWatchdog.cs129
-rw-r--r--OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs (renamed from OpenSim/Framework/Statistics/SimExtraStatsCollector.cs)5
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs (renamed from OpenSim/Framework/Statistics/StatsManager.cs)2
-rw-r--r--OpenSim/Framework/Monitoring/UserStatsCollector.cs (renamed from OpenSim/Framework/Statistics/UserStatsCollector.cs)2
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs (renamed from OpenSim/Framework/Watchdog.cs)5
-rw-r--r--OpenSim/Framework/RegionInfo.cs26
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs1
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs1
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs1
15 files changed, 172 insertions, 19 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 2c38e0f..87ec99e 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -71,6 +71,14 @@ namespace OpenSim.Framework
71 /// </summary> 71 /// </summary>
72 bool LoginsEnabled { get; set; } 72 bool LoginsEnabled { get; set; }
73 73
74 /// <summary>
75 /// Is this region ready for use?
76 /// </summary>
77 /// <remarks>
78 /// This does not mean that logins are enabled, merely that they can be.
79 /// </remarks>
80 bool Ready { get; set; }
81
74 float TimeDilation { get; } 82 float TimeDilation { get; }
75 83
76 bool AllowScriptCrossings { get; } 84 bool AllowScriptCrossings { get; }
diff --git a/OpenSim/Framework/Statistics/AssetStatsCollector.cs b/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
index 7082ef3..2a4d45b 100644
--- a/OpenSim/Framework/Statistics/AssetStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Timers; 29using System.Timers;
30 30
31namespace OpenSim.Framework.Statistics 31namespace OpenSim.Framework.Monitoring
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Asset service statistics collection 34 /// Asset service statistics collection
diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
index 3f918f3..9ee0876 100644
--- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
@@ -31,8 +31,7 @@ using System.Text;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33 33
34 34namespace OpenSim.Framework.Monitoring
35namespace OpenSim.Framework.Statistics
36{ 35{
37 /// <summary> 36 /// <summary>
38 /// Statistics which all collectors are interested in reporting 37 /// Statistics which all collectors are interested in reporting
diff --git a/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs b/OpenSim/Framework/Monitoring/Interfaces/IPullStatsProvider.cs
index 430e580..86a6620 100644
--- a/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs
+++ b/OpenSim/Framework/Monitoring/Interfaces/IPullStatsProvider.cs
@@ -25,7 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Framework.Statistics.Interfaces 28namespace OpenSim.Framework.Monitoring.Interfaces
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// Implemented by objects which allow statistical information to be pulled from them. 31 /// Implemented by objects which allow statistical information to be pulled from them.
diff --git a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs b/OpenSim/Framework/Monitoring/Interfaces/IStatsCollector.cs
index 477bbb3..99f75e3 100644
--- a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/Interfaces/IStatsCollector.cs
@@ -25,7 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Framework.Statistics 28namespace OpenSim.Framework.Monitoring
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// Implemented by classes which collect up non-viewer statistical information 31 /// Implemented by classes which collect up non-viewer statistical information
diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
new file mode 100644
index 0000000..a23cf1f
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
@@ -0,0 +1,129 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
32using System.Threading;
33using log4net;
34
35namespace OpenSim.Framework.Monitoring
36{
37 /// <summary>
38 /// Experimental watchdog for memory usage.
39 /// </summary>
40 public static class MemoryWatchdog
41 {
42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 /// <summary>
45 /// Is this watchdog active?
46 /// </summary>
47 public static bool Enabled
48 {
49 get { return m_enabled; }
50 set
51 {
52// m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
53
54 if (value && !m_enabled)
55 UpdateLastRecord(GC.GetTotalMemory(false), Util.EnvironmentTickCount());
56
57 m_enabled = value;
58 }
59 }
60 private static bool m_enabled;
61
62 /// <summary>
63 /// Average memory churn in bytes per millisecond.
64 /// </summary>
65 public static double AverageMemoryChurn
66 {
67 get { if (m_samples.Count > 0) return m_samples.Average(); else return 0; }
68 }
69
70 /// <summary>
71 /// Maximum number of statistical samples.
72 /// </summary>
73 /// <remarks>
74 /// At the moment this corresponds to 1 minute since the sampling rate is every 2.5 seconds as triggered from
75 /// the main Watchdog.
76 /// </remarks>
77 private static int m_maxSamples = 24;
78
79 /// <summary>
80 /// Time when the watchdog was last updated.
81 /// </summary>
82 private static int m_lastUpdateTick;
83
84 /// <summary>
85 /// Memory used at time of last watchdog update.
86 /// </summary>
87 private static long m_lastUpdateMemory;
88
89 /// <summary>
90 /// Memory churn rate per millisecond.
91 /// </summary>
92// private static double m_churnRatePerMillisecond;
93
94 /// <summary>
95 /// Historical samples for calculating moving average.
96 /// </summary>
97 private static Queue<double> m_samples = new Queue<double>(m_maxSamples);
98
99 public static void Update()
100 {
101 int now = Util.EnvironmentTickCount();
102 long memoryNow = GC.GetTotalMemory(false);
103 long memoryDiff = memoryNow - m_lastUpdateMemory;
104
105 if (memoryDiff >= 0)
106 {
107 if (m_samples.Count >= m_maxSamples)
108 m_samples.Dequeue();
109
110 double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick);
111
112 // This should never happen since it's not useful for updates to occur with no time elapsed, but
113 // protect ourselves from a divide-by-zero just in case.
114 if (elapsed == 0)
115 return;
116
117 m_samples.Enqueue(memoryDiff / (double)elapsed);
118 }
119
120 UpdateLastRecord(memoryNow, now);
121 }
122
123 private static void UpdateLastRecord(long memoryNow, int timeNow)
124 {
125 m_lastUpdateMemory = memoryNow;
126 m_lastUpdateTick = timeNow;
127 }
128 }
129} \ No newline at end of file
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index a506e3b..cdd7cc7 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -28,12 +28,11 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework.Statistics.Interfaces;
34using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenSim.Framework.Monitoring.Interfaces;
35 34
36namespace OpenSim.Framework.Statistics 35namespace OpenSim.Framework.Monitoring
37{ 36{
38 /// <summary> 37 /// <summary>
39 /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane 38 /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
diff --git a/OpenSim/Framework/Statistics/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 436ce2f..d78fa6a 100644
--- a/OpenSim/Framework/Statistics/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -25,7 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Framework.Statistics 28namespace OpenSim.Framework.Monitoring
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// Singleton used to provide access to statistics reporters 31 /// Singleton used to provide access to statistics reporters
diff --git a/OpenSim/Framework/Statistics/UserStatsCollector.cs b/OpenSim/Framework/Monitoring/UserStatsCollector.cs
index fd2a9bf..e89c8e6 100644
--- a/OpenSim/Framework/Statistics/UserStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/UserStatsCollector.cs
@@ -27,7 +27,7 @@
27 27
28using System.Timers; 28using System.Timers;
29 29
30namespace OpenSim.Framework.Statistics 30namespace OpenSim.Framework.Monitoring
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// Collects user service statistics 33 /// Collects user service statistics
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 449d014..e4db964 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -31,7 +31,7 @@ using System.Linq;
31using System.Threading; 31using System.Threading;
32using log4net; 32using log4net;
33 33
34namespace OpenSim.Framework 34namespace OpenSim.Framework.Monitoring
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Manages launching threads and keeping watch over them for timeouts 37 /// Manages launching threads and keeping watch over them for timeouts
@@ -325,6 +325,9 @@ namespace OpenSim.Framework
325 callback(callbackInfo); 325 callback(callbackInfo);
326 } 326 }
327 327
328 if (MemoryWatchdog.Enabled)
329 MemoryWatchdog.Update();
330
328 m_watchdogTimer.Start(); 331 m_watchdogTimer.Start();
329 } 332 }
330 } 333 }
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 1b2f681..4bde7be 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -482,9 +482,16 @@ namespace OpenSim.Framework
482 MainConsole.Instance.Output("=====================================\n"); 482 MainConsole.Instance.Output("=====================================\n");
483 483
484 if (name == String.Empty) 484 if (name == String.Empty)
485 name = MainConsole.Instance.CmdPrompt("New region name", name); 485 {
486 if (name == String.Empty) 486 while (name.Trim() == string.Empty)
487 throw new Exception("Cannot interactively create region with no name"); 487 {
488 name = MainConsole.Instance.CmdPrompt("New region name", name);
489 if (name.Trim() == string.Empty)
490 {
491 MainConsole.Instance.Output("Cannot interactively create region with no name");
492 }
493 }
494 }
488 495
489 source.AddConfig(name); 496 source.AddConfig(name);
490 497
@@ -515,15 +522,20 @@ namespace OpenSim.Framework
515 // 522 //
516 allKeys.Remove("RegionUUID"); 523 allKeys.Remove("RegionUUID");
517 string regionUUID = config.GetString("RegionUUID", string.Empty); 524 string regionUUID = config.GetString("RegionUUID", string.Empty);
518 if (regionUUID == String.Empty) 525 if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
519 { 526 {
520 UUID newID = UUID.Random(); 527 UUID newID = UUID.Random();
521 528 while (RegionID == UUID.Zero)
522 regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); 529 {
530 regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
531 if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
532 {
533 MainConsole.Instance.Output("RegionUUID must be a valid UUID");
534 }
535 }
523 config.Set("RegionUUID", regionUUID); 536 config.Set("RegionUUID", regionUUID);
524 } 537 }
525 538
526 RegionID = new UUID(regionUUID);
527 originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) 539 originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)
528 540
529 // Location 541 // Location
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 9a2cd0e..cf19002 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -40,9 +40,9 @@ using log4net.Core;
40using log4net.Repository; 40using log4net.Repository;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
43using OpenSim.Framework.Monitoring;
43using OpenSim.Framework.Servers; 44using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer; 45using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Framework.Statistics;
46using Timer=System.Timers.Timer; 46using Timer=System.Timers.Timer;
47 47
48using OpenMetaverse; 48using OpenMetaverse;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 24f986a..e45cb89 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -45,6 +45,7 @@ using OpenMetaverse.StructuredData;
45using CoolHTTPListener = HttpServer.HttpListener; 45using CoolHTTPListener = HttpServer.HttpListener;
46using HttpListener=System.Net.HttpListener; 46using HttpListener=System.Net.HttpListener;
47using LogPrio=HttpServer.LogPrio; 47using LogPrio=HttpServer.LogPrio;
48using OpenSim.Framework.Monitoring;
48 49
49namespace OpenSim.Framework.Servers.HttpServer 50namespace OpenSim.Framework.Servers.HttpServer
50{ 51{
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index a3bd330..a385110 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using log4net; 32using log4net;
33using HttpServer; 33using HttpServer;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring;
35 36
36 37
37/* 38/*
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 1e3fbf0..1c529b6 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -36,6 +36,7 @@ using HttpServer;
36using OpenMetaverse; 36using OpenMetaverse;
37using System.Reflection; 37using System.Reflection;
38using log4net; 38using log4net;
39using OpenSim.Framework.Monitoring;
39 40
40namespace OpenSim.Framework.Servers.HttpServer 41namespace OpenSim.Framework.Servers.HttpServer
41{ 42{