diff options
author | Justin Clarke Casey | 2008-01-30 17:19:32 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-30 17:19:32 +0000 |
commit | ce07854a45a82e6627da26e2603eb32836182af3 (patch) | |
tree | d62bb4b3a3f2b9f80786c094139358c8f7577d33 /OpenSim/Framework/Statistics | |
parent | Updated ODE lib for OS X (built from opensim-libs r27) (diff) | |
download | opensim-SC_OLD-ce07854a45a82e6627da26e2603eb32836182af3.zip opensim-SC_OLD-ce07854a45a82e6627da26e2603eb32836182af3.tar.gz opensim-SC_OLD-ce07854a45a82e6627da26e2603eb32836182af3.tar.bz2 opensim-SC_OLD-ce07854a45a82e6627da26e2603eb32836182af3.tar.xz |
* Insert 'assets served per hour' speed to asset server stats
Diffstat (limited to 'OpenSim/Framework/Statistics')
-rw-r--r-- | OpenSim/Framework/Statistics/AssetStatsReporter.cs | 21 |
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 | ||
29 | using System; | ||
29 | using System.Text; | 30 | using System.Text; |
30 | using System.Timers; | 31 | using 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) |
78 | Asset requests yesterday : {1}", | 86 | Asset requests yesterday : {2} ({3} per hour)", |
79 | AssetRequestsToday, AssetRequestsYesterday); | 87 | AssetRequestsToday, assetRequestsTodayPerHour, |
88 | AssetRequestsYesterday, assetRequestsYesterdayPerHour); | ||
80 | } | 89 | } |
81 | } | 90 | } |
82 | } | 91 | } |