diff options
author | Justin Clarke Casey | 2008-06-10 23:19:38 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-06-10 23:19:38 +0000 |
commit | 686f16cedda4daac1663f30b17e65bde7fc4af2b (patch) | |
tree | 84d007bdf777fe5a7569b32198e3d18347178c1e | |
parent | I'm going to need the Version property to manage (diff) | |
download | opensim-SC-686f16cedda4daac1663f30b17e65bde7fc4af2b.zip opensim-SC-686f16cedda4daac1663f30b17e65bde7fc4af2b.tar.gz opensim-SC-686f16cedda4daac1663f30b17e65bde7fc4af2b.tar.bz2 opensim-SC-686f16cedda4daac1663f30b17e65bde7fc4af2b.tar.xz |
* If a server has statistics, print these out to the log every hour to get some idea of how these evolve
* When returning GC.GetTotalMemory(), force collection first in order to get more accurate figures
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Statistics/BaseStatsCollector.cs | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 0ee21ac..852e1b1 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Timers; | ||
31 | using log4net; | 32 | using log4net; |
32 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Statistics; | 34 | using OpenSim.Framework.Statistics; |
@@ -41,6 +42,12 @@ namespace OpenSim.Framework.Servers | |||
41 | { | 42 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 44 | ||
45 | /// <summary> | ||
46 | /// This will control a periodic log printout of the current 'show stats' (if they are active) for this | ||
47 | /// server. | ||
48 | /// </summary> | ||
49 | private Timer m_periodicLogStatsTimer = new Timer(60 * 60 * 1000); | ||
50 | |||
44 | protected ConsoleBase m_console; | 51 | protected ConsoleBase m_console; |
45 | 52 | ||
46 | /// <summary> | 53 | /// <summary> |
@@ -68,6 +75,20 @@ namespace OpenSim.Framework.Servers | |||
68 | { | 75 | { |
69 | m_startuptime = DateTime.Now; | 76 | m_startuptime = DateTime.Now; |
70 | m_version = VersionInfo.Version; | 77 | m_version = VersionInfo.Version; |
78 | |||
79 | m_periodicLogStatsTimer.Elapsed += new ElapsedEventHandler(LogStats); | ||
80 | m_periodicLogStatsTimer.Enabled = true; | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Print statistics to the logfile, if they are active | ||
85 | /// </summary> | ||
86 | protected void LogStats(object source, ElapsedEventArgs e) | ||
87 | { | ||
88 | if (m_stats != null) | ||
89 | { | ||
90 | m_log.Info(m_stats.Report()); | ||
91 | } | ||
71 | } | 92 | } |
72 | 93 | ||
73 | /// <summary> | 94 | /// <summary> |
diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index c888f4c..225c551 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Statistics | |||
43 | sb.Append( | 43 | sb.Append( |
44 | string.Format( | 44 | string.Format( |
45 | "Allocated to OpenSim : {0} MB" + Environment.NewLine, | 45 | "Allocated to OpenSim : {0} MB" + Environment.NewLine, |
46 | Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); | 46 | Math.Round(GC.GetTotalMemory(true) / 1024.0 / 1024.0))); |
47 | 47 | ||
48 | return sb.ToString(); | 48 | return sb.ToString(); |
49 | } | 49 | } |