diff options
author | Jeff Ames | 2008-05-16 01:22:11 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-16 01:22:11 +0000 |
commit | 65c5efe43b68700bad94076d4cd421160203c5de (patch) | |
tree | 589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Framework/Statistics | |
parent | Thank you very much, mjm for : (diff) | |
download | opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.zip opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2 opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Statistics')
5 files changed, 73 insertions, 73 deletions
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 | |||
37 | { | 37 | { |
38 | private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); | 38 | private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); |
39 | private DateTime startTime = DateTime.Now; | 39 | private DateTime startTime = DateTime.Now; |
40 | 40 | ||
41 | private long assetRequestsToday; | 41 | private long assetRequestsToday; |
42 | private long assetRequestsNotFoundToday; | 42 | private long assetRequestsNotFoundToday; |
43 | private long assetRequestsYesterday; | 43 | private long assetRequestsYesterday; |
44 | private long assetRequestsNotFoundYesterday; | 44 | private long assetRequestsNotFoundYesterday; |
45 | 45 | ||
46 | public long AssetRequestsToday { get { return assetRequestsToday; } } | 46 | public long AssetRequestsToday { get { return assetRequestsToday; } } |
47 | public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } } | 47 | public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } } |
48 | public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } | 48 | public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } |
49 | public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } } | 49 | public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } } |
50 | 50 | ||
51 | public AssetStatsCollector() | 51 | public AssetStatsCollector() |
52 | { | 52 | { |
53 | ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); | 53 | ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); |
54 | ageStatsTimer.Enabled = true; | 54 | ageStatsTimer.Enabled = true; |
55 | } | 55 | } |
56 | 56 | ||
57 | private void OnAgeing(object source, ElapsedEventArgs e) | 57 | private void OnAgeing(object source, ElapsedEventArgs e) |
58 | { | 58 | { |
59 | assetRequestsYesterday = assetRequestsToday; | 59 | assetRequestsYesterday = assetRequestsToday; |
60 | 60 | ||
61 | // There is a possibility that an asset request could occur between the execution of these | 61 | // There is a possibility that an asset request could occur between the execution of these |
62 | // two statements. But we're better off without the synchronization overhead. | 62 | // two statements. But we're better off without the synchronization overhead. |
63 | assetRequestsToday = 0; | 63 | assetRequestsToday = 0; |
64 | 64 | ||
65 | assetRequestsNotFoundYesterday = assetRequestsNotFoundToday; | 65 | assetRequestsNotFoundYesterday = assetRequestsNotFoundToday; |
66 | assetRequestsNotFoundToday = 0; | 66 | assetRequestsNotFoundToday = 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Record that an asset request failed to find an asset | 70 | /// Record that an asset request failed to find an asset |
71 | /// </summary> | 71 | /// </summary> |
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Statistics | |||
73 | { | 73 | { |
74 | assetRequestsNotFoundToday++; | 74 | assetRequestsNotFoundToday++; |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// Record that a request was made to the asset server | 78 | /// Record that a request was made to the asset server |
79 | /// </summary> | 79 | /// </summary> |
@@ -90,10 +90,10 @@ namespace OpenSim.Framework.Statistics | |||
90 | { | 90 | { |
91 | double elapsedHours = (DateTime.Now - startTime).TotalHours; | 91 | double elapsedHours = (DateTime.Now - startTime).TotalHours; |
92 | if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero | 92 | if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero |
93 | 93 | ||
94 | long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours); | 94 | long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours); |
95 | long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0); | 95 | long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0); |
96 | 96 | ||
97 | return string.Format( | 97 | return string.Format( |
98 | @"Asset requests today : {0} ({1} per hour) of which {2} were not found | 98 | @"Asset requests today : {0} ({1} per hour) of which {2} were not found |
99 | Asset requests yesterday : {3} ({4} per hour) of which {5} were not found", | 99 | 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 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Framework.Statistics | 28 | namespace OpenSim.Framework.Statistics |
29 | { | 29 | { |
30 | /// <summary> | 30 | /// <summary> |
31 | /// Implemented by classes which collect up non-viewer statistical information | 31 | /// Implemented by classes which collect up non-viewer statistical information |
32 | /// </summary> | 32 | /// </summary> |
@@ -36,6 +36,6 @@ namespace OpenSim.Framework.Statistics | |||
36 | /// Report back collected statistical information. | 36 | /// Report back collected statistical information. |
37 | /// </summary> | 37 | /// </summary> |
38 | /// <returns></returns> | 38 | /// <returns></returns> |
39 | string Report(); | 39 | string Report(); |
40 | } | 40 | } |
41 | } | 41 | } |
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; | |||
32 | using OpenSim.Framework.Statistics.Interfaces; | 32 | using OpenSim.Framework.Statistics.Interfaces; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Statistics | 34 | namespace OpenSim.Framework.Statistics |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane | 37 | /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane |
38 | /// </summary> | 38 | /// </summary> |
39 | public class SimExtraStatsCollector : IStatsCollector | 39 | public class SimExtraStatsCollector : IStatsCollector |
40 | { | 40 | { |
41 | private long assetsInCache; | 41 | private long assetsInCache; |
42 | private long texturesInCache; | 42 | private long texturesInCache; |
43 | private long assetCacheMemoryUsage; | 43 | private long assetCacheMemoryUsage; |
44 | private long textureCacheMemoryUsage; | 44 | private long textureCacheMemoryUsage; |
45 | private long blockedMissingTextureRequests; | 45 | private long blockedMissingTextureRequests; |
46 | 46 | ||
47 | private long inventoryServiceRetrievalFailures; | 47 | private long inventoryServiceRetrievalFailures; |
48 | 48 | ||
49 | public long AssetsInCache { get { return assetsInCache; } } | 49 | public long AssetsInCache { get { return assetsInCache; } } |
50 | public long TexturesInCache { get { return texturesInCache; } } | 50 | public long TexturesInCache { get { return texturesInCache; } } |
51 | public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } } | 51 | public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } } |
@@ -58,47 +58,47 @@ namespace OpenSim.Framework.Statistics | |||
58 | /// driver bugs on clients (though this seems less likely). | 58 | /// driver bugs on clients (though this seems less likely). |
59 | /// </summary> | 59 | /// </summary> |
60 | public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } } | 60 | public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Number of known failures to retrieve avatar inventory from the inventory service. This does not | 63 | /// Number of known failures to retrieve avatar inventory from the inventory service. This does not |
64 | /// cover situations where the inventory service accepts the request but never returns any data, since | 64 | /// cover situations where the inventory service accepts the request but never returns any data, since |
65 | /// we do not yet timeout this situation. | 65 | /// we do not yet timeout this situation. |
66 | /// </summary> | 66 | /// </summary> |
67 | public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } | 67 | public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Retain a dictionary of all packet queues stats reporters | 70 | /// Retain a dictionary of all packet queues stats reporters |
71 | /// </summary> | 71 | /// </summary> |
72 | private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors | 72 | private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors |
73 | = new Dictionary<LLUUID, PacketQueueStatsCollector>(); | 73 | = new Dictionary<LLUUID, PacketQueueStatsCollector>(); |
74 | 74 | ||
75 | public void AddAsset(AssetBase asset) | 75 | public void AddAsset(AssetBase asset) |
76 | { | 76 | { |
77 | assetsInCache++; | 77 | assetsInCache++; |
78 | assetCacheMemoryUsage += asset.Data.Length; | 78 | assetCacheMemoryUsage += asset.Data.Length; |
79 | } | 79 | } |
80 | 80 | ||
81 | public void AddTexture(AssetBase image) | 81 | public void AddTexture(AssetBase image) |
82 | { | 82 | { |
83 | if (image.Data != null) | 83 | if (image.Data != null) |
84 | { | 84 | { |
85 | texturesInCache++; | 85 | texturesInCache++; |
86 | 86 | ||
87 | // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates | 87 | // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates |
88 | textureCacheMemoryUsage += image.Data.Length; | 88 | textureCacheMemoryUsage += image.Data.Length; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | public void AddBlockedMissingTextureRequest() | 92 | public void AddBlockedMissingTextureRequest() |
93 | { | 93 | { |
94 | blockedMissingTextureRequests++; | 94 | blockedMissingTextureRequests++; |
95 | } | 95 | } |
96 | 96 | ||
97 | public void AddInventoryServiceRetrievalFailure() | 97 | public void AddInventoryServiceRetrievalFailure() |
98 | { | 98 | { |
99 | inventoryServiceRetrievalFailures++; | 99 | inventoryServiceRetrievalFailures++; |
100 | } | 100 | } |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Register as a packet queue stats provider | 103 | /// Register as a packet queue stats provider |
104 | /// </summary> | 104 | /// </summary> |
@@ -111,7 +111,7 @@ namespace OpenSim.Framework.Statistics | |||
111 | packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider); | 111 | packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /// <summary> | 115 | /// <summary> |
116 | /// Deregister a packet queue stats provider | 116 | /// Deregister a packet queue stats provider |
117 | /// </summary> | 117 | /// </summary> |
@@ -129,25 +129,25 @@ namespace OpenSim.Framework.Statistics | |||
129 | /// </summary> | 129 | /// </summary> |
130 | /// <returns></returns> | 130 | /// <returns></returns> |
131 | public string Report() | 131 | public string Report() |
132 | { | 132 | { |
133 | StringBuilder sb = new StringBuilder(Environment.NewLine); | 133 | StringBuilder sb = new StringBuilder(Environment.NewLine); |
134 | sb.Append("ASSET STATISTICS"); | 134 | sb.Append("ASSET STATISTICS"); |
135 | sb.Append(Environment.NewLine); | 135 | sb.Append(Environment.NewLine); |
136 | sb.Append( | 136 | sb.Append( |
137 | string.Format( | 137 | string.Format( |
138 | @"Asset cache contains {0,6} assets using {1,10:0.000}K" + Environment.NewLine, | 138 | @"Asset cache contains {0,6} assets using {1,10:0.000}K" + Environment.NewLine, |
139 | AssetsInCache, AssetCacheMemoryUsage / 1024.0)); | 139 | AssetsInCache, AssetCacheMemoryUsage / 1024.0)); |
140 | 140 | ||
141 | sb.Append(Environment.NewLine); | 141 | sb.Append(Environment.NewLine); |
142 | sb.Append("TEXTURE STATISTICS"); | 142 | sb.Append("TEXTURE STATISTICS"); |
143 | sb.Append(Environment.NewLine); | 143 | sb.Append(Environment.NewLine); |
144 | sb.Append( | 144 | sb.Append( |
145 | string.Format( | 145 | string.Format( |
146 | @"Texture cache contains {0,6} textures using {1,10:0.000}K | 146 | @"Texture cache contains {0,6} textures using {1,10:0.000}K |
147 | Blocked requests for missing textures: {2}" + Environment.NewLine, | 147 | Blocked requests for missing textures: {2}" + Environment.NewLine, |
148 | TexturesInCache, TextureCacheMemoryUsage / 1024.0, | 148 | TexturesInCache, TextureCacheMemoryUsage / 1024.0, |
149 | BlockedMissingTextureRequests)); | 149 | BlockedMissingTextureRequests)); |
150 | 150 | ||
151 | sb.Append(Environment.NewLine); | 151 | sb.Append(Environment.NewLine); |
152 | sb.Append("INVENTORY STATISTICS"); | 152 | sb.Append("INVENTORY STATISTICS"); |
153 | sb.Append(Environment.NewLine); | 153 | sb.Append(Environment.NewLine); |
@@ -155,26 +155,26 @@ Blocked requests for missing textures: {2}" + Environment.NewLine, | |||
155 | string.Format( | 155 | string.Format( |
156 | "Initial inventory caching failures: {0}" + Environment.NewLine, | 156 | "Initial inventory caching failures: {0}" + Environment.NewLine, |
157 | InventoryServiceRetrievalFailures)); | 157 | InventoryServiceRetrievalFailures)); |
158 | 158 | ||
159 | sb.Append(Environment.NewLine); | 159 | sb.Append(Environment.NewLine); |
160 | sb.Append("PACKET QUEUE STATISTICS"); | 160 | sb.Append("PACKET QUEUE STATISTICS"); |
161 | sb.Append(Environment.NewLine); | 161 | sb.Append(Environment.NewLine); |
162 | sb.Append("Agent UUID "); | 162 | sb.Append("Agent UUID "); |
163 | sb.Append( | 163 | sb.Append( |
164 | string.Format( | 164 | string.Format( |
165 | " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", | 165 | " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", |
166 | "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset")); | 166 | "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset")); |
167 | sb.Append(Environment.NewLine); | 167 | sb.Append(Environment.NewLine); |
168 | 168 | ||
169 | foreach (LLUUID key in packetQueueStatsCollectors.Keys) | 169 | foreach (LLUUID key in packetQueueStatsCollectors.Keys) |
170 | { | 170 | { |
171 | sb.Append(string.Format("{0}: ", key)); | 171 | sb.Append(string.Format("{0}: ", key)); |
172 | sb.Append(packetQueueStatsCollectors[key].Report()); | 172 | sb.Append(packetQueueStatsCollectors[key].Report()); |
173 | sb.Append(Environment.NewLine); | 173 | sb.Append(Environment.NewLine); |
174 | } | 174 | } |
175 | 175 | ||
176 | return sb.ToString(); | 176 | return sb.ToString(); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | /// <summary> | 180 | /// <summary> |
@@ -183,16 +183,16 @@ Blocked requests for missing textures: {2}" + Environment.NewLine, | |||
183 | public class PacketQueueStatsCollector : IStatsCollector | 183 | public class PacketQueueStatsCollector : IStatsCollector |
184 | { | 184 | { |
185 | private IPullStatsProvider m_statsProvider; | 185 | private IPullStatsProvider m_statsProvider; |
186 | 186 | ||
187 | public PacketQueueStatsCollector(IPullStatsProvider provider) | 187 | public PacketQueueStatsCollector(IPullStatsProvider provider) |
188 | { | 188 | { |
189 | m_statsProvider = provider; | 189 | m_statsProvider = provider; |
190 | } | 190 | } |
191 | 191 | ||
192 | /// <summary> | 192 | /// <summary> |
193 | /// Report back collected statistical information. | 193 | /// Report back collected statistical information. |
194 | /// </summary> | 194 | /// </summary> |
195 | /// <returns></returns> | 195 | /// <returns></returns> |
196 | public string Report() | 196 | public string Report() |
197 | { | 197 | { |
198 | return m_statsProvider.GetStats(); | 198 | 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 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Framework.Statistics | 28 | namespace OpenSim.Framework.Statistics |
29 | { | 29 | { |
30 | /// <summary> | 30 | /// <summary> |
31 | /// Singleton used to provide access to statistics reporters | 31 | /// Singleton used to provide access to statistics reporters |
32 | /// </summary> | 32 | /// </summary> |
@@ -34,44 +34,44 @@ namespace OpenSim.Framework.Statistics | |||
34 | { | 34 | { |
35 | private static AssetStatsCollector assetStats; | 35 | private static AssetStatsCollector assetStats; |
36 | private static UserStatsCollector userStats; | 36 | private static UserStatsCollector userStats; |
37 | private static SimExtraStatsCollector simExtraStats; | 37 | private static SimExtraStatsCollector simExtraStats; |
38 | 38 | ||
39 | public static AssetStatsCollector AssetStats { get { return assetStats; } } | 39 | public static AssetStatsCollector AssetStats { get { return assetStats; } } |
40 | public static UserStatsCollector UserStats { get { return userStats; } } | 40 | public static UserStatsCollector UserStats { get { return userStats; } } |
41 | public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } | 41 | public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } |
42 | 42 | ||
43 | private StatsManager() {} | 43 | private StatsManager() {} |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Start collecting statistics related to assets. | 46 | /// Start collecting statistics related to assets. |
47 | /// Should only be called once. | 47 | /// Should only be called once. |
48 | /// </summary> | 48 | /// </summary> |
49 | public static AssetStatsCollector StartCollectingAssetStats() | 49 | public static AssetStatsCollector StartCollectingAssetStats() |
50 | { | 50 | { |
51 | assetStats = new AssetStatsCollector(); | 51 | assetStats = new AssetStatsCollector(); |
52 | 52 | ||
53 | return assetStats; | 53 | return assetStats; |
54 | } | 54 | } |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Start collecting statistics related to users. | 57 | /// Start collecting statistics related to users. |
58 | /// Should only be called once. | 58 | /// Should only be called once. |
59 | /// </summary> | 59 | /// </summary> |
60 | public static UserStatsCollector StartCollectingUserStats() | 60 | public static UserStatsCollector StartCollectingUserStats() |
61 | { | 61 | { |
62 | userStats = new UserStatsCollector(); | 62 | userStats = new UserStatsCollector(); |
63 | 63 | ||
64 | return userStats; | 64 | return userStats; |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Start collecting extra sim statistics apart from those collected for the client. | 68 | /// Start collecting extra sim statistics apart from those collected for the client. |
69 | /// Should only be called once. | 69 | /// Should only be called once. |
70 | /// </summary> | 70 | /// </summary> |
71 | public static SimExtraStatsCollector StartCollectingSimExtraStats() | 71 | public static SimExtraStatsCollector StartCollectingSimExtraStats() |
72 | { | 72 | { |
73 | simExtraStats = new SimExtraStatsCollector(); | 73 | simExtraStats = new SimExtraStatsCollector(); |
74 | 74 | ||
75 | return simExtraStats; | 75 | return simExtraStats; |
76 | } | 76 | } |
77 | } | 77 | } |
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 | |||
35 | public class UserStatsCollector : IStatsCollector | 35 | public class UserStatsCollector : IStatsCollector |
36 | { | 36 | { |
37 | private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); | 37 | private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); |
38 | 38 | ||
39 | private int successfulLoginsToday; | 39 | private int successfulLoginsToday; |
40 | public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } | 40 | public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } |
41 | 41 | ||
42 | private int successfulLoginsYesterday; | 42 | private int successfulLoginsYesterday; |
43 | public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } | 43 | public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } |
44 | 44 | ||
45 | private int successfulLogins; | 45 | private int successfulLogins; |
46 | public int SuccessfulLogins { get { return successfulLogins; } } | 46 | public int SuccessfulLogins { get { return successfulLogins; } } |
47 | 47 | ||
48 | private int logouts; | 48 | private int logouts; |
49 | public int Logouts { get { return logouts; } } | 49 | public int Logouts { get { return logouts; } } |
50 | 50 | ||
51 | public UserStatsCollector() | 51 | public UserStatsCollector() |
52 | { | 52 | { |
53 | ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); | 53 | ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); |
54 | ageStatsTimer.Enabled = true; | 54 | ageStatsTimer.Enabled = true; |
55 | } | 55 | } |
56 | 56 | ||
57 | private void OnAgeing(object source, ElapsedEventArgs e) | 57 | private void OnAgeing(object source, ElapsedEventArgs e) |
58 | { | 58 | { |
59 | successfulLoginsYesterday = successfulLoginsToday; | 59 | successfulLoginsYesterday = successfulLoginsToday; |
60 | 60 | ||
61 | // There is a possibility that an asset request could occur between the execution of these | 61 | // There is a possibility that an asset request could occur between the execution of these |
62 | // two statements. But we're better off without the synchronization overhead. | 62 | // two statements. But we're better off without the synchronization overhead. |
63 | successfulLoginsToday = 0; | 63 | successfulLoginsToday = 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Record a successful login | 67 | /// Record a successful login |
68 | /// </summary> | 68 | /// </summary> |
69 | public void AddSuccessfulLogin() | 69 | public void AddSuccessfulLogin() |
70 | { | 70 | { |
71 | successfulLogins++; | 71 | successfulLogins++; |
72 | successfulLoginsToday++; | 72 | successfulLoginsToday++; |
73 | } | 73 | } |
74 | 74 | ||
75 | public void AddLogout() | 75 | public void AddLogout() |
76 | { | 76 | { |
77 | logouts++; | 77 | logouts++; |