aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-14 21:53:40 +0000
committerJustin Clarke Casey2008-05-14 21:53:40 +0000
commit0f501629618fe1655b7ba653802056b5c32dbae6 (patch)
tree8a7f2808a27f97a60d1901263155906256e6f46a
parent* Refactor: Renaming non viewer statistics classes from Reporters to Collecto... (diff)
downloadopensim-SC_OLD-0f501629618fe1655b7ba653802056b5c32dbae6.zip
opensim-SC_OLD-0f501629618fe1655b7ba653802056b5c32dbae6.tar.gz
opensim-SC_OLD-0f501629618fe1655b7ba653802056b5c32dbae6.tar.bz2
opensim-SC_OLD-0f501629618fe1655b7ba653802056b5c32dbae6.tar.xz
* Refactor additional stats collection common code into base opensim server
* If extra stats not sent to the viewer are available on an opensim server, they are now uniformly accessible using the 'show stats' command
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs19
-rw-r--r--OpenSim/Framework/Statistics/AssetStatsCollector.cs2
-rw-r--r--OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs41
-rw-r--r--OpenSim/Framework/Statistics/SimExtraStatsCollector.cs4
-rw-r--r--OpenSim/Framework/Statistics/StatsManager.cs12
-rw-r--r--OpenSim/Framework/Statistics/UserStatsCollector.cs2
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs13
-rw-r--r--OpenSim/Grid/UserServer/Main.cs9
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimMainConsole.cs15
-rw-r--r--prebuild.xml1
11 files changed, 79 insertions, 41 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 344309d..811a0db 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Framework.Statistics;
30 31
31namespace OpenSim.Framework.Servers 32namespace OpenSim.Framework.Servers
32{ 33{
@@ -44,6 +45,11 @@ namespace OpenSim.Framework.Servers
44 get { return m_httpServer; } 45 get { return m_httpServer; }
45 } 46 }
46 47
48 /// <summary>
49 /// Holds the non-viewer statistics collection object for this service/server
50 /// </summary>
51 protected IStatsCollector m_stats;
52
47 public BaseOpenSimServer() 53 public BaseOpenSimServer()
48 { 54 {
49 m_startuptime = DateTime.Now; 55 m_startuptime = DateTime.Now;
@@ -72,6 +78,10 @@ namespace OpenSim.Framework.Servers
72 { 78 {
73 case "help": 79 case "help":
74 Notice("quit - equivalent to shutdown."); 80 Notice("quit - equivalent to shutdown.");
81
82 if (m_stats != null)
83 Notice("show stats - statistical information for this server");
84
75 Notice("show uptime - show server startup and uptime."); 85 Notice("show uptime - show server startup and uptime.");
76 Notice("shutdown - shutdown the server.\n"); 86 Notice("shutdown - shutdown the server.\n");
77 break; 87 break;
@@ -97,7 +107,14 @@ namespace OpenSim.Framework.Servers
97 public virtual void Show(string ShowWhat) 107 public virtual void Show(string ShowWhat)
98 { 108 {
99 switch (ShowWhat) 109 switch (ShowWhat)
100 { 110 {
111 case "stats":
112 if (m_stats != null)
113 {
114 Notice(m_stats.Report());
115 }
116 break;
117
101 case "uptime": 118 case "uptime":
102 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); 119 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
103 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); 120 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
diff --git a/OpenSim/Framework/Statistics/AssetStatsCollector.cs b/OpenSim/Framework/Statistics/AssetStatsCollector.cs
index afc42d2..bd36c3f 100644
--- a/OpenSim/Framework/Statistics/AssetStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/AssetStatsCollector.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Statistics
33 /// <summary> 33 /// <summary>
34 /// Asset service statistics collection 34 /// Asset service statistics collection
35 /// </summary> 35 /// </summary>
36 public class AssetStatsCollector 36 public class AssetStatsCollector : IStatsCollector
37 { 37 {
38 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); 38 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
39 private DateTime startTime = DateTime.Now; 39 private DateTime startTime = DateTime.Now;
diff --git a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs
new file mode 100644
index 0000000..768cd22
--- /dev/null
+++ b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs
@@ -0,0 +1,41 @@
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 OpenSim 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
28namespace OpenSim.Framework.Statistics
29{
30 /// <summary>
31 /// Implemented by classes which collect up non-viewer statistical information
32 /// </summary>
33 public interface IStatsCollector
34 {
35 /// <summary>
36 /// Report back collected statistical information.
37 /// </summary>
38 /// <returns></returns>
39 string Report();
40 }
41}
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
index 4e69d17..2beb3a0 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Statistics
36 /// <summary> 36 /// <summary>
37 /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane 37 /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
38 /// </summary> 38 /// </summary>
39 public class SimExtraStatsCollector 39 public class SimExtraStatsCollector : IStatsCollector
40 { 40 {
41 private long assetsInCache; 41 private long assetsInCache;
42 private long texturesInCache; 42 private long texturesInCache;
@@ -135,7 +135,7 @@ Texture cache contains {2,6} textures using {3,10:0.000}K" + Environment.NewLine
135 /// <summary> 135 /// <summary>
136 /// Pull packet queue stats from packet queues and report 136 /// Pull packet queue stats from packet queues and report
137 /// </summary> 137 /// </summary>
138 public class PacketQueueStatsCollector 138 public class PacketQueueStatsCollector : IStatsCollector
139 { 139 {
140 private IPullStatsProvider m_statsProvider; 140 private IPullStatsProvider m_statsProvider;
141 141
diff --git a/OpenSim/Framework/Statistics/StatsManager.cs b/OpenSim/Framework/Statistics/StatsManager.cs
index 10251a5..3c97dde 100644
--- a/OpenSim/Framework/Statistics/StatsManager.cs
+++ b/OpenSim/Framework/Statistics/StatsManager.cs
@@ -46,27 +46,33 @@ namespace OpenSim.Framework.Statistics
46 /// Start collecting statistics related to assets. 46 /// Start collecting statistics related to assets.
47 /// Should only be called once. 47 /// Should only be called once.
48 /// </summary> 48 /// </summary>
49 public static void StartCollectingAssetStats() 49 public static AssetStatsCollector StartCollectingAssetStats()
50 { 50 {
51 assetStats = new AssetStatsCollector(); 51 assetStats = new AssetStatsCollector();
52
53 return assetStats;
52 } 54 }
53 55
54 /// <summary> 56 /// <summary>
55 /// Start collecting statistics related to users. 57 /// Start collecting statistics related to users.
56 /// Should only be called once. 58 /// Should only be called once.
57 /// </summary> 59 /// </summary>
58 public static void StartCollectingUserStats() 60 public static UserStatsCollector StartCollectingUserStats()
59 { 61 {
60 userStats = new UserStatsCollector(); 62 userStats = new UserStatsCollector();
63
64 return userStats;
61 } 65 }
62 66
63 /// <summary> 67 /// <summary>
64 /// Start collecting extra sim statistics apart from those collected for the client. 68 /// Start collecting extra sim statistics apart from those collected for the client.
65 /// Should only be called once. 69 /// Should only be called once.
66 /// </summary> 70 /// </summary>
67 public static void StartCollectingSimExtraStats() 71 public static SimExtraStatsCollector StartCollectingSimExtraStats()
68 { 72 {
69 simExtraStats = new SimExtraStatsCollector(); 73 simExtraStats = new SimExtraStatsCollector();
74
75 return simExtraStats;
70 } 76 }
71 } 77 }
72} 78}
diff --git a/OpenSim/Framework/Statistics/UserStatsCollector.cs b/OpenSim/Framework/Statistics/UserStatsCollector.cs
index 80cd46e..f0f0417 100644
--- a/OpenSim/Framework/Statistics/UserStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/UserStatsCollector.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Framework.Statistics
32 /// <summary> 32 /// <summary>
33 /// Collects user service statistics 33 /// Collects user service statistics
34 /// </summary> 34 /// </summary>
35 public class UserStatsCollector 35 public class UserStatsCollector : IStatsCollector
36 { 36 {
37 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); 37 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
38 38
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 77e4628..1b1f9c7 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Grid.AssetServer
98 m_log.Info("[ASSET]: Starting HTTP process"); 98 m_log.Info("[ASSET]: Starting HTTP process");
99 m_httpServer = new BaseHttpServer(m_config.HttpPort); 99 m_httpServer = new BaseHttpServer(m_config.HttpPort);
100 100
101 StatsManager.StartCollectingAssetStats(); 101 m_stats = StatsManager.StartCollectingAssetStats();
102 102
103 AddHttpHandlers(); 103 AddHttpHandlers();
104 104
@@ -179,16 +179,7 @@ namespace OpenSim.Grid.AssetServer
179 base.RunCmd(cmd, cmdparams); 179 base.RunCmd(cmd, cmdparams);
180 180
181 switch (cmd) 181 switch (cmd)
182 { 182 {
183 case "help":
184 m_console.Notice("stats - statistical information for this server");
185
186 break;
187
188 case "stats":
189 m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
190 break;
191
192 case "shutdown": 183 case "shutdown":
193 m_console.Close(); 184 m_console.Close();
194 Environment.Exit(0); 185 Environment.Exit(0);
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 7cd2431..00b7f76 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Grid.UserServer
88 { 88 {
89 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 89 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
90 90
91 StatsManager.StartCollectingUserStats(); 91 m_stats = StatsManager.StartCollectingUserStats();
92 92
93 m_log.Info("[REGION]: Establishing data connection"); 93 m_log.Info("[REGION]: Establishing data connection");
94 m_userManager = new UserManager(); 94 m_userManager = new UserManager();
@@ -219,16 +219,11 @@ namespace OpenSim.Grid.UserServer
219 { 219 {
220 case "help": 220 case "help":
221 m_console.Notice("create user - create a new user"); 221 m_console.Notice("create user - create a new user");
222 m_console.Notice("stats - statistical information for this server");
223 break; 222 break;
224 223
225 case "create": 224 case "create":
226 do_create(cmdparams[0]); 225 do_create(cmdparams[0]);
227 break; 226 break;
228
229 case "stats":
230 m_console.Notice(StatsManager.UserStats.Report());
231 break;
232 227
233 case "test-inventory": 228 case "test-inventory":
234 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); 229 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index bae7819..e7386ff 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -391,7 +391,7 @@ namespace OpenSim
391 { 391 {
392 printAvailableVersionInformation(); 392 printAvailableVersionInformation();
393 393
394 StatsManager.StartCollectingSimExtraStats(); 394 m_stats = StatsManager.StartCollectingSimExtraStats();
395 395
396 // Do baseclass startup sequence: OpenSim.Region.ClientStack.RegionApplicationBase.StartUp 396 // Do baseclass startup sequence: OpenSim.Region.ClientStack.RegionApplicationBase.StartUp
397 // TerrainManager, StorageManager, HTTP Server 397 // TerrainManager, StorageManager, HTTP Server
diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs
index 39f2b7b..2381f57 100644
--- a/OpenSim/Region/Application/OpenSimMainConsole.cs
+++ b/OpenSim/Region/Application/OpenSimMainConsole.cs
@@ -252,8 +252,7 @@ namespace OpenSim
252 m_console.Notice("set-time [x] - set the current scene time phase"); 252 m_console.Notice("set-time [x] - set the current scene time phase");
253 m_console.Notice("show assets - show state of asset cache."); 253 m_console.Notice("show assets - show state of asset cache.");
254 m_console.Notice("show users - show info about connected users."); 254 m_console.Notice("show users - show info about connected users.");
255 m_console.Notice("show modules - shows info about loaded modules."); 255 m_console.Notice("show modules - shows info about loaded modules.");
256 m_console.Notice("show stats - statistical information for this server");
257 m_console.Notice("show version - show the running build version."); 256 m_console.Notice("show version - show the running build version.");
258 m_console.Notice("threads - list threads"); 257 m_console.Notice("threads - list threads");
259 m_console.Notice("config set section field value - set a config value"); 258 m_console.Notice("config set section field value - set a config value");
@@ -595,18 +594,6 @@ namespace OpenSim
595 scene.RegionInfo.RegionLocY); 594 scene.RegionInfo.RegionLocY);
596 }); 595 });
597 break; 596 break;
598
599 case "stats":
600 if (StatsManager.SimExtraStats != null)
601 {
602 m_console.Notice(
603 "STATS", Environment.NewLine + StatsManager.SimExtraStats.Report());
604 }
605 else
606 {
607 m_console.Notice("Extra sim statistics collection has not been enabled");
608 }
609 break;
610 597
611 case "version": 598 case "version":
612 if (!string.IsNullOrEmpty(buildVersion)) 599 if (!string.IsNullOrEmpty(buildVersion))
diff --git a/prebuild.xml b/prebuild.xml
index 530b3fb..65c3452 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -451,6 +451,7 @@
451 <Reference name="System.Xml"/> 451 <Reference name="System.Xml"/>
452 <Reference name="OpenSim.Framework"/> 452 <Reference name="OpenSim.Framework"/>
453 <Reference name="OpenSim.Framework.Console"/> 453 <Reference name="OpenSim.Framework.Console"/>
454 <Reference name="OpenSim.Framework.Statistics"/>
454 <Reference name="libsecondlife.dll"/> 455 <Reference name="libsecondlife.dll"/>
455 <Reference name="XMLRPC.dll"/> 456 <Reference name="XMLRPC.dll"/>
456 <Reference name="log4net"/> 457 <Reference name="log4net"/>