aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-10-30 18:57:51 +0000
committerJustin Clark-Casey (justincc)2013-10-30 18:57:51 +0000
commitfdd1c63c3c1333c8ec833a669de76e07d2ff0159 (patch)
tree1576e63af7a013a69f935193845ee3049791fae0
parentPut fcache commands output to console, not log (diff)
downloadopensim-SC_OLD-fdd1c63c3c1333c8ec833a669de76e07d2ff0159.zip
opensim-SC_OLD-fdd1c63c3c1333c8ec833a669de76e07d2ff0159.tar.gz
opensim-SC_OLD-fdd1c63c3c1333c8ec833a669de76e07d2ff0159.tar.bz2
opensim-SC_OLD-fdd1c63c3c1333c8ec833a669de76e07d2ff0159.tar.xz
Make "fcache status" command also display information on disk/mem cache hit rate that is currently only displayed if LogLevel >=1 in [AssetCache] config
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs56
1 files changed, 38 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 103228f..08d4fc0 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -31,6 +31,7 @@
31using System; 31using System;
32using System.IO; 32using System.IO;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using System.Linq;
34using System.Reflection; 35using System.Reflection;
35using System.Runtime.Serialization; 36using System.Runtime.Serialization;
36using System.Runtime.Serialization.Formatters.Binary; 37using System.Runtime.Serialization.Formatters.Binary;
@@ -74,8 +75,6 @@ namespace OpenSim.Region.CoreModules.Asset
74 private static ulong m_RequestsForInprogress; 75 private static ulong m_RequestsForInprogress;
75 private static ulong m_DiskHits; 76 private static ulong m_DiskHits;
76 private static ulong m_MemoryHits; 77 private static ulong m_MemoryHits;
77 private static double m_HitRateMemory;
78 private static double m_HitRateFile;
79 78
80#if WAIT_ON_INPROGRESS_REQUESTS 79#if WAIT_ON_INPROGRESS_REQUESTS
81 private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); 80 private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>();
@@ -427,18 +426,9 @@ namespace OpenSim.Region.CoreModules.Asset
427 426
428 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) 427 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
429 { 428 {
430 m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
431
432 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit"); 429 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit");
433 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests);
434
435 if (m_MemoryCacheEnabled)
436 {
437 m_HitRateMemory = (double)m_MemoryHits / m_Requests * 100.0;
438 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests);
439 }
440 430
441 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress); 431 GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
442 } 432 }
443 433
444 return asset; 434 return asset;
@@ -805,6 +795,30 @@ namespace OpenSim.Region.CoreModules.Asset
805 } 795 }
806 } 796 }
807 797
798 private List<string> GenerateCacheHitReport()
799 {
800 List<string> outputLines = new List<string>();
801
802 double fileHitRate = (double)m_DiskHits / m_Requests * 100.0;
803 outputLines.Add(
804 string.Format("File Hit Rate: {0}% for {1} requests", fileHitRate.ToString("0.00"), m_Requests));
805
806 if (m_MemoryCacheEnabled)
807 {
808 double memHitRate = (double)m_MemoryHits / m_Requests * 100.0;
809
810 outputLines.Add(
811 string.Format("Memory Hit Rate: {0}% for {1} requests", memHitRate.ToString("0.00"), m_Requests));
812 }
813
814 outputLines.Add(
815 string.Format(
816 "Unnecessary requests due to requests for assets that are currently downloading: {0}",
817 m_RequestsForInprogress));
818
819 return outputLines;
820 }
821
808 #region Console Commands 822 #region Console Commands
809 private void HandleConsoleCommand(string module, string[] cmdparams) 823 private void HandleConsoleCommand(string module, string[] cmdparams)
810 { 824 {
@@ -818,14 +832,24 @@ namespace OpenSim.Region.CoreModules.Asset
818 { 832 {
819 case "status": 833 case "status":
820 if (m_MemoryCacheEnabled) 834 if (m_MemoryCacheEnabled)
821 con.OutputFormat("Memory Cache : {0} assets", m_MemoryCache.Count); 835 con.OutputFormat("Memory Cache: {0} assets", m_MemoryCache.Count);
822 else 836 else
823 con.OutputFormat("Memory cache disabled"); 837 con.OutputFormat("Memory cache disabled");
824 838
825 if (m_FileCacheEnabled) 839 if (m_FileCacheEnabled)
826 { 840 {
827 int fileCount = GetFileCacheCount(m_CacheDirectory); 841 int fileCount = GetFileCacheCount(m_CacheDirectory);
828 con.OutputFormat("File Cache : {0} assets", fileCount); 842 con.OutputFormat("File Cache: {0} assets", fileCount);
843 }
844 else
845 {
846 con.Output("File cache disabled");
847 }
848
849 GenerateCacheHitReport().ForEach(l => con.Output(l));
850
851 if (m_FileCacheEnabled)
852 {
829 con.Output("Deep scans have previously been performed on the following regions:"); 853 con.Output("Deep scans have previously been performed on the following regions:");
830 854
831 foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac")) 855 foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac"))
@@ -835,10 +859,6 @@ namespace OpenSim.Region.CoreModules.Asset
835 con.OutputFormat("Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss")); 859 con.OutputFormat("Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss"));
836 } 860 }
837 } 861 }
838 else
839 {
840 con.Output("File cache disabled");
841 }
842 862
843 break; 863 break;
844 864