diff options
Diffstat (limited to 'OpenSim/Framework/Statistics/AssetStatsCollector.cs')
-rw-r--r-- | OpenSim/Framework/Statistics/AssetStatsCollector.cs | 28 |
1 files changed, 14 insertions, 14 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", |