From 56faeafdae5b4b76593e268bc994a7f663bd5685 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 14 May 2008 21:27:54 +0000
Subject: * Refactor: Renaming non viewer statistics classes from Reporters to
Collectors - this seems more intuitive
---
.../Framework/Statistics/AssetStatsCollector.cs | 104 ++++++++++++++
OpenSim/Framework/Statistics/AssetStatsReporter.cs | 104 --------------
.../Statistics/Interfaces/IPullStatsProvider.cs | 2 +-
.../Framework/Statistics/SimExtraStatsCollector.cs | 156 +++++++++++++++++++++
.../Framework/Statistics/SimExtraStatsReporter.cs | 153 --------------------
OpenSim/Framework/Statistics/StatsManager.cs | 18 +--
OpenSim/Framework/Statistics/UserStatsCollector.cs | 92 ++++++++++++
OpenSim/Framework/Statistics/UserStatsReporter.cs | 92 ------------
8 files changed, 362 insertions(+), 359 deletions(-)
create mode 100644 OpenSim/Framework/Statistics/AssetStatsCollector.cs
delete mode 100644 OpenSim/Framework/Statistics/AssetStatsReporter.cs
create mode 100644 OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
delete mode 100644 OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
create mode 100644 OpenSim/Framework/Statistics/UserStatsCollector.cs
delete mode 100644 OpenSim/Framework/Statistics/UserStatsReporter.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Statistics/AssetStatsCollector.cs b/OpenSim/Framework/Statistics/AssetStatsCollector.cs
new file mode 100644
index 0000000..afc42d2
--- /dev/null
+++ b/OpenSim/Framework/Statistics/AssetStatsCollector.cs
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSim Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Timers;
+
+namespace OpenSim.Framework.Statistics
+{
+ ///
+ /// Asset service statistics collection
+ ///
+ public class AssetStatsCollector
+ {
+ private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
+ private DateTime startTime = DateTime.Now;
+
+ 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 AssetRequestsYesterday { get { return assetRequestsYesterday; } }
+ 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;
+
+ assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
+ assetRequestsNotFoundToday = 0;
+ }
+
+ ///
+ /// Record that an asset request failed to find an asset
+ ///
+ public void AddNotFoundRequest()
+ {
+ assetRequestsNotFoundToday++;
+ }
+
+ ///
+ /// Record that a request was made to the asset server
+ ///
+ public void AddRequest()
+ {
+ assetRequestsToday++;
+ }
+
+ ///
+ /// Report back collected statistical information.
+ ///
+ ///
+ public string Report()
+ {
+ 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",
+ AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
+ AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
+ }
+ }
+}
diff --git a/OpenSim/Framework/Statistics/AssetStatsReporter.cs b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
deleted file mode 100644
index 66eb471..0000000
--- a/OpenSim/Framework/Statistics/AssetStatsReporter.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Timers;
-
-namespace OpenSim.Framework.Statistics
-{
- ///
- /// Collects and reports information on the requests made to the asset server
- ///
- public class AssetStatsReporter
- {
- private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
- private DateTime startTime = DateTime.Now;
-
- 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 AssetRequestsYesterday { get { return assetRequestsYesterday; } }
- public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } }
-
- public AssetStatsReporter()
- {
- 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;
-
- assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
- assetRequestsNotFoundToday = 0;
- }
-
- ///
- /// Record that an asset request failed to find an asset
- ///
- public void AddNotFoundRequest()
- {
- assetRequestsNotFoundToday++;
- }
-
- ///
- /// Record that a request was made to the asset server
- ///
- public void AddRequest()
- {
- assetRequestsToday++;
- }
-
- ///
- /// Report back collected statistical information.
- ///
- ///
- public string Report()
- {
- 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",
- AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
- AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
- }
- }
-}
diff --git a/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs b/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs
index 0d85919..9a3ee8e 100644
--- a/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs
+++ b/OpenSim/Framework/Statistics/Interfaces/IPullStatsProvider.cs
@@ -28,7 +28,7 @@
namespace OpenSim.Framework.Statistics.Interfaces
{
///
- /// Description of IPullStatsProvider.
+ /// Implemented by objects which allow statistical information to be pulled from them.
///
public interface IPullStatsProvider
{
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
new file mode 100644
index 0000000..4e69d17
--- /dev/null
+++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSim Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+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
+ {
+ private long assetsInCache;
+ private long texturesInCache;
+ private long assetCacheMemoryUsage;
+ private long textureCacheMemoryUsage;
+
+ public long AssetsInCache { get { return assetsInCache; } }
+ public long TexturesInCache { get { return texturesInCache; } }
+ public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
+ public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
+
+ ///
+ /// 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)
+ {
+ // Tedd: I added null check to avoid exception. Don't know if texturesInCache should ++ anyway?
+ if (image.Data != null)
+ {
+ texturesInCache++;
+ textureCacheMemoryUsage += image.Data.Length;
+ }
+ }
+
+ ///
+ /// Register as a packet queue stats provider
+ ///
+ /// An agent LLUUID
+ ///
+ public void RegisterPacketQueueStatsProvider(LLUUID uuid, IPullStatsProvider provider)
+ {
+ lock (packetQueueStatsCollectors)
+ {
+ packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider);
+ }
+ }
+
+ ///
+ /// Deregister a packet queue stats provider
+ ///
+ /// An agent LLUUID
+ public void DeregisterPacketQueueStatsProvider(LLUUID uuid)
+ {
+ lock (packetQueueStatsCollectors)
+ {
+ packetQueueStatsCollectors.Remove(uuid);
+ }
+ }
+
+ ///
+ /// Report back collected statistical information.
+ ///
+ ///
+ public string Report()
+ {
+ StringBuilder sb = new StringBuilder(Environment.NewLine);
+ sb.Append("ASSET CACHE STATISTICS");
+ sb.Append(Environment.NewLine);
+ sb.Append(
+ string.Format(
+@"Asset cache contains {0,6} assets using {1,10:0.000}K
+Texture cache contains {2,6} textures using {3,10:0.000}K" + Environment.NewLine,
+ AssetsInCache, AssetCacheMemoryUsage / 1024.0,
+ TexturesInCache, TextureCacheMemoryUsage / 1024.0));
+
+ 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}",
+ "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"));
+ 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();
+ }
+ }
+
+ ///
+ /// Pull packet queue stats from packet queues and report
+ ///
+ public class PacketQueueStatsCollector
+ {
+ private IPullStatsProvider m_statsProvider;
+
+ public PacketQueueStatsCollector(IPullStatsProvider provider)
+ {
+ m_statsProvider = provider;
+ }
+
+ ///
+ /// Report back collected statistical information.
+ ///
+ ///
+ public string Report()
+ {
+ return m_statsProvider.GetStats();
+ }
+ }
+}
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs b/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
deleted file mode 100644
index 567d8dd..0000000
--- a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using libsecondlife;
-using OpenSim.Framework.Statistics.Interfaces;
-
-namespace OpenSim.Framework.Statistics
-{
- public class SimExtraStatsReporter
- {
- private long assetsInCache;
- private long texturesInCache;
- private long assetCacheMemoryUsage;
- private long textureCacheMemoryUsage;
-
- public long AssetsInCache { get { return assetsInCache; } }
- public long TexturesInCache { get { return texturesInCache; } }
- public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
- public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
-
- ///
- /// Retain a dictionary of all packet queues stats reporters
- ///
- private IDictionary packetQueueStatsReporters
- = new Dictionary();
-
- public void AddAsset(AssetBase asset)
- {
- assetsInCache++;
- assetCacheMemoryUsage += asset.Data.Length;
- }
-
- public void AddTexture(AssetBase image)
- {
- // Tedd: I added null check to avoid exception. Don't know if texturesInCache should ++ anyway?
- if (image.Data != null)
- {
- texturesInCache++;
- textureCacheMemoryUsage += image.Data.Length;
- }
- }
-
- ///
- /// Register as a packet queue stats provider
- ///
- /// An agent LLUUID
- ///
- public void RegisterPacketQueueStatsProvider(LLUUID uuid, IPullStatsProvider provider)
- {
- lock (packetQueueStatsReporters)
- {
- packetQueueStatsReporters[uuid] = new PacketQueueStatsReporter(provider);
- }
- }
-
- ///
- /// Deregister a packet queue stats provider
- ///
- /// An agent LLUUID
- public void DeregisterPacketQueueStatsProvider(LLUUID uuid)
- {
- lock (packetQueueStatsReporters)
- {
- packetQueueStatsReporters.Remove(uuid);
- }
- }
-
- ///
- /// Report back collected statistical information.
- ///
- ///
- public string Report()
- {
- StringBuilder sb = new StringBuilder(Environment.NewLine);
- sb.Append("ASSET CACHE STATISTICS");
- sb.Append(Environment.NewLine);
- sb.Append(
- string.Format(
-@"Asset cache contains {0,6} assets using {1,10:0.000}K
-Texture cache contains {2,6} textures using {3,10:0.000}K" + Environment.NewLine,
- AssetsInCache, AssetCacheMemoryUsage / 1024.0,
- TexturesInCache, TextureCacheMemoryUsage / 1024.0));
-
- 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}",
- "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"));
- sb.Append(Environment.NewLine);
-
- foreach (LLUUID key in packetQueueStatsReporters.Keys)
- {
- sb.Append(string.Format("{0}: ", key));
- sb.Append(packetQueueStatsReporters[key].Report());
- sb.Append(Environment.NewLine);
- }
-
- return sb.ToString();
- }
- }
-
- ///
- /// Pull packet queue stats from packet queues and report
- ///
- public class PacketQueueStatsReporter
- {
- private IPullStatsProvider m_statsProvider;
-
- public PacketQueueStatsReporter(IPullStatsProvider 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 8bbe6c1..10251a5 100644
--- a/OpenSim/Framework/Statistics/StatsManager.cs
+++ b/OpenSim/Framework/Statistics/StatsManager.cs
@@ -32,13 +32,13 @@ namespace OpenSim.Framework.Statistics
///
public class StatsManager
{
- private static AssetStatsReporter assetStats;
- private static UserStatsReporter userStats;
- private static SimExtraStatsReporter simExtraStats;
+ private static AssetStatsCollector assetStats;
+ private static UserStatsCollector userStats;
+ private static SimExtraStatsCollector simExtraStats;
- public static AssetStatsReporter AssetStats { get { return assetStats; } }
- public static UserStatsReporter UserStats { get { return userStats; } }
- public static SimExtraStatsReporter SimExtraStats { get { return simExtraStats; } }
+ public static AssetStatsCollector AssetStats { get { return assetStats; } }
+ public static UserStatsCollector UserStats { get { return userStats; } }
+ public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
private StatsManager() {}
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Statistics
///
public static void StartCollectingAssetStats()
{
- assetStats = new AssetStatsReporter();
+ assetStats = new AssetStatsCollector();
}
///
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Statistics
///
public static void StartCollectingUserStats()
{
- userStats = new UserStatsReporter();
+ userStats = new UserStatsCollector();
}
///
@@ -66,7 +66,7 @@ namespace OpenSim.Framework.Statistics
///
public static void StartCollectingSimExtraStats()
{
- simExtraStats = new SimExtraStatsReporter();
+ simExtraStats = new SimExtraStatsCollector();
}
}
}
diff --git a/OpenSim/Framework/Statistics/UserStatsCollector.cs b/OpenSim/Framework/Statistics/UserStatsCollector.cs
new file mode 100644
index 0000000..80cd46e
--- /dev/null
+++ b/OpenSim/Framework/Statistics/UserStatsCollector.cs
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSim Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System.Timers;
+
+namespace OpenSim.Framework.Statistics
+{
+ ///
+ /// Collects user service statistics
+ ///
+ public class UserStatsCollector
+ {
+ 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; } }
+
+ 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;
+ }
+
+ ///
+ /// Record a successful login
+ ///
+ public void AddSuccessfulLogin()
+ {
+ successfulLogins++;
+ successfulLoginsToday++;
+ }
+
+ public void AddLogout()
+ {
+ logouts++;
+ }
+
+ ///
+ /// Report back collected statistical information.
+ ///
+ ///
+ public string Report()
+ {
+ return string.Format(
+@"Successful logins total : {0}, today : {1}, yesterday : {2}
+ Logouts total : {3}",
+ SuccessfulLogins, SuccessfulLoginsToday, SuccessfulLoginsYesterday, Logouts);
+ }
+ }
+}
diff --git a/OpenSim/Framework/Statistics/UserStatsReporter.cs b/OpenSim/Framework/Statistics/UserStatsReporter.cs
deleted file mode 100644
index ce82615..0000000
--- a/OpenSim/Framework/Statistics/UserStatsReporter.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Timers;
-
-namespace OpenSim.Framework.Statistics
-{
- ///
- /// Description of UserStatsReporter.
- ///
- public class UserStatsReporter
- {
- 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; } }
-
- private int successfulLogins;
- public int SuccessfulLogins { get { return successfulLogins; } }
-
- private int logouts;
- public int Logouts { get { return logouts; } }
-
- public UserStatsReporter()
- {
- 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;
- }
-
- ///
- /// Record a successful login
- ///
- public void AddSuccessfulLogin()
- {
- successfulLogins++;
- successfulLoginsToday++;
- }
-
- public void AddLogout()
- {
- logouts++;
- }
-
- ///
- /// Report back collected statistical information.
- ///
- ///
- public string Report()
- {
- return string.Format(
-@"Successful logins total : {0}, today : {1}, yesterday : {2}
- Logouts total : {3}",
- SuccessfulLogins, SuccessfulLoginsToday, SuccessfulLoginsYesterday, Logouts);
- }
- }
-}
--
cgit v1.1