From 3794f25ebd4dae48c4eabfa3d63a4d4c30a5aa30 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 10 Jun 2008 23:35:04 +0000
Subject: * minor: Properly clear the pushed asset cache statistics where the
clear-assets command is used on the region console * stop waiting for garbage
collection when GC total memory used is requested, in case the periodic
request of this lags the sim
---
OpenSim/Framework/Communications/Cache/AssetCache.cs | 4 ++++
OpenSim/Framework/Statistics/BaseStatsCollector.cs | 2 +-
OpenSim/Framework/Statistics/SimExtraStatsCollector.cs | 16 ++++++++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index dcb7d73..dd9015b 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -143,6 +143,10 @@ namespace OpenSim.Framework.Communications.Cache
public void Clear()
{
m_log.Info("[ASSET CACHE]: Clearing Asset cache");
+
+ if (StatsManager.SimExtraStats != null)
+ StatsManager.SimExtraStats.ClearAssetCacheStatistics();
+
Initialize();
}
diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
index 225c551..c888f4c 100644
--- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Statistics
sb.Append(
string.Format(
"Allocated to OpenSim : {0} MB" + Environment.NewLine,
- Math.Round(GC.GetTotalMemory(true) / 1024.0 / 1024.0)));
+ Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
return sb.ToString();
}
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
index 7a74e72..0a20f33 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
@@ -53,6 +53,11 @@ namespace OpenSim.Framework.Statistics
///
public long AbnormalClientThreadTerminations { get { return abnormalClientThreadTerminations; } }
+ ///
+ /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
+ /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
+ /// haven't yet been implemented... :)
+ ///
public long AssetsInCache { get { return assetsInCache; } }
public long TexturesInCache { get { return texturesInCache; } }
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
@@ -100,6 +105,17 @@ namespace OpenSim.Framework.Statistics
textureCacheMemoryUsage += image.Data.Length;
}
}
+
+ ///
+ /// Signal that the asset cache can be cleared.
+ ///
+ public void ClearAssetCacheStatistics()
+ {
+ assetsInCache = 0;
+ assetCacheMemoryUsage = 0;
+ texturesInCache = 0;
+ textureCacheMemoryUsage = 0;
+ }
public void AddBlockedMissingTextureRequest()
{
--
cgit v1.1