show client stats: Fixed the requests/min. Also changed the spelling of the command, not without the dash.

cpu-performance
Diva Canto 2013-07-10 17:14:20 -07:00
parent 864a86983e
commit bdaeb02863
1 changed files with 22 additions and 21 deletions

View File

@ -133,8 +133,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
HandleEmergencyMonitoring);
scene.AddCommand(
"Comms", this, "show client-stats",
"show client-stats [first_name last_name]",
"Comms", this, "show client stats",
"show client stats [first_name last_name]",
"Show client request stats",
"Without the 'first_name last_name' option, all clients are shown."
+ " With the 'first_name last_name' option only a specific client is shown.",
@ -609,7 +609,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
// NOTE: This writes to m_log on purpose. We want to store this information
// in case we need to analyze it later.
//
if (showParams.Length <= 3)
if (showParams.Length <= 4)
{
m_log.InfoFormat("[INFO]: {0,-12} {1,20} {2,6} {3,11} {4, 10}", "Region", "Name", "Root", "Time", "Reqs/min");
foreach (Scene scene in m_scenes.Values)
@ -621,7 +621,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
{
LLClientView llClient = client as LLClientView;
ClientInfo cinfo = llClient.UDPClient.GetClientInfo();
int avg_reqs = cinfo.AsyncRequests.Count + cinfo.GenericRequests.Count + cinfo.SyncRequests.Count;
int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum();
avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1);
m_log.InfoFormat("[INFO]: {0,-12} {1,20} {2,4} {3,9}min {4,10}",
@ -635,10 +635,10 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
string fname = "", lname = "";
if (showParams.Length > 2)
fname = showParams[2];
if (showParams.Length > 3)
lname = showParams[3];
fname = showParams[3];
if (showParams.Length > 4)
lname = showParams[4];
foreach (Scene scene in m_scenes.Values)
{
@ -660,7 +660,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
if (!llClient.SceneAgent.IsChildAgent)
m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, aCircuit.Viewer, aCircuit.Id0);
int avg_reqs = cinfo.AsyncRequests.Count + cinfo.GenericRequests.Count + cinfo.SyncRequests.Count;
int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum();
avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1);
m_log.InfoFormat("[INFO]:");
@ -669,29 +669,30 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
Dictionary<string, int> sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry)
.ToDictionary(pair => pair.Key, pair => pair.Value);
PrintRequests("TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum());
m_log.InfoFormat("[INFO]: {0,25}", "TOP ASYNC");
foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12))
m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value);
m_log.InfoFormat("[INFO]:");
sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry)
.ToDictionary(pair => pair.Key, pair => pair.Value);
m_log.InfoFormat("[INFO]: {0,25}", "TOP SYNC");
foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12))
m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value);
PrintRequests("TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum());
m_log.InfoFormat("[INFO]:");
sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry)
.ToDictionary(pair => pair.Key, pair => pair.Value);
m_log.InfoFormat("[INFO]: {0,25}", "TOP GENERIC");
foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12))
m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value);
PrintRequests("TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum());
}
}
});
}
return string.Empty;
}
}
private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum)
{
m_log.InfoFormat("[INFO]:");
m_log.InfoFormat("[INFO]: {0,25}", type);
foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12))
m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value);
m_log.InfoFormat("[INFO]: {0,25}", "...");
m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum);
}
}
}