aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring
diff options
context:
space:
mode:
authorDan Lake2013-02-14 20:05:42 -0800
committerDan Lake2013-02-14 20:05:42 -0800
commitafeb5d4917506ced2a1e4098aeb4bc94ae64fc06 (patch)
tree87d0b2d0187698be82e505c667411d7f59815421 /OpenSim/Framework/Monitoring
parentFix handling of string values in JsonSetValueJson(). There are (diff)
downloadopensim-SC-afeb5d4917506ced2a1e4098aeb4bc94ae64fc06.zip
opensim-SC-afeb5d4917506ced2a1e4098aeb4bc94ae64fc06.tar.gz
opensim-SC-afeb5d4917506ced2a1e4098aeb4bc94ae64fc06.tar.bz2
opensim-SC-afeb5d4917506ced2a1e4098aeb4bc94ae64fc06.tar.xz
Use SortedDictionary in StatsManager instead of regular Dictionary so stats will interate and print in a defined order
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs4
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs40
2 files changed, 22 insertions, 22 deletions
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index aa86202..3765efb 100644
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -359,11 +359,11 @@ Asset service request failures: {3}" + Environment.NewLine,
359 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, 359 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
360 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); 360 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
361 361
362 Dictionary<string, Dictionary<string, Stat>> sceneStats; 362 SortedDictionary<string, SortedDictionary<string, Stat>> sceneStats;
363 363
364 if (StatsManager.TryGetStats("scene", out sceneStats)) 364 if (StatsManager.TryGetStats("scene", out sceneStats))
365 { 365 {
366 foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats) 366 foreach (KeyValuePair<string, SortedDictionary<string, Stat>> kvp in sceneStats)
367 { 367 {
368 foreach (Stat stat in kvp.Value.Values) 368 foreach (Stat stat in kvp.Value.Values)
369 { 369 {
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 0762b01..910907e 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -51,8 +51,8 @@ namespace OpenSim.Framework.Monitoring
51 /// <remarks> 51 /// <remarks>
52 /// Do not add or remove directly from this dictionary. 52 /// Do not add or remove directly from this dictionary.
53 /// </remarks> 53 /// </remarks>
54 public static Dictionary<string, Dictionary<string, Dictionary<string, Stat>>> RegisteredStats 54 public static SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Stat>>> RegisteredStats
55 = new Dictionary<string, Dictionary<string, Dictionary<string, Stat>>>(); 55 = new SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Stat>>>();
56 56
57 private static AssetStatsCollector assetStats; 57 private static AssetStatsCollector assetStats;
58 private static UserStatsCollector userStats; 58 private static UserStatsCollector userStats;
@@ -101,7 +101,7 @@ namespace OpenSim.Framework.Monitoring
101 } 101 }
102 else 102 else
103 { 103 {
104 Dictionary<string, Dictionary<string, Stat>> category; 104 SortedDictionary<string, SortedDictionary<string, Stat>> category;
105 if (!RegisteredStats.TryGetValue(categoryName, out category)) 105 if (!RegisteredStats.TryGetValue(categoryName, out category))
106 { 106 {
107 con.OutputFormat("No such category as {0}", categoryName); 107 con.OutputFormat("No such category as {0}", categoryName);
@@ -120,7 +120,7 @@ namespace OpenSim.Framework.Monitoring
120 } 120 }
121 121
122 private static void OutputCategoryStatsToConsole( 122 private static void OutputCategoryStatsToConsole(
123 ICommandConsole con, Dictionary<string, Dictionary<string, Stat>> category) 123 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category)
124 { 124 {
125 foreach (var container in category.Values) 125 foreach (var container in category.Values)
126 { 126 {
@@ -160,8 +160,8 @@ namespace OpenSim.Framework.Monitoring
160 /// <returns></returns> 160 /// <returns></returns>
161 public static bool RegisterStat(Stat stat) 161 public static bool RegisterStat(Stat stat)
162 { 162 {
163 Dictionary<string, Dictionary<string, Stat>> category = null, newCategory; 163 SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory;
164 Dictionary<string, Stat> container = null, newContainer; 164 SortedDictionary<string, Stat> container = null, newContainer;
165 165
166 lock (RegisteredStats) 166 lock (RegisteredStats)
167 { 167 {
@@ -175,14 +175,14 @@ namespace OpenSim.Framework.Monitoring
175 // This means that we don't need to lock or copy them on iteration, which will be a much more 175 // This means that we don't need to lock or copy them on iteration, which will be a much more
176 // common operation after startup. 176 // common operation after startup.
177 if (container != null) 177 if (container != null)
178 newContainer = new Dictionary<string, Stat>(container); 178 newContainer = new SortedDictionary<string, Stat>(container);
179 else 179 else
180 newContainer = new Dictionary<string, Stat>(); 180 newContainer = new SortedDictionary<string, Stat>();
181 181
182 if (category != null) 182 if (category != null)
183 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); 183 newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category);
184 else 184 else
185 newCategory = new Dictionary<string, Dictionary<string, Stat>>(); 185 newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>();
186 186
187 newContainer[stat.ShortName] = stat; 187 newContainer[stat.ShortName] = stat;
188 newCategory[stat.Container] = newContainer; 188 newCategory[stat.Container] = newContainer;
@@ -196,21 +196,21 @@ namespace OpenSim.Framework.Monitoring
196 /// Deregister a statistic 196 /// Deregister a statistic
197 /// </summary>> 197 /// </summary>>
198 /// <param name='stat'></param> 198 /// <param name='stat'></param>
199 /// <returns></returns 199 /// <returns></returns>
200 public static bool DeregisterStat(Stat stat) 200 public static bool DeregisterStat(Stat stat)
201 { 201 {
202 Dictionary<string, Dictionary<string, Stat>> category = null, newCategory; 202 SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory;
203 Dictionary<string, Stat> container = null, newContainer; 203 SortedDictionary<string, Stat> container = null, newContainer;
204 204
205 lock (RegisteredStats) 205 lock (RegisteredStats)
206 { 206 {
207 if (!TryGetStat(stat, out category, out container)) 207 if (!TryGetStat(stat, out category, out container))
208 return false; 208 return false;
209 209
210 newContainer = new Dictionary<string, Stat>(container); 210 newContainer = new SortedDictionary<string, Stat>(container);
211 newContainer.Remove(stat.ShortName); 211 newContainer.Remove(stat.ShortName);
212 212
213 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); 213 newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category);
214 newCategory.Remove(stat.Container); 214 newCategory.Remove(stat.Container);
215 215
216 newCategory[stat.Container] = newContainer; 216 newCategory[stat.Container] = newContainer;
@@ -220,15 +220,15 @@ namespace OpenSim.Framework.Monitoring
220 } 220 }
221 } 221 }
222 222
223 public static bool TryGetStats(string category, out Dictionary<string, Dictionary<string, Stat>> stats) 223 public static bool TryGetStats(string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats)
224 { 224 {
225 return RegisteredStats.TryGetValue(category, out stats); 225 return RegisteredStats.TryGetValue(category, out stats);
226 } 226 }
227 227
228 public static bool TryGetStat( 228 public static bool TryGetStat(
229 Stat stat, 229 Stat stat,
230 out Dictionary<string, Dictionary<string, Stat>> category, 230 out SortedDictionary<string, SortedDictionary<string, Stat>> category,
231 out Dictionary<string, Stat> container) 231 out SortedDictionary<string, Stat> container)
232 { 232 {
233 category = null; 233 category = null;
234 container = null; 234 container = null;
@@ -252,9 +252,9 @@ namespace OpenSim.Framework.Monitoring
252 { 252 {
253 lock (RegisteredStats) 253 lock (RegisteredStats)
254 { 254 {
255 foreach (Dictionary<string, Dictionary<string, Stat>> category in RegisteredStats.Values) 255 foreach (SortedDictionary<string, SortedDictionary<string, Stat>> category in RegisteredStats.Values)
256 { 256 {
257 foreach (Dictionary<string, Stat> container in category.Values) 257 foreach (SortedDictionary<string, Stat> container in category.Values)
258 { 258 {
259 foreach (Stat stat in container.Values) 259 foreach (Stat stat in container.Values)
260 { 260 {