aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/StatsManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs66
1 files changed, 66 insertions, 0 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 12d3a75..a5b54c9 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -30,6 +30,8 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenMetaverse.StructuredData;
34
33namespace OpenSim.Framework.Monitoring 35namespace OpenSim.Framework.Monitoring
34{ 36{
35 /// <summary> 37 /// <summary>
@@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
168 } 170 }
169 } 171 }
170 172
173 // Creates an OSDMap of the format:
174 // { categoryName: {
175 // containerName: {
176 // statName: {
177 // "Name": name,
178 // "ShortName": shortName,
179 // ...
180 // },
181 // statName: {
182 // "Name": name,
183 // "ShortName": shortName,
184 // ...
185 // },
186 // ...
187 // },
188 // containerName: {
189 // ...
190 // },
191 // ...
192 // },
193 // categoryName: {
194 // ...
195 // },
196 // ...
197 // }
198 // The passed in parameters will filter the categories, containers and stats returned. If any of the
199 // parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
200 // Case matters.
201 public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
202 {
203 OSDMap map = new OSDMap();
204
205 foreach (string catName in RegisteredStats.Keys)
206 {
207 // Do this category if null spec, "all" subcommand or category name matches passed parameter.
208 // Skip category if none of the above.
209 if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
210 continue;
211
212 OSDMap contMap = new OSDMap();
213 foreach (string contName in RegisteredStats[catName].Keys)
214 {
215 if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
216 continue;
217
218 OSDMap statMap = new OSDMap();
219
220 SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
221 foreach (string statName in theStats.Keys)
222 {
223 if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
224 continue;
225
226 statMap.Add(statName, theStats[statName].ToOSDMap());
227 }
228
229 contMap.Add(contName, statMap);
230 }
231 map.Add(catName, contMap);
232 }
233
234 return map;
235 }
236
171// /// <summary> 237// /// <summary>
172// /// Start collecting statistics related to assets. 238// /// Start collecting statistics related to assets.
173// /// Should only be called once. 239// /// Should only be called once.