aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-07-25 01:56:41 +0100
committerJustin Clark-Casey (justincc)2014-07-25 01:56:41 +0100
commitcc61681484185f3c450fc0ab7efeb093c672d194 (patch)
tree2d93250717a8b4beedbce820bf432d8b1bfd877f
parentAdd missing default female hair texture for Ruth avatar. (diff)
downloadopensim-SC_OLD-cc61681484185f3c450fc0ab7efeb093c672d194.zip
opensim-SC_OLD-cc61681484185f3c450fc0ab7efeb093c672d194.tar.gz
opensim-SC_OLD-cc61681484185f3c450fc0ab7efeb093c672d194.tar.bz2
opensim-SC_OLD-cc61681484185f3c450fc0ab7efeb093c672d194.tar.xz
Revert "Write UDP statistics to the log, not just the console (e.g., "show queues")"
Fixes http://opensimulator.org/mantis/view.php?id=7280 It can't be done this way because the stats data needs to show up on the console at all log levels, not just debug. But this means setting it to log at fatal, which is not appropriate for this stuff in the log. I understand the desire but this has to be done some other way, perhaps by (yet another) config parameter. Also, this was already being done with the ClientStatsReport but that also should be done in another way, I think. This reverts commit 5d534127663899cd5592c865b1d00855fce25854.
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs53
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs69
2 files changed, 63 insertions, 59 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 5c8d934..0bac247 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -30,8 +30,6 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq; 31using System.Linq;
32using System.Text; 32using System.Text;
33using System.Reflection;
34using log4net;
35 33
36using OpenSim.Framework; 34using OpenSim.Framework;
37using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
@@ -43,8 +41,6 @@ namespace OpenSim.Framework.Monitoring
43 /// </summary> 41 /// </summary>
44 public static class StatsManager 42 public static class StatsManager
45 { 43 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 // Subcommand used to list other stats. 44 // Subcommand used to list other stats.
49 public const string AllSubCommand = "all"; 45 public const string AllSubCommand = "all";
50 46
@@ -102,7 +98,6 @@ namespace OpenSim.Framework.Monitoring
102 public static void HandleShowStatsCommand(string module, string[] cmd) 98 public static void HandleShowStatsCommand(string module, string[] cmd)
103 { 99 {
104 ICommandConsole con = MainConsole.Instance; 100 ICommandConsole con = MainConsole.Instance;
105 StringBuilder report = new StringBuilder();
106 101
107 if (cmd.Length > 2) 102 if (cmd.Length > 2)
108 { 103 {
@@ -116,8 +111,7 @@ namespace OpenSim.Framework.Monitoring
116 111
117 if (categoryName == AllSubCommand) 112 if (categoryName == AllSubCommand)
118 { 113 {
119 foreach (string report2 in GetAllStatsReports()) 114 OutputAllStatsToConsole(con);
120 report.AppendLine(report2);
121 } 115 }
122 else if (categoryName == ListSubCommand) 116 else if (categoryName == ListSubCommand)
123 { 117 {
@@ -136,8 +130,7 @@ namespace OpenSim.Framework.Monitoring
136 { 130 {
137 if (String.IsNullOrEmpty(containerName)) 131 if (String.IsNullOrEmpty(containerName))
138 { 132 {
139 foreach (string report2 in GetCategoryStatsReports(category)) 133 OutputCategoryStatsToConsole(con, category);
140 report.AppendLine(report2);
141 } 134 }
142 else 135 else
143 { 136 {
@@ -146,15 +139,14 @@ namespace OpenSim.Framework.Monitoring
146 { 139 {
147 if (String.IsNullOrEmpty(statName)) 140 if (String.IsNullOrEmpty(statName))
148 { 141 {
149 foreach (string report2 in GetContainerStatsReports(container)) 142 OutputContainerStatsToConsole(con, container);
150 report.AppendLine(report2);
151 } 143 }
152 else 144 else
153 { 145 {
154 Stat stat; 146 Stat stat;
155 if (container.TryGetValue(statName, out stat)) 147 if (container.TryGetValue(statName, out stat))
156 { 148 {
157 report.AppendLine(stat.ToConsoleString()); 149 OutputStatToConsole(con, stat);
158 } 150 }
159 else 151 else
160 { 152 {
@@ -176,18 +168,10 @@ namespace OpenSim.Framework.Monitoring
176 { 168 {
177 // Legacy 169 // Legacy
178 if (SimExtraStats != null) 170 if (SimExtraStats != null)
179 { 171 con.Output(SimExtraStats.Report());
180 report.Append(SimExtraStats.Report());
181 }
182 else 172 else
183 { 173 OutputAllStatsToConsole(con);
184 foreach (string report2 in GetAllStatsReports())
185 report.AppendLine(report2);
186 }
187 } 174 }
188
189 if (report.Length > 0)
190 m_log.Debug(string.Join(" ", cmd) + "\n" + report.ToString());
191 } 175 }
192 176
193 public static List<string> GetAllStatsReports() 177 public static List<string> GetAllStatsReports()
@@ -200,6 +184,12 @@ namespace OpenSim.Framework.Monitoring
200 return reports; 184 return reports;
201 } 185 }
202 186
187 private static void OutputAllStatsToConsole(ICommandConsole con)
188 {
189 foreach (string report in GetAllStatsReports())
190 con.Output(report);
191 }
192
203 private static List<string> GetCategoryStatsReports( 193 private static List<string> GetCategoryStatsReports(
204 SortedDictionary<string, SortedDictionary<string, Stat>> category) 194 SortedDictionary<string, SortedDictionary<string, Stat>> category)
205 { 195 {
@@ -211,6 +201,13 @@ namespace OpenSim.Framework.Monitoring
211 return reports; 201 return reports;
212 } 202 }
213 203
204 private static void OutputCategoryStatsToConsole(
205 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category)
206 {
207 foreach (string report in GetCategoryStatsReports(category))
208 con.Output(report);
209 }
210
214 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container) 211 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container)
215 { 212 {
216 List<string> reports = new List<string>(); 213 List<string> reports = new List<string>();
@@ -221,6 +218,18 @@ namespace OpenSim.Framework.Monitoring
221 return reports; 218 return reports;
222 } 219 }
223 220
221 private static void OutputContainerStatsToConsole(
222 ICommandConsole con, SortedDictionary<string, Stat> container)
223 {
224 foreach (string report in GetContainerStatsReports(container))
225 con.Output(report);
226 }
227
228 private static void OutputStatToConsole(ICommandConsole con, Stat stat)
229 {
230 con.Output(stat.ToConsoleString());
231 }
232
224 // Creates an OSDMap of the format: 233 // Creates an OSDMap of the format:
225 // { categoryName: { 234 // { categoryName: {
226 // containerName: { 235 // containerName: {
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 6e8a1bf..2ef3c4c 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -87,8 +87,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
87 "show pqueues [full]", 87 "show pqueues [full]",
88 "Show priority queue data for each client", 88 "Show priority queue data for each client",
89 "Without the 'full' option, only root agents are shown." 89 "Without the 'full' option, only root agents are shown."
90 + " With the 'full' option child agents are also shown.", 90 + " With the 'full' option child agents are also shown.",
91 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + GetPQueuesReport(cmd))); 91 (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd)));
92 92
93 scene.AddCommand( 93 scene.AddCommand(
94 "Comms", this, "show queues", 94 "Comms", this, "show queues",
@@ -103,27 +103,27 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
103 + "Pkts Resent - Number of packets resent to the client.\n" 103 + "Pkts Resent - Number of packets resent to the client.\n"
104 + "Bytes Unacked - Number of bytes transferred to the client that are awaiting acknowledgement.\n" 104 + "Bytes Unacked - Number of bytes transferred to the client that are awaiting acknowledgement.\n"
105 + "Q Pkts * - Number of packets of various types (land, wind, etc.) to be sent to the client that are waiting for available bandwidth.\n", 105 + "Q Pkts * - Number of packets of various types (land, wind, etc.) to be sent to the client that are waiting for available bandwidth.\n",
106 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + GetQueuesReport(cmd))); 106 (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd)));
107 107
108 scene.AddCommand( 108 scene.AddCommand(
109 "Comms", this, "show image queues", 109 "Comms", this, "show image queues",
110 "show image queues <first-name> <last-name>", 110 "show image queues <first-name> <last-name>",
111 "Show the image queues (textures downloaded via UDP) for a particular client.", 111 "Show the image queues (textures downloaded via UDP) for a particular client.",
112 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + GetImageQueuesReport(cmd))); 112 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
113 113
114 scene.AddCommand( 114 scene.AddCommand(
115 "Comms", this, "clear image queues", 115 "Comms", this, "clear image queues",
116 "clear image queues <first-name> <last-name>", 116 "clear image queues <first-name> <last-name>",
117 "Clear the image queues (textures downloaded via UDP) for a particular client.", 117 "Clear the image queues (textures downloaded via UDP) for a particular client.",
118 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + HandleImageQueuesClear(cmd))); 118 (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
119 119
120 scene.AddCommand( 120 scene.AddCommand(
121 "Comms", this, "show throttles", 121 "Comms", this, "show throttles",
122 "show throttles [full]", 122 "show throttles [full]",
123 "Show throttle settings for each client and for the server overall", 123 "Show throttle settings for each client and for the server overall",
124 "Without the 'full' option, only root agents are shown." 124 "Without the 'full' option, only root agents are shown."
125 + " With the 'full' option child agents are also shown.", 125 + " With the 'full' option child agents are also shown.",
126 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + GetThrottlesReport(cmd))); 126 (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
127 127
128 scene.AddCommand( 128 scene.AddCommand(
129 "Comms", this, "emergency-monitoring", 129 "Comms", this, "emergency-monitoring",
@@ -138,7 +138,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
138 "Show client request stats", 138 "Show client request stats",
139 "Without the 'first_name last_name' option, all clients are shown." 139 "Without the 'first_name last_name' option, all clients are shown."
140 + " With the 'first_name last_name' option only a specific client is shown.", 140 + " With the 'first_name last_name' option only a specific client is shown.",
141 (mod, cmd) => m_log.Debug(string.Join(" ", cmd) + "\n" + HandleClientStatsReport(cmd))); 141 (mod, cmd) => MainConsole.Instance.Output(HandleClientStatsReport(cmd)));
142 142
143 } 143 }
144 144
@@ -279,7 +279,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
279 return; 279 return;
280 280
281 string name = client.Name; 281 string name = client.Name;
282 if (pname != "" && name.ToLower() != pname.ToLower()) 282 if (pname != "" && name != pname)
283 return; 283 return;
284 284
285 string regionName = scene.RegionInfo.RegionName; 285 string regionName = scene.RegionInfo.RegionName;
@@ -440,7 +440,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
440 return; 440 return;
441 441
442 string name = client.Name; 442 string name = client.Name;
443 if (pname != "" && name.ToLower() != pname.ToLower()) 443 if (pname != "" && name != pname)
444 return; 444 return;
445 445
446 string regionName = scene.RegionInfo.RegionName; 446 string regionName = scene.RegionInfo.RegionName;
@@ -537,7 +537,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
537 return; 537 return;
538 538
539 string name = client.Name; 539 string name = client.Name;
540 if (pname != "" && name.ToLower() != pname.ToLower()) 540 if (pname != "" && name != pname)
541 return; 541 return;
542 542
543 string regionName = scene.RegionInfo.RegionName; 543 string regionName = scene.RegionInfo.RegionName;
@@ -608,12 +608,12 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
608 /// <returns></returns> 608 /// <returns></returns>
609 protected string HandleClientStatsReport(string[] showParams) 609 protected string HandleClientStatsReport(string[] showParams)
610 { 610 {
611 StringBuilder report = new StringBuilder(); 611 // NOTE: This writes to m_log on purpose. We want to store this information
612 612 // in case we need to analyze it later.
613 //
613 if (showParams.Length <= 4) 614 if (showParams.Length <= 4)
614 { 615 {
615 report.AppendFormat("{0,-30} {1,-30} {2,-6} {3,-11} {4,-11} {5,-16}\n", "Region", "Name", "Root", "Time", "Reqs/min", "AgentUpdates"); 616 m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", "Region", "Name", "Root", "Time", "Reqs/min", "AgentUpdates");
616
617 foreach (Scene scene in m_scenes.Values) 617 foreach (Scene scene in m_scenes.Values)
618 { 618 {
619 scene.ForEachClient( 619 scene.ForEachClient(
@@ -633,10 +633,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
633 else 633 else
634 childAgentStatus = "Off!"; 634 childAgentStatus = "Off!";
635 635
636 int agentUpdates = 0; 636 m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}",
637 cinfo.SyncRequests.TryGetValue("AgentUpdate", out agentUpdates);
638
639 report.AppendFormat("{0,-30} {1,-30} {2,-6} {3,-11} {4,-11} {5,-16}\n",
640 scene.RegionInfo.RegionName, llClient.Name, 637 scene.RegionInfo.RegionName, llClient.Name,
641 childAgentStatus, 638 childAgentStatus,
642 (DateTime.Now - cinfo.StartedTime).Minutes, 639 (DateTime.Now - cinfo.StartedTime).Minutes,
@@ -644,12 +641,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
644 string.Format( 641 string.Format(
645 "{0} ({1:0.00}%)", 642 "{0} ({1:0.00}%)",
646 llClient.TotalAgentUpdates, 643 llClient.TotalAgentUpdates,
647 ((float)agentUpdates) / llClient.TotalAgentUpdates * 100)); 644 (float)cinfo.SyncRequests["AgentUpdate"] / llClient.TotalAgentUpdates * 100));
648 } 645 }
649 }); 646 });
650 } 647 }
651 648 return string.Empty;
652 return report.ToString();
653 } 649 }
654 650
655 string fname = "", lname = ""; 651 string fname = "", lname = "";
@@ -668,7 +664,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
668 { 664 {
669 LLClientView llClient = client as LLClientView; 665 LLClientView llClient = client as LLClientView;
670 666
671 if (llClient.Name.ToLower() == (fname + " " + lname).ToLower()) 667 if (llClient.Name == fname + " " + lname)
672 { 668 {
673 669
674 ClientInfo cinfo = llClient.GetClientInfo(); 670 ClientInfo cinfo = llClient.GetClientInfo();
@@ -677,42 +673,41 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
677 aCircuit = new AgentCircuitData(); 673 aCircuit = new AgentCircuitData();
678 674
679 if (!llClient.SceneAgent.IsChildAgent) 675 if (!llClient.SceneAgent.IsChildAgent)
680 report.AppendFormat("{0} # {1} # {2}\n", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0); 676 m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0);
681 677
682 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); 678 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum();
683 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); 679 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1);
684 680
685 report.AppendLine(); 681 m_log.InfoFormat("[INFO]:");
686 report.AppendFormat("{0} # {1} # Time: {2}min # Avg Reqs/min: {3}\n", scene.RegionInfo.RegionName, 682 m_log.InfoFormat("[INFO]: {0} # {1} # Time: {2}min # Avg Reqs/min: {3}", scene.RegionInfo.RegionName,
687 (llClient.SceneAgent.IsChildAgent ? "Child" : "Root"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs); 683 (llClient.SceneAgent.IsChildAgent ? "Child" : "Root"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs);
688 684
689 Dictionary<string, int> sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry) 685 Dictionary<string, int> sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry)
690 .ToDictionary(pair => pair.Key, pair => pair.Value); 686 .ToDictionary(pair => pair.Key, pair => pair.Value);
691 PrintRequests(report, "TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum()); 687 PrintRequests("TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum());
692 688
693 sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry) 689 sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry)
694 .ToDictionary(pair => pair.Key, pair => pair.Value); 690 .ToDictionary(pair => pair.Key, pair => pair.Value);
695 PrintRequests(report, "TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum()); 691 PrintRequests("TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum());
696 692
697 sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry) 693 sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry)
698 .ToDictionary(pair => pair.Key, pair => pair.Value); 694 .ToDictionary(pair => pair.Key, pair => pair.Value);
699 PrintRequests(report, "TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum()); 695 PrintRequests("TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum());
700 } 696 }
701 } 697 }
702 }); 698 });
703 } 699 }
704 700 return string.Empty;
705 return report.ToString();
706 } 701 }
707 702
708 private void PrintRequests(StringBuilder report, string type, Dictionary<string, int> sortedDict, int sum) 703 private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum)
709 { 704 {
710 report.AppendLine(); 705 m_log.InfoFormat("[INFO]:");
711 report.AppendFormat("{0,25}\n", type); 706 m_log.InfoFormat("[INFO]: {0,25}", type);
712 foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12)) 707 foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12))
713 report.AppendFormat("{0,25} {1,-6}\n", kvp.Key, kvp.Value); 708 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value);
714 report.AppendFormat("{0,25}\n", "..."); 709 m_log.InfoFormat("[INFO]: {0,25}", "...");
715 report.AppendFormat("{0,25} {1,-6}\n", "Total", sum); 710 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum);
716 } 711 }
717 } 712 }
718} 713}