aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring')
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs53
1 files changed, 31 insertions, 22 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 5c8d934..0bac247 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -30,8 +30,6 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq; 31using System.Linq;
32using System.Text; 32using System.Text;
33using System.Reflection;
34using log4net;
35 33
36using OpenSim.Framework; 34using OpenSim.Framework;
37using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
@@ -43,8 +41,6 @@ namespace OpenSim.Framework.Monitoring
43 /// </summary> 41 /// </summary>
44 public static class StatsManager 42 public static class StatsManager
45 { 43 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 // Subcommand used to list other stats. 44 // Subcommand used to list other stats.
49 public const string AllSubCommand = "all"; 45 public const string AllSubCommand = "all";
50 46
@@ -102,7 +98,6 @@ namespace OpenSim.Framework.Monitoring
102 public static void HandleShowStatsCommand(string module, string[] cmd) 98 public static void HandleShowStatsCommand(string module, string[] cmd)
103 { 99 {
104 ICommandConsole con = MainConsole.Instance; 100 ICommandConsole con = MainConsole.Instance;
105 StringBuilder report = new StringBuilder();
106 101
107 if (cmd.Length > 2) 102 if (cmd.Length > 2)
108 { 103 {
@@ -116,8 +111,7 @@ namespace OpenSim.Framework.Monitoring
116 111
117 if (categoryName == AllSubCommand) 112 if (categoryName == AllSubCommand)
118 { 113 {
119 foreach (string report2 in GetAllStatsReports()) 114 OutputAllStatsToConsole(con);
120 report.AppendLine(report2);
121 } 115 }
122 else if (categoryName == ListSubCommand) 116 else if (categoryName == ListSubCommand)
123 { 117 {
@@ -136,8 +130,7 @@ namespace OpenSim.Framework.Monitoring
136 { 130 {
137 if (String.IsNullOrEmpty(containerName)) 131 if (String.IsNullOrEmpty(containerName))
138 { 132 {
139 foreach (string report2 in GetCategoryStatsReports(category)) 133 OutputCategoryStatsToConsole(con, category);
140 report.AppendLine(report2);
141 } 134 }
142 else 135 else
143 { 136 {
@@ -146,15 +139,14 @@ namespace OpenSim.Framework.Monitoring
146 { 139 {
147 if (String.IsNullOrEmpty(statName)) 140 if (String.IsNullOrEmpty(statName))
148 { 141 {
149 foreach (string report2 in GetContainerStatsReports(container)) 142 OutputContainerStatsToConsole(con, container);
150 report.AppendLine(report2);
151 } 143 }
152 else 144 else
153 { 145 {
154 Stat stat; 146 Stat stat;
155 if (container.TryGetValue(statName, out stat)) 147 if (container.TryGetValue(statName, out stat))
156 { 148 {
157 report.AppendLine(stat.ToConsoleString()); 149 OutputStatToConsole(con, stat);
158 } 150 }
159 else 151 else
160 { 152 {
@@ -176,18 +168,10 @@ namespace OpenSim.Framework.Monitoring
176 { 168 {
177 // Legacy 169 // Legacy
178 if (SimExtraStats != null) 170 if (SimExtraStats != null)
179 { 171 con.Output(SimExtraStats.Report());
180 report.Append(SimExtraStats.Report());
181 }
182 else 172 else
183 { 173 OutputAllStatsToConsole(con);
184 foreach (string report2 in GetAllStatsReports())
185 report.AppendLine(report2);
186 }
187 } 174 }
188
189 if (report.Length > 0)
190 m_log.Debug(string.Join(" ", cmd) + "\n" + report.ToString());
191 } 175 }
192 176
193 public static List<string> GetAllStatsReports() 177 public static List<string> GetAllStatsReports()
@@ -200,6 +184,12 @@ namespace OpenSim.Framework.Monitoring
200 return reports; 184 return reports;
201 } 185 }
202 186
187 private static void OutputAllStatsToConsole(ICommandConsole con)
188 {
189 foreach (string report in GetAllStatsReports())
190 con.Output(report);
191 }
192
203 private static List<string> GetCategoryStatsReports( 193 private static List<string> GetCategoryStatsReports(
204 SortedDictionary<string, SortedDictionary<string, Stat>> category) 194 SortedDictionary<string, SortedDictionary<string, Stat>> category)
205 { 195 {
@@ -211,6 +201,13 @@ namespace OpenSim.Framework.Monitoring
211 return reports; 201 return reports;
212 } 202 }
213 203
204 private static void OutputCategoryStatsToConsole(
205 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category)
206 {
207 foreach (string report in GetCategoryStatsReports(category))
208 con.Output(report);
209 }
210
214 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container) 211 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container)
215 { 212 {
216 List<string> reports = new List<string>(); 213 List<string> reports = new List<string>();
@@ -221,6 +218,18 @@ namespace OpenSim.Framework.Monitoring
221 return reports; 218 return reports;
222 } 219 }
223 220
221 private static void OutputContainerStatsToConsole(
222 ICommandConsole con, SortedDictionary<string, Stat> container)
223 {
224 foreach (string report in GetContainerStatsReports(container))
225 con.Output(report);
226 }
227
228 private static void OutputStatToConsole(ICommandConsole con, Stat stat)
229 {
230 con.Output(stat.ToConsoleString());
231 }
232
224 // Creates an OSDMap of the format: 233 // Creates an OSDMap of the format:
225 // { categoryName: { 234 // { categoryName: {
226 // containerName: { 235 // containerName: {