diff options
author | Justin Clarke Casey | 2008-01-28 19:49:07 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-28 19:49:07 +0000 |
commit | fa5fe6b7f6f187817ad166799f99fe2e5699fbf1 (patch) | |
tree | cad7d66b148ea366edb13b69059fbc11d6085414 /OpenSim/Grid | |
parent | * ODE Going to Time Step 0.020 = (1000\20) - ((1000\20) * .09) = ~45 pfps (diff) | |
download | opensim-SC_OLD-fa5fe6b7f6f187817ad166799f99fe2e5699fbf1.zip opensim-SC_OLD-fa5fe6b7f6f187817ad166799f99fe2e5699fbf1.tar.gz opensim-SC_OLD-fa5fe6b7f6f187817ad166799f99fe2e5699fbf1.tar.bz2 opensim-SC_OLD-fa5fe6b7f6f187817ad166799f99fe2e5699fbf1.tar.xz |
* Move AssetStatsReporter to Framework.Statistics
* The hooks are still plugged in too high at the asset server, but then next layer down is the database and this may be refactored soon.
* This change will requires a prebuild
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/AssetServer/AssetStatsReporter.cs | 82 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 1 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/RestService.cs | 1 |
3 files changed, 2 insertions, 82 deletions
diff --git a/OpenSim/Grid/AssetServer/AssetStatsReporter.cs b/OpenSim/Grid/AssetServer/AssetStatsReporter.cs deleted file mode 100644 index ea5add5..0000000 --- a/OpenSim/Grid/AssetServer/AssetStatsReporter.cs +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System.Text; | ||
30 | using System.Timers; | ||
31 | |||
32 | namespace OpenSim.Grid.AssetServer | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Collects and reports information on the requests made to the asset server | ||
36 | /// </summary> | ||
37 | public class AssetStatsReporter | ||
38 | { | ||
39 | private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); | ||
40 | |||
41 | private long assetRequestsToday; | ||
42 | public long AssetRequestsToday { get { return assetRequestsToday; } } | ||
43 | |||
44 | private long assetRequestsYesterday; | ||
45 | public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } | ||
46 | |||
47 | public AssetStatsReporter() | ||
48 | { | ||
49 | ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); | ||
50 | ageStatsTimer.Enabled = true; | ||
51 | } | ||
52 | |||
53 | private void OnAgeing(object source, ElapsedEventArgs e) | ||
54 | { | ||
55 | assetRequestsYesterday = assetRequestsToday; | ||
56 | |||
57 | // There is a possibility that an asset request could occur between the execution of these | ||
58 | // two statements. But we're better off without the synchronization overhead. | ||
59 | assetRequestsToday = 0; | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// Record that a request was made to the asset server | ||
64 | /// </summary> | ||
65 | public void AddRequest() | ||
66 | { | ||
67 | assetRequestsToday++; | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Report back collected statistical information. | ||
72 | /// </summary> | ||
73 | /// <returns></returns> | ||
74 | public string Report() | ||
75 | { | ||
76 | return string.Format( | ||
77 | @"Asset requests today : {0} | ||
78 | Asset requests yesterday : {1}", | ||
79 | AssetRequestsToday, AssetRequestsYesterday); | ||
80 | } | ||
81 | } | ||
82 | } | ||
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 1e0dced..de16470 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.AssetLoader.Filesystem; | 34 | using OpenSim.Framework.AssetLoader.Filesystem; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework.Statistics; | ||
37 | 38 | ||
38 | namespace OpenSim.Grid.AssetServer | 39 | namespace OpenSim.Grid.AssetServer |
39 | { | 40 | { |
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 36dcdb0..6e4ae8f 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs | |||
@@ -35,6 +35,7 @@ using libsecondlife; | |||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Statistics; | ||
38 | 39 | ||
39 | namespace OpenSim.Grid.AssetServer | 40 | namespace OpenSim.Grid.AssetServer |
40 | { | 41 | { |