diff options
author | Justin Clark-Casey (justincc) | 2013-06-20 00:45:56 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-20 00:45:56 +0100 |
commit | 05790ba1cf7dd07f9f11ce248262041eb300ea49 (patch) | |
tree | 9324093154c423139a1bbfe0cd9acd677a8fc13e /OpenSim/Framework/Monitoring/StatsManager.cs | |
parent | minor: Change "memory churn" terminology in statistics to "heap allocation ra... (diff) | |
download | opensim-SC_OLD-05790ba1cf7dd07f9f11ce248262041eb300ea49.zip opensim-SC_OLD-05790ba1cf7dd07f9f11ce248262041eb300ea49.tar.gz opensim-SC_OLD-05790ba1cf7dd07f9f11ce248262041eb300ea49.tar.bz2 opensim-SC_OLD-05790ba1cf7dd07f9f11ce248262041eb300ea49.tar.xz |
Allow more than one stat category to be specified in "show stats"
e.g. "show stats httpserver.9000 server.network"
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index af9f5ba..12d3a75 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | 32 | ||
32 | namespace OpenSim.Framework.Monitoring | 33 | namespace OpenSim.Framework.Monitoring |
@@ -68,13 +69,14 @@ namespace OpenSim.Framework.Monitoring | |||
68 | "General", | 69 | "General", |
69 | false, | 70 | false, |
70 | "show stats", | 71 | "show stats", |
71 | "show stats [list|all|<category>[.<container>]", | 72 | "show stats [list|all|(<category>[.<container>])+", |
72 | "Show statistical information for this server", | 73 | "Show statistical information for this server", |
73 | "If no final argument is specified then legacy statistics information is currently shown.\n" | 74 | "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" | 75 | + "'list' argument will show statistic categories.\n" |
75 | + "If all is specified then all registered statistics are shown.\n" | 76 | + "'all' will show all statistics.\n" |
76 | + "If a category name is specified then only statistics from that category are shown.\n" | 77 | + "A <category> name will show statistics from that category.\n" |
77 | + "If a category container is also specified then only statistics from that category in that container are shown.\n" | 78 | + "A <category>.<container> name will show statistics from that category in that container.\n" |
79 | + "More than one name can be given separated by spaces.\n" | ||
78 | + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", | 80 | + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", |
79 | HandleShowStatsCommand); | 81 | HandleShowStatsCommand); |
80 | } | 82 | } |
@@ -85,45 +87,47 @@ namespace OpenSim.Framework.Monitoring | |||
85 | 87 | ||
86 | if (cmd.Length > 2) | 88 | if (cmd.Length > 2) |
87 | { | 89 | { |
88 | string name = cmd[2]; | 90 | foreach (string name in cmd.Skip(2)) |
89 | string[] components = name.Split('.'); | 91 | { |
92 | string[] components = name.Split('.'); | ||
90 | 93 | ||
91 | string categoryName = components[0]; | 94 | string categoryName = components[0]; |
92 | string containerName = components.Length > 1 ? components[1] : null; | 95 | string containerName = components.Length > 1 ? components[1] : null; |
93 | 96 | ||
94 | if (categoryName == AllSubCommand) | 97 | if (categoryName == AllSubCommand) |
95 | { | 98 | { |
96 | OutputAllStatsToConsole(con); | 99 | OutputAllStatsToConsole(con); |
97 | } | 100 | } |
98 | else if (categoryName == ListSubCommand) | 101 | else if (categoryName == ListSubCommand) |
99 | { | ||
100 | con.Output("Statistic categories available are:"); | ||
101 | foreach (string category in RegisteredStats.Keys) | ||
102 | con.OutputFormat(" {0}", category); | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | SortedDictionary<string, SortedDictionary<string, Stat>> category; | ||
107 | if (!RegisteredStats.TryGetValue(categoryName, out category)) | ||
108 | { | 102 | { |
109 | con.OutputFormat("No such category as {0}", categoryName); | 103 | con.Output("Statistic categories available are:"); |
104 | foreach (string category in RegisteredStats.Keys) | ||
105 | con.OutputFormat(" {0}", category); | ||
110 | } | 106 | } |
111 | else | 107 | else |
112 | { | 108 | { |
113 | if (String.IsNullOrEmpty(containerName)) | 109 | SortedDictionary<string, SortedDictionary<string, Stat>> category; |
110 | if (!RegisteredStats.TryGetValue(categoryName, out category)) | ||
114 | { | 111 | { |
115 | OutputCategoryStatsToConsole(con, category); | 112 | con.OutputFormat("No such category as {0}", categoryName); |
116 | } | 113 | } |
117 | else | 114 | else |
118 | { | 115 | { |
119 | SortedDictionary<string, Stat> container; | 116 | if (String.IsNullOrEmpty(containerName)) |
120 | if (category.TryGetValue(containerName, out container)) | ||
121 | { | 117 | { |
122 | OutputContainerStatsToConsole(con, container); | 118 | OutputCategoryStatsToConsole(con, category); |
123 | } | 119 | } |
124 | else | 120 | else |
125 | { | 121 | { |
126 | con.OutputFormat("No such container {0} in category {1}", containerName, categoryName); | 122 | SortedDictionary<string, Stat> container; |
123 | if (category.TryGetValue(containerName, out container)) | ||
124 | { | ||
125 | OutputContainerStatsToConsole(con, container); | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | con.OutputFormat("No such container {0} in category {1}", containerName, categoryName); | ||
130 | } | ||
127 | } | 131 | } |
128 | } | 132 | } |
129 | } | 133 | } |