diff options
Diffstat (limited to 'OpenSim/Framework/Monitoring/MemoryWatchdog.cs')
-rw-r--r-- | OpenSim/Framework/Monitoring/MemoryWatchdog.cs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs index c474622..f2e47f8 100644 --- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs +++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs | |||
@@ -110,20 +110,17 @@ namespace OpenSim.Framework.Monitoring | |||
110 | long memoryNow = GC.GetTotalMemory(false); | 110 | long memoryNow = GC.GetTotalMemory(false); |
111 | long memoryDiff = memoryNow - m_lastUpdateMemory; | 111 | long memoryDiff = memoryNow - m_lastUpdateMemory; |
112 | 112 | ||
113 | if (memoryDiff >= 0) | 113 | if (m_samples.Count >= m_maxSamples) |
114 | { | ||
115 | if (m_samples.Count >= m_maxSamples) | ||
116 | m_samples.Dequeue(); | 114 | m_samples.Dequeue(); |
117 | 115 | ||
118 | double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick); | 116 | double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick); |
119 | 117 | ||
120 | // This should never happen since it's not useful for updates to occur with no time elapsed, but | 118 | // This should never happen since it's not useful for updates to occur with no time elapsed, but |
121 | // protect ourselves from a divide-by-zero just in case. | 119 | // protect ourselves from a divide-by-zero just in case. |
122 | if (elapsed == 0) | 120 | if (elapsed == 0) |
123 | return; | 121 | return; |
124 | 122 | ||
125 | m_samples.Enqueue(memoryDiff / (double)elapsed); | 123 | m_samples.Enqueue(memoryDiff / (double)elapsed); |
126 | } | ||
127 | 124 | ||
128 | UpdateLastRecord(memoryNow, now); | 125 | UpdateLastRecord(memoryNow, now); |
129 | } | 126 | } |