remove redundate console comand add, change stat deregister

LSLKeyTest
UbitUmarov 2016-08-24 06:57:21 +01:00
parent 32396742f8
commit fc45942026
1 changed files with 14 additions and 22 deletions

View File

@ -80,16 +80,7 @@ namespace OpenSim.Framework.Monitoring
+ "'all' will show all statistics.\n" + "'all' will show all statistics.\n"
+ "A <category> name will show statistics from that category.\n" + "A <category> name will show statistics from that category.\n"
+ "A <category>.<container> name will show statistics from that category in that container.\n" + "A <category>.<container> name will show statistics from that category in that container.\n"
+ "More than one name can be given separated by spaces.\n" + "More than one name can be given separated by spaces.\n",
+ "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
HandleShowStatsCommand);
console.Commands.AddCommand(
"General",
false,
"show stats",
"show stats [list|all|(<category>[.<container>])+",
"Alias for 'stats show' command",
HandleShowStatsCommand); HandleShowStatsCommand);
StatsLogger.RegisterConsoleCommands(console); StatsLogger.RegisterConsoleCommands(console);
@ -396,23 +387,24 @@ namespace OpenSim.Framework.Monitoring
/// <returns></returns> /// <returns></returns>
public static bool DeregisterStat(Stat stat) public static bool DeregisterStat(Stat stat)
{ {
SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory; SortedDictionary<string, SortedDictionary<string, Stat>> category = null;
SortedDictionary<string, Stat> container = null, newContainer; SortedDictionary<string, Stat> container = null;
lock (RegisteredStats) lock (RegisteredStats)
{ {
if (!TryGetStatParents(stat, out category, out container)) if (!TryGetStatParents(stat, out category, out container))
return false; return false;
newContainer = new SortedDictionary<string, Stat>(container); if(container != null)
newContainer.Remove(stat.ShortName); {
container.Remove(stat.ShortName);
newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category); if(category != null && container.Count == 0)
newCategory.Remove(stat.Container); {
category.Remove(stat.Container);
newCategory[stat.Container] = newContainer; if(category.Count == 0)
RegisteredStats[stat.Category] = newCategory; RegisteredStats.Remove(stat.Category);
}
}
return true; return true;
} }
} }