From 65c5efe43b68700bad94076d4cd421160203c5de Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Fri, 16 May 2008 01:22:11 +0000 Subject: Formatting cleanup. --- .../Framework/Statistics/AssetStatsCollector.cs | 28 +++++----- .../Statistics/Interfaces/IStatsCollector.cs | 4 +- .../Framework/Statistics/SimExtraStatsCollector.cs | 62 +++++++++++----------- OpenSim/Framework/Statistics/StatsManager.cs | 28 +++++----- OpenSim/Framework/Statistics/UserStatsCollector.cs | 24 ++++----- 5 files changed, 73 insertions(+), 73 deletions(-) (limited to 'OpenSim/Framework/Statistics') diff --git a/OpenSim/Framework/Statistics/AssetStatsCollector.cs b/OpenSim/Framework/Statistics/AssetStatsCollector.cs index bd36c3f..ed6779d 100644 --- a/OpenSim/Framework/Statistics/AssetStatsCollector.cs +++ b/OpenSim/Framework/Statistics/AssetStatsCollector.cs @@ -37,35 +37,35 @@ namespace OpenSim.Framework.Statistics { private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); private DateTime startTime = DateTime.Now; - - private long assetRequestsToday; + + private long assetRequestsToday; private long assetRequestsNotFoundToday; private long assetRequestsYesterday; private long assetRequestsNotFoundYesterday; - + public long AssetRequestsToday { get { return assetRequestsToday; } } - public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } } + public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } } public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } - public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } } - + public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } } + public AssetStatsCollector() { ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); ageStatsTimer.Enabled = true; } - + private void OnAgeing(object source, ElapsedEventArgs e) { assetRequestsYesterday = assetRequestsToday; - + // There is a possibility that an asset request could occur between the execution of these // two statements. But we're better off without the synchronization overhead. - assetRequestsToday = 0; - + assetRequestsToday = 0; + assetRequestsNotFoundYesterday = assetRequestsNotFoundToday; assetRequestsNotFoundToday = 0; } - + /// /// Record that an asset request failed to find an asset /// @@ -73,7 +73,7 @@ namespace OpenSim.Framework.Statistics { assetRequestsNotFoundToday++; } - + /// /// Record that a request was made to the asset server /// @@ -90,10 +90,10 @@ namespace OpenSim.Framework.Statistics { double elapsedHours = (DateTime.Now - startTime).TotalHours; if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero - + long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours); long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0); - + return string.Format( @"Asset requests today : {0} ({1} per hour) of which {2} were not found Asset requests yesterday : {3} ({4} per hour) of which {5} were not found", diff --git a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs index 768cd22..e468fb2 100644 --- a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs +++ b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs @@ -26,7 +26,7 @@ */ namespace OpenSim.Framework.Statistics -{ +{ /// /// Implemented by classes which collect up non-viewer statistical information /// @@ -36,6 +36,6 @@ namespace OpenSim.Framework.Statistics /// Report back collected statistical information. /// /// - string Report(); + string Report(); } } diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs index fd021bc..2e7278b 100644 --- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs @@ -32,20 +32,20 @@ using libsecondlife; using OpenSim.Framework.Statistics.Interfaces; namespace OpenSim.Framework.Statistics -{ +{ /// /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane /// public class SimExtraStatsCollector : IStatsCollector - { + { private long assetsInCache; - private long texturesInCache; + private long texturesInCache; private long assetCacheMemoryUsage; private long textureCacheMemoryUsage; private long blockedMissingTextureRequests; - + private long inventoryServiceRetrievalFailures; - + public long AssetsInCache { get { return assetsInCache; } } public long TexturesInCache { get { return texturesInCache; } } public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } } @@ -58,47 +58,47 @@ namespace OpenSim.Framework.Statistics /// driver bugs on clients (though this seems less likely). /// public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } } - + /// /// Number of known failures to retrieve avatar inventory from the inventory service. This does not /// cover situations where the inventory service accepts the request but never returns any data, since /// we do not yet timeout this situation. /// public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } - + /// /// Retain a dictionary of all packet queues stats reporters /// private IDictionary packetQueueStatsCollectors = new Dictionary(); - + public void AddAsset(AssetBase asset) { assetsInCache++; assetCacheMemoryUsage += asset.Data.Length; } - + public void AddTexture(AssetBase image) { if (image.Data != null) { texturesInCache++; - + // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates textureCacheMemoryUsage += image.Data.Length; } - } - + } + public void AddBlockedMissingTextureRequest() { blockedMissingTextureRequests++; } - + public void AddInventoryServiceRetrievalFailure() { inventoryServiceRetrievalFailures++; } - + /// /// Register as a packet queue stats provider /// @@ -111,7 +111,7 @@ namespace OpenSim.Framework.Statistics packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider); } } - + /// /// Deregister a packet queue stats provider /// @@ -129,25 +129,25 @@ namespace OpenSim.Framework.Statistics /// /// public string Report() - { + { StringBuilder sb = new StringBuilder(Environment.NewLine); sb.Append("ASSET STATISTICS"); - sb.Append(Environment.NewLine); + sb.Append(Environment.NewLine); sb.Append( string.Format( @"Asset cache contains {0,6} assets using {1,10:0.000}K" + Environment.NewLine, AssetsInCache, AssetCacheMemoryUsage / 1024.0)); - + sb.Append(Environment.NewLine); sb.Append("TEXTURE STATISTICS"); - sb.Append(Environment.NewLine); + sb.Append(Environment.NewLine); sb.Append( string.Format( @"Texture cache contains {0,6} textures using {1,10:0.000}K Blocked requests for missing textures: {2}" + Environment.NewLine, TexturesInCache, TextureCacheMemoryUsage / 1024.0, - BlockedMissingTextureRequests)); - + BlockedMissingTextureRequests)); + sb.Append(Environment.NewLine); sb.Append("INVENTORY STATISTICS"); sb.Append(Environment.NewLine); @@ -155,26 +155,26 @@ Blocked requests for missing textures: {2}" + Environment.NewLine, string.Format( "Initial inventory caching failures: {0}" + Environment.NewLine, InventoryServiceRetrievalFailures)); - + sb.Append(Environment.NewLine); sb.Append("PACKET QUEUE STATISTICS"); sb.Append(Environment.NewLine); sb.Append("Agent UUID "); sb.Append( string.Format( - " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", + " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset")); - sb.Append(Environment.NewLine); - + sb.Append(Environment.NewLine); + foreach (LLUUID key in packetQueueStatsCollectors.Keys) { sb.Append(string.Format("{0}: ", key)); sb.Append(packetQueueStatsCollectors[key].Report()); sb.Append(Environment.NewLine); } - + return sb.ToString(); - } + } } /// @@ -183,16 +183,16 @@ Blocked requests for missing textures: {2}" + Environment.NewLine, public class PacketQueueStatsCollector : IStatsCollector { private IPullStatsProvider m_statsProvider; - + public PacketQueueStatsCollector(IPullStatsProvider provider) { - m_statsProvider = provider; + m_statsProvider = provider; } - + /// /// Report back collected statistical information. /// - /// + /// public string Report() { return m_statsProvider.GetStats(); diff --git a/OpenSim/Framework/Statistics/StatsManager.cs b/OpenSim/Framework/Statistics/StatsManager.cs index 3c97dde..41de3f3 100644 --- a/OpenSim/Framework/Statistics/StatsManager.cs +++ b/OpenSim/Framework/Statistics/StatsManager.cs @@ -26,7 +26,7 @@ */ namespace OpenSim.Framework.Statistics -{ +{ /// /// Singleton used to provide access to statistics reporters /// @@ -34,44 +34,44 @@ namespace OpenSim.Framework.Statistics { private static AssetStatsCollector assetStats; private static UserStatsCollector userStats; - private static SimExtraStatsCollector simExtraStats; - + private static SimExtraStatsCollector simExtraStats; + public static AssetStatsCollector AssetStats { get { return assetStats; } } public static UserStatsCollector UserStats { get { return userStats; } } public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } - + private StatsManager() {} - + /// /// Start collecting statistics related to assets. /// Should only be called once. - /// + /// public static AssetStatsCollector StartCollectingAssetStats() { assetStats = new AssetStatsCollector(); - + return assetStats; } - + /// /// Start collecting statistics related to users. /// Should only be called once. - /// + /// public static UserStatsCollector StartCollectingUserStats() { userStats = new UserStatsCollector(); - + return userStats; - } - + } + /// - /// Start collecting extra sim statistics apart from those collected for the client. + /// Start collecting extra sim statistics apart from those collected for the client. /// Should only be called once. /// public static SimExtraStatsCollector StartCollectingSimExtraStats() { simExtraStats = new SimExtraStatsCollector(); - + return simExtraStats; } } diff --git a/OpenSim/Framework/Statistics/UserStatsCollector.cs b/OpenSim/Framework/Statistics/UserStatsCollector.cs index f0f0417..c7fe7c2 100644 --- a/OpenSim/Framework/Statistics/UserStatsCollector.cs +++ b/OpenSim/Framework/Statistics/UserStatsCollector.cs @@ -35,43 +35,43 @@ namespace OpenSim.Framework.Statistics public class UserStatsCollector : IStatsCollector { private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); - + private int successfulLoginsToday; public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } - + private int successfulLoginsYesterday; - public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } - + public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } + private int successfulLogins; public int SuccessfulLogins { get { return successfulLogins; } } - + private int logouts; public int Logouts { get { return logouts; } } - + public UserStatsCollector() { ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); ageStatsTimer.Enabled = true; } - + private void OnAgeing(object source, ElapsedEventArgs e) { successfulLoginsYesterday = successfulLoginsToday; - + // There is a possibility that an asset request could occur between the execution of these // two statements. But we're better off without the synchronization overhead. - successfulLoginsToday = 0; + successfulLoginsToday = 0; } - + /// /// Record a successful login /// public void AddSuccessfulLogin() { - successfulLogins++; + successfulLogins++; successfulLoginsToday++; } - + public void AddLogout() { logouts++; -- cgit v1.1