mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 11:33:28 +08:00
Formatting cleanup.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Record that an asset request failed to find an asset
|
||||
/// </summary>
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
assetRequestsNotFoundToday++;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Record that a request was made to the asset server
|
||||
/// </summary>
|
||||
@@ -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",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Implemented by classes which collect up non-viewer statistical information
|
||||
/// </summary>
|
||||
@@ -36,6 +36,6 @@ namespace OpenSim.Framework.Statistics
|
||||
/// Report back collected statistical information.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string Report();
|
||||
string Report();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,20 +32,20 @@ using libsecondlife;
|
||||
using OpenSim.Framework.Statistics.Interfaces;
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
|
||||
/// </summary>
|
||||
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).
|
||||
/// </summary>
|
||||
public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retain a dictionary of all packet queues stats reporters
|
||||
/// </summary>
|
||||
private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors
|
||||
= new Dictionary<LLUUID, PacketQueueStatsCollector>();
|
||||
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Register as a packet queue stats provider
|
||||
/// </summary>
|
||||
@@ -111,7 +111,7 @@ namespace OpenSim.Framework.Statistics
|
||||
packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deregister a packet queue stats provider
|
||||
/// </summary>
|
||||
@@ -129,25 +129,25 @@ namespace OpenSim.Framework.Statistics
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Report back collected statistical information.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public string Report()
|
||||
{
|
||||
return m_statsProvider.GetStats();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton used to provide access to statistics reporters
|
||||
/// </summary>
|
||||
@@ -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() {}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start collecting statistics related to assets.
|
||||
/// Should only be called once.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public static AssetStatsCollector StartCollectingAssetStats()
|
||||
{
|
||||
assetStats = new AssetStatsCollector();
|
||||
|
||||
|
||||
return assetStats;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start collecting statistics related to users.
|
||||
/// Should only be called once.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public static UserStatsCollector StartCollectingUserStats()
|
||||
{
|
||||
userStats = new UserStatsCollector();
|
||||
|
||||
|
||||
return userStats;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public static SimExtraStatsCollector StartCollectingSimExtraStats()
|
||||
{
|
||||
simExtraStats = new SimExtraStatsCollector();
|
||||
|
||||
|
||||
return simExtraStats;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Record a successful login
|
||||
/// </summary>
|
||||
public void AddSuccessfulLogin()
|
||||
{
|
||||
successfulLogins++;
|
||||
successfulLogins++;
|
||||
successfulLoginsToday++;
|
||||
}
|
||||
|
||||
|
||||
public void AddLogout()
|
||||
{
|
||||
logouts++;
|
||||
|
||||
Reference in New Issue
Block a user