From a4bf98f4ba6ecc27d1af0092b6e2a1bac36ed44d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 31 Jan 2008 00:42:31 +0000 Subject: * Add asset/texture cache statistics to region server console * You can type 'stats' at the REGION# prompt to get this information in grid or standalone mode * Don't take these numbers as gospel yet, since for some reason textures displayed from inventory which require downloading from the server are being recorded as assets rather than textures * But I don't have any reason to believe they aren't broadly accurate. * I've put these in so I can tell whether the high memory usage on regions is down to the asset/texture cache * This will require a prebuild * DEV: Only adds needed to be implemented since, as far as I can tell, assets cached are currently never released. For my part, seeing large cache memory numbers will provoke me to think about doing something about this. * DEV: Now switched to using a singleton to get the stats reporters rather than threading the object through various layers * DEV: Will refactor the other server stats reporters to do this in one of the next commits --- .../Framework/Communications/Cache/AssetCache.cs | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache') diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 6d9a0d6..84c549b 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -31,7 +31,9 @@ using System.Collections.Generic; using System.Threading; using libsecondlife; using libsecondlife.Packets; + using OpenSim.Framework.Console; +using OpenSim.Framework.Statistics; namespace OpenSim.Framework.Communications.Cache { @@ -220,9 +222,13 @@ namespace OpenSim.Framework.Communications.Cache result = "Duplicate ignored."; } else - { - TextureImage textur = new TextureImage(asset); + { + TextureImage textur = new TextureImage(asset); Textures.Add(textur.FullID, textur); + + if (StatsManager.SimExtraStats != null) + StatsManager.SimExtraStats.AddTexture(textur); + if (asset.Temporary) { result = "Added to cache"; @@ -244,6 +250,10 @@ namespace OpenSim.Framework.Communications.Cache { AssetInfo assetInf = new AssetInfo(asset); Assets.Add(assetInf.FullID, assetInf); + + if (StatsManager.SimExtraStats != null) + StatsManager.SimExtraStats.AddAsset(assetInf); + if (asset.Temporary) { result = "Added to cache"; @@ -292,8 +302,12 @@ namespace OpenSim.Framework.Communications.Cache TextureImage image = new TextureImage(asset); if (!Textures.ContainsKey(image.FullID)) - { + { Textures.Add(image.FullID, image); + + if (StatsManager.SimExtraStats != null) + StatsManager.SimExtraStats.AddTexture(image); + if (RequestedTextures.ContainsKey(image.FullID)) { AssetRequest req = RequestedTextures[image.FullID]; @@ -312,6 +326,10 @@ namespace OpenSim.Framework.Communications.Cache if (!Assets.ContainsKey(assetInf.FullID)) { Assets.Add(assetInf.FullID, assetInf); + + if (StatsManager.SimExtraStats != null) + StatsManager.SimExtraStats.AddAsset(assetInf); + if (RequestedAssets.ContainsKey(assetInf.FullID)) { AssetRequest req = RequestedAssets[assetInf.FullID]; -- cgit v1.1