aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-04 16:22:58 +0000
committerJustin Clarke Casey2008-02-04 16:22:58 +0000
commita1c9349d4765833691e7816d7f4df7bd37b9ee36 (patch)
tree2e108496bc6761f6ed1ec671a97bf6b4ba5e6137 /OpenSim/Framework
parent* Added note in CONTRIBUTORS.txt for _someone/mikkopa - RealXtend (diff)
downloadopensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.zip
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.gz
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.bz2
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.xz
Refactor only: serve stats objects directly through StatsManager singleton
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs18
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs15
-rw-r--r--OpenSim/Framework/Statistics/AssetStatsReporter.cs2
-rw-r--r--OpenSim/Framework/Statistics/StatsManager.cs28
4 files changed, 33 insertions, 30 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 1707607..865349f 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -46,9 +46,7 @@ namespace OpenSim.Framework.UserManagement
46 { 46 {
47 protected string m_welcomeMessage = "Welcome to OpenSim"; 47 protected string m_welcomeMessage = "Welcome to OpenSim";
48 protected UserManagerBase m_userManager = null; 48 protected UserManagerBase m_userManager = null;
49 protected Mutex m_loginMutex = new Mutex(false); 49 protected Mutex m_loginMutex = new Mutex(false);
50
51 protected UserStatsReporter m_statsCollector;
52 50
53 /// <summary> 51 /// <summary>
54 /// Used during login to send the skeleton of the OpenSim Library to the client. 52 /// Used during login to send the skeleton of the OpenSim Library to the client.
@@ -60,16 +58,12 @@ namespace OpenSim.Framework.UserManagement
60 /// </summary> 58 /// </summary>
61 /// <param name="userManager"></param> 59 /// <param name="userManager"></param>
62 /// <param name="libraryRootFolder"></param> 60 /// <param name="libraryRootFolder"></param>
63 /// <param name="statsCollector">
64 /// An object for collecting statistical information.
65 /// Can be null if statistics are not required</param>
66 /// <param name="welcomeMess"></param> 61 /// <param name="welcomeMess"></param>
67 public LoginService(UserManagerBase userManager, LibraryRootFolder libraryRootFolder, 62 public LoginService(UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
68 UserStatsReporter statsCollector, string welcomeMess) 63 string welcomeMess)
69 { 64 {
70 m_userManager = userManager; 65 m_userManager = userManager;
71 m_libraryRootFolder = libraryRootFolder; 66 m_libraryRootFolder = libraryRootFolder;
72 m_statsCollector = statsCollector;
73 67
74 if (welcomeMess != String.Empty) 68 if (welcomeMess != String.Empty)
75 { 69 {
@@ -226,8 +220,8 @@ namespace OpenSim.Framework.UserManagement
226 CommitAgent(ref userProfile); 220 CommitAgent(ref userProfile);
227 221
228 // If we reach this point, then the login has successfully logged onto the grid 222 // If we reach this point, then the login has successfully logged onto the grid
229 if (m_statsCollector != null) 223 if (StatsManager.UserStats != null)
230 m_statsCollector.AddSuccessfulLogin(); 224 StatsManager.UserStats.AddSuccessfulLogin();
231 225
232 return logResponse.ToXmlRpcResponse(); 226 return logResponse.ToXmlRpcResponse();
233 } 227 }
@@ -358,8 +352,8 @@ namespace OpenSim.Framework.UserManagement
358 CommitAgent(ref userProfile); 352 CommitAgent(ref userProfile);
359 353
360 // If we reach this point, then the login has successfully logged onto the grid 354 // If we reach this point, then the login has successfully logged onto the grid
361 if (m_statsCollector != null) 355 if (StatsManager.UserStats != null)
362 m_statsCollector.AddSuccessfulLogin(); 356 StatsManager.UserStats.AddSuccessfulLogin();
363 357
364 return logResponse.ToLLSDResponse(); 358 return logResponse.ToLLSDResponse();
365 } 359 }
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 4967cd9..3b1d837 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -45,17 +45,6 @@ namespace OpenSim.Framework.UserManagement
45 { 45 {
46 public UserConfig _config; 46 public UserConfig _config;
47 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 47 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
48 protected UserStatsReporter _stats;
49
50 /// <summary>
51 /// Constructor.
52 /// </summary>
53 /// <param name="statsCollector">Can be null if stats collection is not required.
54 /// </param>
55 public UserManagerBase(UserStatsReporter statsCollector)
56 {
57 _stats = statsCollector;
58 }
59 48
60 /// <summary> 49 /// <summary>
61 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 50 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
@@ -435,8 +424,8 @@ namespace OpenSim.Framework.UserManagement
435 /// <param name="posz"></param> 424 /// <param name="posz"></param>
436 public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) 425 public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
437 { 426 {
438 if (_stats != null) 427 if (StatsManager.UserStats != null)
439 _stats.AddLogout(); 428 StatsManager.UserStats.AddLogout();
440 429
441 UserProfileData userProfile; 430 UserProfileData userProfile;
442 UserAgentData userAgent; 431 UserAgentData userAgent;
diff --git a/OpenSim/Framework/Statistics/AssetStatsReporter.cs b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
index bcd3a75..4f2ef86 100644
--- a/OpenSim/Framework/Statistics/AssetStatsReporter.cs
+++ b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
@@ -30,7 +30,7 @@ using System;
30using System.Text; 30using System.Text;
31using System.Timers; 31using System.Timers;
32 32
33namespace OpenSim.Grid.AssetServer 33namespace OpenSim.Framework.Statistics
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Collects and reports information on the requests made to the asset server 36 /// Collects and reports information on the requests made to the asset server
diff --git a/OpenSim/Framework/Statistics/StatsManager.cs b/OpenSim/Framework/Statistics/StatsManager.cs
index 35040e3..842f1f1 100644
--- a/OpenSim/Framework/Statistics/StatsManager.cs
+++ b/OpenSim/Framework/Statistics/StatsManager.cs
@@ -33,19 +33,39 @@ namespace OpenSim.Framework.Statistics
33 /// </summary> 33 /// </summary>
34 public class StatsManager 34 public class StatsManager
35 { 35 {
36 private static AssetStatsReporter assetStats;
37 private static UserStatsReporter userStats;
36 private static SimExtraStatsReporter simExtraStats; 38 private static SimExtraStatsReporter simExtraStats;
37 39
40 public static AssetStatsReporter AssetStats { get { return assetStats; } }
41 public static UserStatsReporter UserStats { get { return userStats; } }
38 public static SimExtraStatsReporter SimExtraStats { get { return simExtraStats; } } 42 public static SimExtraStatsReporter SimExtraStats { get { return simExtraStats; } }
39 43
40 private StatsManager() 44 private StatsManager() {}
45
46 /// <summary>
47 /// Start collecting statistics related to assets.
48 /// Should only be called once.
49 /// </summary>
50 public static void StartCollectingAssetStats()
41 { 51 {
52 assetStats = new AssetStatsReporter();
42 } 53 }
43 54
44 /// <summary> 55 /// <summary>
45 /// Start recording statistics. Should only be called once - calling again will reset statistic 56 /// Start collecting statistics related to users.
46 /// counts. 57 /// Should only be called once.
58 /// </summary>
59 public static void StartCollectingUserStats()
60 {
61 userStats = new UserStatsReporter();
62 }
63
64 /// <summary>
65 /// Start collecting extra sim statistics apart from those collected for the client.
66 /// Should only be called once.
47 /// </summary> 67 /// </summary>
48 public static void StartCollecting() 68 public static void StartCollectingSimExtraStats()
49 { 69 {
50 simExtraStats = new SimExtraStatsReporter(); 70 simExtraStats = new SimExtraStatsReporter();
51 } 71 }