aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-20 00:00:39 +0100
committerJustin Clark-Casey (justincc)2013-06-20 00:00:39 +0100
commit086fd70a5fdfd9b3a0e56201596f6d6bb20f391e (patch)
treeff230f73060ae70ca24f49e716a97267a11d88e2 /OpenSim/Framework/Monitoring
parentDisplay existing statistic of how many http requests a server is making as se... (diff)
downloadopensim-SC_OLD-086fd70a5fdfd9b3a0e56201596f6d6bb20f391e.zip
opensim-SC_OLD-086fd70a5fdfd9b3a0e56201596f6d6bb20f391e.tar.gz
opensim-SC_OLD-086fd70a5fdfd9b3a0e56201596f6d6bb20f391e.tar.bz2
opensim-SC_OLD-086fd70a5fdfd9b3a0e56201596f6d6bb20f391e.tar.xz
Make it possible to specify display of stats in a particular 'container' by separating category and container with a period.
e.g. "show stats server.network" I failed to realize this had already been implemented without the period in the show stats command (as the command help had not been updated). However, I would prefer the . approach as it will allow specifying multiple stats, easier wildcarding, etc. This commit also prevents any stat from having a period in its short name.
Diffstat (limited to 'OpenSim/Framework/Monitoring')
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs8
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs12
2 files changed, 17 insertions, 3 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
index 85d1a78..c57ee0c 100644
--- a/OpenSim/Framework/Monitoring/Stats/Stat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -42,6 +42,8 @@ namespace OpenSim.Framework.Monitoring
42 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 public static readonly char[] DisallowedShortNameCharacters = { '.' };
46
45 /// <summary> 47 /// <summary>
46 /// Category of this stat (e.g. cache, scene, etc). 48 /// Category of this stat (e.g. cache, scene, etc).
47 /// </summary> 49 /// </summary>
@@ -166,6 +168,12 @@ namespace OpenSim.Framework.Monitoring
166 throw new Exception( 168 throw new Exception(
167 string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category)); 169 string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
168 170
171 foreach (char c in DisallowedShortNameCharacters)
172 {
173 if (shortName.IndexOf(c) != -1)
174 throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c));
175 }
176
169 ShortName = shortName; 177 ShortName = shortName;
170 Name = name; 178 Name = name;
171 Description = description; 179 Description = description;
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 3aee984..af9f5ba 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -68,12 +68,13 @@ namespace OpenSim.Framework.Monitoring
68 "General", 68 "General",
69 false, 69 false,
70 "show stats", 70 "show stats",
71 "show stats [list|all|<category>]", 71 "show stats [list|all|<category>[.<container>]",
72 "Show statistical information for this server", 72 "Show statistical information for this server",
73 "If no final argument is specified then legacy statistics information is currently shown.\n" 73 "If no final argument is specified then legacy statistics information is currently shown.\n"
74 + "If list is specified then statistic categories are shown.\n" 74 + "If list is specified then statistic categories are shown.\n"
75 + "If all is specified then all registered statistics are shown.\n" 75 + "If all is specified then all registered statistics are shown.\n"
76 + "If a category name is specified then only statistics from that category are shown.\n" 76 + "If a category name is specified then only statistics from that category are shown.\n"
77 + "If a category container is also specified then only statistics from that category in that container are shown.\n"
77 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", 78 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
78 HandleShowStatsCommand); 79 HandleShowStatsCommand);
79 } 80 }
@@ -84,8 +85,11 @@ namespace OpenSim.Framework.Monitoring
84 85
85 if (cmd.Length > 2) 86 if (cmd.Length > 2)
86 { 87 {
87 var categoryName = cmd[2]; 88 string name = cmd[2];
88 var containerName = cmd.Length > 3 ? cmd[3] : String.Empty; 89 string[] components = name.Split('.');
90
91 string categoryName = components[0];
92 string containerName = components.Length > 1 ? components[1] : null;
89 93
90 if (categoryName == AllSubCommand) 94 if (categoryName == AllSubCommand)
91 { 95 {
@@ -107,7 +111,9 @@ namespace OpenSim.Framework.Monitoring
107 else 111 else
108 { 112 {
109 if (String.IsNullOrEmpty(containerName)) 113 if (String.IsNullOrEmpty(containerName))
114 {
110 OutputCategoryStatsToConsole(con, category); 115 OutputCategoryStatsToConsole(con, category);
116 }
111 else 117 else
112 { 118 {
113 SortedDictionary<string, Stat> container; 119 SortedDictionary<string, Stat> container;