private void AssertThrottles( LLUDPClient udpClient, double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes, double totalBytes, double targetBytes, double maxBytes) { ClientInfo ci = udpClient.GetClientInfo(); // Console.WriteLine( // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); Assert.AreEqual((int)landBytes, ci.landThrottle, "Land"); Assert.AreEqual((int)windBytes, ci.windThrottle, "Wind"); Assert.AreEqual((int)cloudBytes, ci.cloudThrottle, "Cloud"); Assert.AreEqual((int)taskBytes, ci.taskThrottle, "Task"); Assert.AreEqual((int)textureBytes, ci.textureThrottle, "Texture"); Assert.AreEqual((int)assetBytes, ci.assetThrottle, "Asset"); Assert.AreEqual((int)totalBytes, ci.totalThrottle, "Total"); Assert.AreEqual((int)targetBytes, ci.targetThrottle, "Target"); Assert.AreEqual((int)maxBytes, ci.maxThrottle, "Max"); }
/// <summary> /// Show throttle data /// </summary> /// <param name="showParams"></param> /// <returns></returns> protected string GetThrottlesReport(string[] showParams) { bool showChildren = false; string pname = ""; if (showParams.Length > 2 && showParams[2] == "full") { showChildren = true; } else if (showParams.Length > 3) { pname = showParams[2] + " " + showParams[3]; } StringBuilder report = new StringBuilder(); int columnPadding = 2; int maxNameLength = 18; int maxRegionNameLength = 14; int maxTypeLength = 4; int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); report.AppendFormat( "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", "Max", "Target", "Actual", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"); report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); report.AppendFormat( "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s"); report.AppendLine(); lock (m_scenes) { foreach (Scene scene in m_scenes.Values) { scene.ForEachClient( delegate(IClientAPI client) { if (client is LLClientView) { LLClientView llClient = client as LLClientView; bool isChild = client.SceneAgent.IsChildAgent; if (isChild && !showChildren) { return; } string name = client.Name; if (pname != "" && name != pname) { return; } string regionName = scene.RegionInfo.RegionName; LLUDPClient llUdpClient = llClient.UDPClient; ClientInfo ci = llUdpClient.GetClientInfo(); report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); report.AppendFormat( "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", ci.maxThrottle > 0 ? ((ci.maxThrottle * 8) / 1000).ToString() : "-", llUdpClient.FlowThrottle.AdaptiveEnabled ? ((ci.targetThrottle * 8) / 1000).ToString() : (llUdpClient.FlowThrottle.TotalDripRequest * 8 / 1000).ToString(), (ci.totalThrottle * 8) / 1000, (ci.resendThrottle * 8) / 1000, (ci.landThrottle * 8) / 1000, (ci.windThrottle * 8) / 1000, (ci.cloudThrottle * 8) / 1000, (ci.taskThrottle * 8) / 1000, (ci.textureThrottle * 8) / 1000, (ci.assetThrottle * 8) / 1000); } }); } } return(report.ToString()); }
/// <summary> /// Show throttle data /// </summary> /// <param name="showParams"></param> /// <returns></returns> protected string GetThrottlesReport(string[] showParams) { bool showChildren = false; if (showParams.Length > 2 && showParams[2] == "full") { showChildren = true; } StringBuilder report = new StringBuilder(); int columnPadding = 2; int maxNameLength = 18; int maxRegionNameLength = 14; int maxTypeLength = 4; int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", "Total", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"); report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s", "kb/s"); report.AppendLine(); bool firstClient = true; lock (m_scenes) { foreach (Scene scene in m_scenes.Values) { scene.ForEachClient( delegate(IClientAPI client) { if (client is LLClientView) { LLClientView llClient = client as LLClientView; if (firstClient) { report.AppendLine(GetServerThrottlesReport(llClient.UDPServer)); firstClient = false; } bool isChild = scene.PresenceChildStatus(client.AgentId); if (isChild && !showChildren) { return; } string name = client.Name; string regionName = scene.RegionInfo.RegionName; LLUDPClient llUdpClient = llClient.UDPClient; ClientInfo ci = llUdpClient.GetClientInfo(); report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", (ci.totalThrottle * 8) / 1000, (ci.resendThrottle * 8) / 1000, (ci.landThrottle * 8) / 1000, (ci.windThrottle * 8) / 1000, (ci.cloudThrottle * 8) / 1000, (ci.taskThrottle * 8) / 1000, (ci.textureThrottle * 8) / 1000, (ci.assetThrottle * 8) / 1000); report.AppendLine(); } }); } } return(report.ToString()); }
protected void HandleClientKpi(string module, string[] cmd) { s_log.Debug("[CLIENTKPI] Showing Client KPI:"); // Getting Priority Queues Report int columnPadding = 2; int maxNameLength = 18; int maxRegionNameLength = 14; int maxTypeLength = 4; int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; StringBuilder reportline = new StringBuilder(); bool firstClient = true; lock (m_scenes) { foreach (Scene scene in m_scenes.Values) { scene.ForEachClient( delegate(IClientAPI client) { if (client is LLClientView) { bool isChild = client.SceneAgent.IsChildAgent; string name = client.Name; string regionName = scene.RegionInfo.RegionName; reportline.Append("[PQUEUE] "); reportline.AppendFormat("AgentName:{0},RegionName:{1},isChild:{2},", name, regionName, isChild ? "Cd" : "Rt"); reportline.Append(((LLClientView)client).EntityUpdateQueue.ToString()); s_log.Debug(reportline); reportline.Length = 0; reportline.Append("[QUEUE] "); reportline.AppendFormat("AgentName:{0},RegionName:{1},isChild:{2},", name, regionName, isChild ? "Cd" : "Rt"); if (client is IStatsCollector) { IStatsCollector stats = (IStatsCollector)client; reportline.Append(stats.Report()); } s_log.Debug(reportline); reportline.Length = 0; LLClientView llClient = client as LLClientView; if (firstClient) { reportline.Append("[THROTTLE] SERVER_AGENT_RATES:"); ThrottleRates throttleRates = llClient.UDPServer.ThrottleRates; reportline.AppendFormat( "{0},{1},{2},{3},{4},{5},{6},{7}", (throttleRates.Total * 8) / 1000, (throttleRates.Resend * 8) / 1000, (throttleRates.Land * 8) / 1000, (throttleRates.Wind * 8) / 1000, (throttleRates.Cloud * 8) / 1000, (throttleRates.Task * 8) / 1000, (throttleRates.Texture * 8) / 1000, (throttleRates.Asset * 8) / 1000); s_log.Debug(reportline); reportline.Length = 0; firstClient = false; } LLUDPClient llUdpClient = llClient.UDPClient; ClientInfo ci = llUdpClient.GetClientInfo(); reportline.Append("[THROTTLE] "); reportline.AppendFormat("AgentName:{0},RegionName:{1},isChild:{2},", name, regionName, isChild ? "Cd" : "Rt"); reportline.AppendFormat( "{0},{1},{2},{3},{4},{5},{6},{7}", (ci.totalThrottle * 8) / 1000, (ci.resendThrottle * 8) / 1000, (ci.landThrottle * 8) / 1000, (ci.windThrottle * 8) / 1000, (ci.cloudThrottle * 8) / 1000, (ci.taskThrottle * 8) / 1000, (ci.textureThrottle * 8) / 1000, (ci.assetThrottle * 8) / 1000); s_log.Debug(reportline); reportline.Length = 0; } }); } } }