aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
diff options
context:
space:
mode:
authorRobert Adams2013-02-20 14:11:02 -0800
committerRobert Adams2013-02-20 16:13:51 -0800
commit681653ca130eaf15c62aae6fd1a7c5276036a0e9 (patch)
tree23e97348c4ad5911ca9689bcaaa44f50378173a2 /OpenSim/Framework/Monitoring/AssetStatsCollector.cs
parentAdd flush after write feature to LogWriter (diff)
downloadopensim-SC_OLD-681653ca130eaf15c62aae6fd1a7c5276036a0e9.zip
opensim-SC_OLD-681653ca130eaf15c62aae6fd1a7c5276036a0e9.tar.gz
opensim-SC_OLD-681653ca130eaf15c62aae6fd1a7c5276036a0e9.tar.bz2
opensim-SC_OLD-681653ca130eaf15c62aae6fd1a7c5276036a0e9.tar.xz
Add a method to IStatsCollector for returning stats as an OSDMap.
Extend implementors of IStatsCollector to return an OSDMap of stats. Update UserStatsCollector and AssetStatsCollector to return both string and OSDMap data (as well as console format).
Diffstat (limited to 'OpenSim/Framework/Monitoring/AssetStatsCollector.cs')
-rw-r--r--OpenSim/Framework/Monitoring/AssetStatsCollector.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenSim/Framework/Monitoring/AssetStatsCollector.cs b/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
index 2a4d45b..6a0f676 100644
--- a/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/AssetStatsCollector.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Timers; 29using System.Timers;
30 30
31using OpenMetaverse.StructuredData;
32
31namespace OpenSim.Framework.Monitoring 33namespace OpenSim.Framework.Monitoring
32{ 34{
33 /// <summary> 35 /// <summary>
@@ -100,5 +102,29 @@ Asset requests yesterday : {3} ({4} per hour) of which {5} were not found",
100 AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday, 102 AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
101 AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday); 103 AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
102 } 104 }
105
106 public override string XReport(string uptime, string version)
107 {
108 return OSDParser.SerializeJsonString(OReport(uptime, version));
109 }
110
111 public override OSDMap OReport(string uptime, string version)
112 {
113 double elapsedHours = (DateTime.Now - startTime).TotalHours;
114 if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero
115
116 long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
117 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
118
119 OSDMap ret = new OSDMap();
120 ret.Add("AssetRequestsToday", OSD.FromLong(AssetRequestsToday));
121 ret.Add("AssetRequestsTodayPerHour", OSD.FromLong(assetRequestsTodayPerHour));
122 ret.Add("AssetRequestsNotFoundToday", OSD.FromLong(AssetRequestsNotFoundToday));
123 ret.Add("AssetRequestsYesterday", OSD.FromLong(AssetRequestsYesterday));
124 ret.Add("AssetRequestsYesterdayPerHour", OSD.FromLong(assetRequestsYesterdayPerHour));
125 ret.Add("AssetRequestsNotFoundYesterday", OSD.FromLong(assetRequestsNotFoundYesterday));
126
127 return ret;
128 }
103 } 129 }
104} 130}