private void HandleShowCapsListCommand(string module, string[] cmdParams) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) { return; } StringBuilder capsReport = new StringBuilder(); capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); m_capsObjects.ForEach(delegate(KeyValuePair <UUID, Caps> kvp) { capsReport.AppendFormat("** User {0}:\n", kvp.Key); Caps caps = kvp.Value; for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext();) { Uri uri = new Uri(kvp2.Value.ToString()); capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers()) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url); } foreach (KeyValuePair <string, string> kvp3 in caps.ExternalCapsHandlers) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); } }); MainConsole.Instance.Output(capsReport.ToString()); }
private void BuildSummaryStatsByUserReport(StringBuilder sb) { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Name", 32); cdt.AddColumn("Type", 5); cdt.AddColumn("Req Received", 12); cdt.AddColumn("Req Handled", 12); cdt.Indent = 2; m_scene.ForEachScenePresence( sp => { Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); if (caps == null) { return; } Dictionary <string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers(); int totalRequestsReceived = 0; int totalRequestsHandled = 0; foreach (IRequestHandler reqHandler in capsHandlers.Values) { totalRequestsReceived += reqHandler.RequestsReceived; totalRequestsHandled += reqHandler.RequestsHandled; } Dictionary <string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers(); foreach (PollServiceEventArgs handler in capsPollHandlers.Values) { totalRequestsReceived += handler.RequestsReceived; totalRequestsHandled += handler.RequestsHandled; } cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled); } ); sb.Append(cdt.ToString()); }
private void HandleShowCapsListCommand(string module, string[] cmdParams) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) { return; } StringBuilder capsReport = new StringBuilder(); capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); lock (m_capsObjects) { foreach (KeyValuePair <uint, Caps> kvp in m_capsObjects) { Caps caps = kvp.Value; string name = string.Empty; if (m_scene.TryGetScenePresence(caps.AgentID, out ScenePresence sp) && sp != null) { name = sp.Name; } capsReport.AppendFormat("** Circuit {0}; {1} {2}:\n", kvp.Key, caps.AgentID, name); for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext();) { Uri uri = new Uri(kvp2.Value.ToString()); capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers()) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url); } foreach (KeyValuePair <string, string> kvp3 in caps.ExternalCapsHandlers) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); } } } MainConsole.Instance.Output(capsReport.ToString()); }
private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp) { sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root"); ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Cap Name", 34); cdt.AddColumn("Req Received", 12); cdt.AddColumn("Req Handled", 12); cdt.Indent = 2; Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); if (caps == null) { return; } List <CapTableRow> capRows = new List <CapTableRow>(); foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values) { capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled)); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp in caps.GetPollHandlers()) { capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled)); } foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived)) { cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled); } sb.Append(cdt.ToString()); }
private void BuildSummaryStatsByCapReport(StringBuilder sb) { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Name", 34); cdt.AddColumn("Req Received", 12); cdt.AddColumn("Req Handled", 12); cdt.Indent = 2; Dictionary <string, int> receivedStats = new Dictionary <string, int>(); Dictionary <string, int> handledStats = new Dictionary <string, int>(); m_scene.ForEachScenePresence( sp => { Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); if (caps == null) { return; } foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values) { string reqName = reqHandler.Name ?? ""; if (!receivedStats.ContainsKey(reqName)) { receivedStats[reqName] = reqHandler.RequestsReceived; handledStats[reqName] = reqHandler.RequestsHandled; } else { receivedStats[reqName] += reqHandler.RequestsReceived; handledStats[reqName] += reqHandler.RequestsHandled; } } foreach (KeyValuePair <string, PollServiceEventArgs> kvp in caps.GetPollHandlers()) { string name = kvp.Key; PollServiceEventArgs pollHandler = kvp.Value; if (!receivedStats.ContainsKey(name)) { receivedStats[name] = pollHandler.RequestsReceived; handledStats[name] = pollHandler.RequestsHandled; } else { receivedStats[name] += pollHandler.RequestsReceived; handledStats[name] += pollHandler.RequestsHandled; } } } ); foreach (KeyValuePair <string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value)) { cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]); } sb.Append(cdt.ToString()); }