From fed566b8d3bb480ec89615e011934c10023a4dad Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 18 Feb 2015 01:14:08 +0100 Subject: Abbreviate the stats by removing unneeded and redundant elements. Human readability is overrated. Also add a (hardcoded) password. --- .../Framework/Monitoring/ServerStatsCollector.cs | 43 ++++++++++++++++++++++ OpenSim/Framework/Monitoring/Stats/Stat.cs | 13 ++++++- OpenSim/Framework/Monitoring/StatsManager.cs | 15 +++++++- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs index ac0f0bc..e6c73d3 100644 --- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs @@ -246,6 +246,49 @@ namespace OpenSim.Framework.Monitoring (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory, (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); + + MakeStat("ProcessResident", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0); + }); + MakeStat("ProcessPaged", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("ProcessVirtual", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessResident", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessPaged", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessVirtual", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0); + }); } // Notes on performance counters: diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index e095801..bd757d0 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -238,6 +238,17 @@ namespace OpenSim.Framework.Monitoring return sb.ToString(); } + public virtual OSDMap ToBriefOSDMap() + { + OSDMap ret = new OSDMap(); + + ret.Add("Value", OSD.FromReal(Value)); + + double lastChangeOverTime, averageChangeOverTime; + + return ret; + } + public virtual OSDMap ToOSDMap() { OSDMap ret = new OSDMap(); @@ -322,4 +333,4 @@ namespace OpenSim.Framework.Monitoring } } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 05ee4c5..249cef6 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -253,7 +253,7 @@ namespace OpenSim.Framework.Monitoring if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName)) continue; - statMap.Add(statName, theStats[statName].ToOSDMap()); + statMap.Add(statName, theStats[statName].ToBriefOSDMap()); } contMap.Add(contName, statMap); @@ -275,6 +275,17 @@ namespace OpenSim.Framework.Monitoring string pContainerName = StatsManager.AllSubCommand; string pStatName = StatsManager.AllSubCommand; + if (!request.ContainsKey("pass") || request["pass"].ToString() != "l0st4nge1s") + { + responsedata["int_response_code"] = response_code; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Access denied"; + responsedata["access_control_allow_origin"] = "*"; + + return responsedata; + } + if (request.ContainsKey("cat")) pCategoryName = request["cat"].ToString(); if (request.ContainsKey("cont")) pContainerName = request["cat"].ToString(); if (request.ContainsKey("stat")) pStatName = request["cat"].ToString(); @@ -524,4 +535,4 @@ namespace OpenSim.Framework.Monitoring Debug, Info } -} \ No newline at end of file +} -- cgit v1.1