Extend "show stats" command to "show stats [list|all|<category name>]"

This allows different categories of stats to be shown, with options to list categories or show all stats.
Currently categories are scene and simulator and only a very few stats are currently registered via this mechanism.
This commit also adds percentage stats for packets and blocks reused from the packet pool.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-10-11 23:28:53 +01:00
parent b768c35f6f
commit 1f2472d0fc
6 changed files with 330 additions and 167 deletions

View File

@@ -359,13 +359,19 @@ Asset service request failures: {3}" + Environment.NewLine,
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
foreach (KeyValuePair<string, Stat> kvp in StatsManager.RegisteredStats)
{
Stat stat = kvp.Value;
Dictionary<string, Dictionary<string, Stat>> sceneStats;
if (stat.Category == "scene" && stat.Verbosity == StatVerbosity.Info)
if (StatsManager.TryGetStats("scene", out sceneStats))
{
foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats)
{
sb.AppendFormat("Slow frames ({0}): {1}\n", stat.Container, stat.Value);
foreach (Stat stat in kvp.Value.Values)
{
if (stat.Verbosity == StatVerbosity.Info)
{
sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName);
}
}
}
}