From 8ce3fa646b4da171d96784935ba5a39ea65dd70a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 18 Mar 2014 20:21:47 +0000 Subject: Allow "show stats" console command to take a full stat name and display only that stat. For example, scene.test.RootAgents will show only the RootAgents stat in the scene named "test" --- OpenSim/Framework/Monitoring/StatsManager.cs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Monitoring') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 05ee4c5..8fcbdca 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -99,6 +99,7 @@ namespace OpenSim.Framework.Monitoring string categoryName = components[0]; string containerName = components.Length > 1 ? components[1] : null; + string statName = components.Length > 2 ? components[2] : null; if (categoryName == AllSubCommand) { @@ -128,7 +129,23 @@ namespace OpenSim.Framework.Monitoring SortedDictionary container; if (category.TryGetValue(containerName, out container)) { - OutputContainerStatsToConsole(con, container); + if (String.IsNullOrEmpty(statName)) + { + OutputContainerStatsToConsole(con, container); + } + else + { + Stat stat; + if (container.TryGetValue(statName, out stat)) + { + OutputStatToConsole(con, stat); + } + else + { + con.OutputFormat( + "No such stat {0} in {1}.{2}", statName, categoryName, containerName); + } + } } else { @@ -200,6 +217,11 @@ namespace OpenSim.Framework.Monitoring con.Output(report); } + private static void OutputStatToConsole(ICommandConsole con, Stat stat) + { + con.Output(stat.ToConsoleString()); + } + // Creates an OSDMap of the format: // { categoryName: { // containerName: { -- cgit v1.1