aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Statistics/AssetStatsReporter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Statistics/AssetStatsReporter.cs')
-rw-r--r--OpenSim/Framework/Statistics/AssetStatsReporter.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/OpenSim/Framework/Statistics/AssetStatsReporter.cs b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
index ea5add5..4489c65 100644
--- a/OpenSim/Framework/Statistics/AssetStatsReporter.cs
+++ b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
29using System.Text; 30using System.Text;
30using System.Timers; 31using System.Timers;
31 32
@@ -37,11 +38,12 @@ namespace OpenSim.Grid.AssetServer
37 public class AssetStatsReporter 38 public class AssetStatsReporter
38 { 39 {
39 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); 40 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
41 private DateTime startTime = DateTime.Now;
40 42
41 private long assetRequestsToday; 43 private long assetRequestsToday;
42 public long AssetRequestsToday { get { return assetRequestsToday; } }
43
44 private long assetRequestsYesterday; 44 private long assetRequestsYesterday;
45
46 public long AssetRequestsToday { get { return assetRequestsToday; } }
45 public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } 47 public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
46 48
47 public AssetStatsReporter() 49 public AssetStatsReporter()
@@ -73,10 +75,17 @@ namespace OpenSim.Grid.AssetServer
73 /// <returns></returns> 75 /// <returns></returns>
74 public string Report() 76 public string Report()
75 { 77 {
78 double elapsedHours = (DateTime.Now - startTime).TotalHours;
79 if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero
80
81 long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
82 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
83
76 return string.Format( 84 return string.Format(
77@"Asset requests today : {0} 85@"Asset requests today : {0} ({1} per hour)
78Asset requests yesterday : {1}", 86Asset requests yesterday : {2} ({3} per hour)",
79 AssetRequestsToday, AssetRequestsYesterday); 87 AssetRequestsToday, assetRequestsTodayPerHour,
88 AssetRequestsYesterday, assetRequestsYesterdayPerHour);
80 } 89 }
81 } 90 }
82} 91}