aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2013-08-07 08:02:36 -0700
committerDiva Canto2013-08-07 08:02:36 -0700
commit6b9a65972c2ca67b0574f06ec77cab12cf3c1742 (patch)
tree05cf2bed80368e880791974b7bdce3dcf02bcbcd
parentFixed incomplete commit r/23317 -- see_into_region. Put the guard around esta... (diff)
parentAdd file missing from last commit 4c2f6de (diff)
downloadopensim-SC_OLD-6b9a65972c2ca67b0574f06ec77cab12cf3c1742.zip
opensim-SC_OLD-6b9a65972c2ca67b0574f06ec77cab12cf3c1742.tar.gz
opensim-SC_OLD-6b9a65972c2ca67b0574f06ec77cab12cf3c1742.tar.bz2
opensim-SC_OLD-6b9a65972c2ca67b0574f06ec77cab12cf3c1742.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Framework/Monitoring/StatsLogger.cs108
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs52
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs23
-rw-r--r--bin/OpenSim.32BitLaunch.exe.config36
-rwxr-xr-xbin/OpenSim.exe.config21
-rw-r--r--bin/Robust.32BitLaunch.exe.config22
-rw-r--r--bin/Robust.exe.config21
7 files changed, 270 insertions, 13 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsLogger.cs b/OpenSim/Framework/Monitoring/StatsLogger.cs
new file mode 100644
index 0000000..fa2e1b6
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/StatsLogger.cs
@@ -0,0 +1,108 @@
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.Reflection;
30using System.Timers;
31using log4net;
32
33namespace OpenSim.Framework.Monitoring
34{
35 /// <summary>
36 /// Provides a means to continuously log stats for debugging purposes.
37 /// </summary>
38 public static class StatsLogger
39 {
40 private static readonly ILog m_statsLog = LogManager.GetLogger("special.StatsLogger");
41
42 private static Timer m_loggingTimer;
43 private static int m_statsLogIntervalMs = 5000;
44
45 public static void RegisterConsoleCommands(ICommandConsole console)
46 {
47 console.Commands.AddCommand(
48 "Debug",
49 false,
50 "debug stats record",
51 "debug stats record start|stop",
52 "Control whether stats are being regularly recorded to a separate file.",
53 "For debug purposes. Experimental.",
54 HandleStatsRecordCommand);
55 }
56
57 public static void HandleStatsRecordCommand(string module, string[] cmd)
58 {
59 ICommandConsole con = MainConsole.Instance;
60
61 if (cmd.Length != 4)
62 {
63 con.Output("Usage: debug stats record start|stop");
64 return;
65 }
66
67 if (cmd[3] == "start")
68 {
69 Start();
70 con.OutputFormat("Now recording all stats very {0}ms to file", m_statsLogIntervalMs);
71 }
72 else if (cmd[3] == "stop")
73 {
74 Stop();
75 con.Output("Stopped recording stats to file.");
76 }
77 }
78
79 public static void Start()
80 {
81 if (m_loggingTimer != null)
82 Stop();
83
84 m_loggingTimer = new Timer(m_statsLogIntervalMs);
85 m_loggingTimer.AutoReset = false;
86 m_loggingTimer.Elapsed += Log;
87 m_loggingTimer.Start();
88 }
89
90 public static void Stop()
91 {
92 if (m_loggingTimer != null)
93 {
94 m_loggingTimer.Stop();
95 }
96 }
97
98 private static void Log(object sender, ElapsedEventArgs e)
99 {
100 m_statsLog.InfoFormat("*** STATS REPORT AT {0} ***", DateTime.Now);
101
102 foreach (string report in StatsManager.GetAllStatsReports())
103 m_statsLog.Info(report);
104
105 m_loggingTimer.Start();
106 }
107 }
108} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 87197f4..c8e838c 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -81,6 +81,8 @@ namespace OpenSim.Framework.Monitoring
81 + "More than one name can be given separated by spaces.\n" 81 + "More than one name can be given separated by spaces.\n"
82 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", 82 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
83 HandleShowStatsCommand); 83 HandleShowStatsCommand);
84
85 StatsLogger.RegisterConsoleCommands(console);
84 } 86 }
85 87
86 public static void HandleShowStatsCommand(string module, string[] cmd) 88 public static void HandleShowStatsCommand(string module, string[] cmd)
@@ -145,29 +147,55 @@ namespace OpenSim.Framework.Monitoring
145 } 147 }
146 } 148 }
147 149
148 private static void OutputAllStatsToConsole(ICommandConsole con) 150 public static List<string> GetAllStatsReports()
149 { 151 {
152 List<string> reports = new List<string>();
153
150 foreach (var category in RegisteredStats.Values) 154 foreach (var category in RegisteredStats.Values)
151 { 155 reports.AddRange(GetCategoryStatsReports(category));
152 OutputCategoryStatsToConsole(con, category); 156
153 } 157 return reports;
158 }
159
160 private static void OutputAllStatsToConsole(ICommandConsole con)
161 {
162 foreach (string report in GetAllStatsReports())
163 con.Output(report);
164 }
165
166 private static List<string> GetCategoryStatsReports(
167 SortedDictionary<string, SortedDictionary<string, Stat>> category)
168 {
169 List<string> reports = new List<string>();
170
171 foreach (var container in category.Values)
172 reports.AddRange(GetContainerStatsReports(container));
173
174 return reports;
154 } 175 }
155 176
156 private static void OutputCategoryStatsToConsole( 177 private static void OutputCategoryStatsToConsole(
157 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category) 178 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category)
158 { 179 {
159 foreach (var container in category.Values) 180 foreach (string report in GetCategoryStatsReports(category))
160 { 181 con.Output(report);
161 OutputContainerStatsToConsole(con, container);
162 }
163 } 182 }
164 183
165 private static void OutputContainerStatsToConsole( ICommandConsole con, SortedDictionary<string, Stat> container) 184 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container)
166 { 185 {
186 List<string> reports = new List<string>();
187
167 foreach (Stat stat in container.Values) 188 foreach (Stat stat in container.Values)
168 { 189 reports.Add(stat.ToConsoleString());
169 con.Output(stat.ToConsoleString()); 190
170 } 191 return reports;
192 }
193
194 private static void OutputContainerStatsToConsole(
195 ICommandConsole con, SortedDictionary<string, Stat> container)
196 {
197 foreach (string report in GetContainerStatsReports(container))
198 con.Output(report);
171 } 199 }
172 200
173 // Creates an OSDMap of the format: 201 // Creates an OSDMap of the format:
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index 1bee6a3..c258ff6 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -274,6 +274,12 @@ namespace OpenSim.Framework.Servers
274 "Set threadpool parameters. For debug purposes.", 274 "Set threadpool parameters. For debug purposes.",
275 HandleDebugThreadpoolSet); 275 HandleDebugThreadpoolSet);
276 276
277 m_console.Commands.AddCommand (
278 "Debug", false, "debug threadpool status",
279 "debug threadpool status",
280 "Show current debug threadpool parameters.",
281 HandleDebugThreadpoolStatus);
282
277 m_console.Commands.AddCommand( 283 m_console.Commands.AddCommand(
278 "Debug", false, "force gc", 284 "Debug", false, "force gc",
279 "force gc", 285 "force gc",
@@ -337,6 +343,23 @@ namespace OpenSim.Framework.Servers
337 Notice("serialosdreq is now {0}", setSerializeOsdRequests); 343 Notice("serialosdreq is now {0}", setSerializeOsdRequests);
338 } 344 }
339 345
346 private void HandleDebugThreadpoolStatus(string module, string[] args)
347 {
348 int workerThreads, iocpThreads;
349
350 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
351 Notice("Min worker threads: {0}", workerThreads);
352 Notice("Min IOCP threads: {0}", iocpThreads);
353
354 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
355 Notice("Max worker threads: {0}", workerThreads);
356 Notice("Max IOCP threads: {0}", iocpThreads);
357
358 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
359 Notice("Available worker threads: {0}", workerThreads);
360 Notice("Available IOCP threads: {0}", iocpThreads);
361 }
362
340 private void HandleDebugThreadpoolSet(string module, string[] args) 363 private void HandleDebugThreadpoolSet(string module, string[] args)
341 { 364 {
342 if (args.Length != 6) 365 if (args.Length != 6)
diff --git a/bin/OpenSim.32BitLaunch.exe.config b/bin/OpenSim.32BitLaunch.exe.config
index 6ac0206..6a6b3c8 100644
--- a/bin/OpenSim.32BitLaunch.exe.config
+++ b/bin/OpenSim.32BitLaunch.exe.config
@@ -11,22 +11,56 @@
11 </appSettings> 11 </appSettings>
12 <log4net> 12 <log4net>
13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> 13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
14 <filter type="log4net.Filter.LoggerMatchFilter">
15 <loggerToMatch value="special"/>
16 <acceptOnMatch value="false"/>
17 </filter>
14 <layout type="log4net.Layout.PatternLayout"> 18 <layout type="log4net.Layout.PatternLayout">
15 <conversionPattern value="%date{HH:mm:ss} - %message%newline" /> 19 <conversionPattern value="%date{HH:mm:ss} - %message" />
20 <!-- console log with milliseconds. Useful for debugging -->
21<!-- <conversionPattern value="%date{HH:mm:ss.fff} - %message" /> -->
16 </layout> 22 </layout>
17 </appender> 23 </appender>
24
18 <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> 25 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
19 <file value="OpenSim.32BitLaunch.log" /> 26 <file value="OpenSim.32BitLaunch.log" />
20 <appendToFile value="true" /> 27 <appendToFile value="true" />
28 <filter type="log4net.Filter.LoggerMatchFilter">
29 <loggerToMatch value="special"/>
30 <acceptOnMatch value="false"/>
31 </filter>
21 <layout type="log4net.Layout.PatternLayout"> 32 <layout type="log4net.Layout.PatternLayout">
22 <conversionPattern value="%date %-5level - %logger %message%newline" /> 33 <conversionPattern value="%date %-5level - %logger %message%newline" />
23 </layout> 34 </layout>
24 </appender> 35 </appender>
25 36
37 <appender name="StatsLogFileAppender" type="log4net.Appender.FileAppender">
38 <file value="OpenSimStats.log"/>
39 <appendToFile value="true" />
40 <layout type="log4net.Layout.PatternLayout">
41 <conversionPattern value="%date - %message%newline" />
42 </layout>
43 </appender>
44
26 <root> 45 <root>
27 <level value="DEBUG" /> 46 <level value="DEBUG" />
28 <appender-ref ref="Console" /> 47 <appender-ref ref="Console" />
29 <appender-ref ref="LogFileAppender" /> 48 <appender-ref ref="LogFileAppender" />
30 </root> 49 </root>
50
51 <!-- Independently control logging level for XEngine -->
52 <logger name="OpenSim.Region.ScriptEngine.XEngine">
53 <level value="INFO"/>
54 </logger>
55
56 <!-- Independently control logging level for per region module loading -->
57 <logger name="OpenSim.ApplicationPlugins.RegionModulesController.RegionModulesControllerPlugin">
58 <level value="INFO"/>
59 </logger>
60
61 <!-- used for stats recording -->
62 <logger name="special.StatsLogger">
63 <appender-ref ref="StatsLogFileAppender"/>
64 </logger>
31 </log4net> 65 </log4net>
32</configuration> 66</configuration>
diff --git a/bin/OpenSim.exe.config b/bin/OpenSim.exe.config
index 8a891f4..b2cb4e5 100755
--- a/bin/OpenSim.exe.config
+++ b/bin/OpenSim.exe.config
@@ -11,6 +11,10 @@
11 </appSettings> 11 </appSettings>
12 <log4net> 12 <log4net>
13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> 13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
14 <filter type="log4net.Filter.LoggerMatchFilter">
15 <loggerToMatch value="special"/>
16 <acceptOnMatch value="false"/>
17 </filter>
14 <layout type="log4net.Layout.PatternLayout"> 18 <layout type="log4net.Layout.PatternLayout">
15 <conversionPattern value="%date{HH:mm:ss} - %message" /> 19 <conversionPattern value="%date{HH:mm:ss} - %message" />
16 <!-- console log with milliseconds. Useful for debugging --> 20 <!-- console log with milliseconds. Useful for debugging -->
@@ -21,11 +25,23 @@
21 <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> 25 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
22 <file value="OpenSim.log" /> 26 <file value="OpenSim.log" />
23 <appendToFile value="true" /> 27 <appendToFile value="true" />
28 <filter type="log4net.Filter.LoggerMatchFilter">
29 <loggerToMatch value="special"/>
30 <acceptOnMatch value="false"/>
31 </filter>
24 <layout type="log4net.Layout.PatternLayout"> 32 <layout type="log4net.Layout.PatternLayout">
25 <conversionPattern value="%date %-5level - %logger %message%newline" /> 33 <conversionPattern value="%date %-5level - %logger %message%newline" />
26 </layout> 34 </layout>
27 </appender> 35 </appender>
28 36
37 <appender name="StatsLogFileAppender" type="log4net.Appender.FileAppender">
38 <file value="OpenSimStats.log"/>
39 <appendToFile value="true" />
40 <layout type="log4net.Layout.PatternLayout">
41 <conversionPattern value="%date - %message%newline" />
42 </layout>
43 </appender>
44
29 <root> 45 <root>
30 <level value="DEBUG" /> 46 <level value="DEBUG" />
31 <appender-ref ref="Console" /> 47 <appender-ref ref="Console" />
@@ -42,5 +58,10 @@
42 <level value="INFO"/> 58 <level value="INFO"/>
43 </logger> 59 </logger>
44 60
61 <!-- used for stats recording -->
62 <logger name="special.StatsLogger">
63 <appender-ref ref="StatsLogFileAppender"/>
64 </logger>
65
45 </log4net> 66 </log4net>
46</configuration> 67</configuration>
diff --git a/bin/Robust.32BitLaunch.exe.config b/bin/Robust.32BitLaunch.exe.config
index dae45ff..ec17049 100644
--- a/bin/Robust.32BitLaunch.exe.config
+++ b/bin/Robust.32BitLaunch.exe.config
@@ -11,22 +11,44 @@
11 </appSettings> 11 </appSettings>
12 <log4net> 12 <log4net>
13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> 13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
14 <filter type="log4net.Filter.LoggerMatchFilter">
15 <loggerToMatch value="special"/>
16 <acceptOnMatch value="false"/>
17 </filter>
14 <layout type="log4net.Layout.PatternLayout"> 18 <layout type="log4net.Layout.PatternLayout">
15 <conversionPattern value="%date{HH:mm:ss} - %message%newline" /> 19 <conversionPattern value="%date{HH:mm:ss} - %message%newline" />
16 </layout> 20 </layout>
17 </appender> 21 </appender>
22
18 <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> 23 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
19 <file value="Robust.32BitLaunch.log" /> 24 <file value="Robust.32BitLaunch.log" />
20 <appendToFile value="true" /> 25 <appendToFile value="true" />
26 <filter type="log4net.Filter.LoggerMatchFilter">
27 <loggerToMatch value="special"/>
28 <acceptOnMatch value="false"/>
29 </filter>
21 <layout type="log4net.Layout.PatternLayout"> 30 <layout type="log4net.Layout.PatternLayout">
22 <conversionPattern value="%date %-5level - %logger %message%newline" /> 31 <conversionPattern value="%date %-5level - %logger %message%newline" />
23 </layout> 32 </layout>
24 </appender> 33 </appender>
25 34
35 <appender name="StatsLogFileAppender" type="log4net.Appender.FileAppender">
36 <file value="RobustStats.log"/>
37 <appendToFile value="true" />
38 <layout type="log4net.Layout.PatternLayout">
39 <conversionPattern value="%date - %message%newline" />
40 </layout>
41 </appender>
42
26 <root> 43 <root>
27 <level value="DEBUG" /> 44 <level value="DEBUG" />
28 <appender-ref ref="Console" /> 45 <appender-ref ref="Console" />
29 <appender-ref ref="LogFileAppender" /> 46 <appender-ref ref="LogFileAppender" />
30 </root> 47 </root>
48
49 <!-- used for stats recording -->
50 <logger name="special.StatsLogger">
51 <appender-ref ref="StatsLogFileAppender"/>
52 </logger>
31 </log4net> 53 </log4net>
32</configuration> 54</configuration>
diff --git a/bin/Robust.exe.config b/bin/Robust.exe.config
index 4914f55..62975fd 100644
--- a/bin/Robust.exe.config
+++ b/bin/Robust.exe.config
@@ -11,6 +11,10 @@
11 </appSettings> 11 </appSettings>
12 <log4net> 12 <log4net>
13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> 13 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
14 <filter type="log4net.Filter.LoggerMatchFilter">
15 <loggerToMatch value="special"/>
16 <acceptOnMatch value="false"/>
17 </filter>
14 <layout type="log4net.Layout.PatternLayout"> 18 <layout type="log4net.Layout.PatternLayout">
15 <conversionPattern value="%date{HH:mm:ss} - %message%newline" /> 19 <conversionPattern value="%date{HH:mm:ss} - %message%newline" />
16 </layout> 20 </layout>
@@ -19,15 +23,32 @@
19 <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> 23 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
20 <file value="Robust.log" /> 24 <file value="Robust.log" />
21 <appendToFile value="true" /> 25 <appendToFile value="true" />
26 <filter type="log4net.Filter.LoggerMatchFilter">
27 <loggerToMatch value="special"/>
28 <acceptOnMatch value="false"/>
29 </filter>
22 <layout type="log4net.Layout.PatternLayout"> 30 <layout type="log4net.Layout.PatternLayout">
23 <conversionPattern value="%date %-5level - %logger %message%newline" /> 31 <conversionPattern value="%date %-5level - %logger %message%newline" />
24 </layout> 32 </layout>
25 </appender> 33 </appender>
26 34
35 <appender name="StatsLogFileAppender" type="log4net.Appender.FileAppender">
36 <file value="RobustStats.log"/>
37 <appendToFile value="true" />
38 <layout type="log4net.Layout.PatternLayout">
39 <conversionPattern value="%date - %message%newline" />
40 </layout>
41 </appender>
42
27 <root> 43 <root>
28 <level value="DEBUG" /> 44 <level value="DEBUG" />
29 <appender-ref ref="Console" /> 45 <appender-ref ref="Console" />
30 <appender-ref ref="LogFileAppender" /> 46 <appender-ref ref="LogFileAppender" />
31 </root> 47 </root>
48
49 <!-- used for stats recording -->
50 <logger name="special.StatsLogger">
51 <appender-ref ref="StatsLogFileAppender"/>
52 </logger>
32 </log4net> 53 </log4net>
33</configuration> 54</configuration>