31 using OpenMetaverse.StructuredData;
40 private Timer ageStatsTimer =
new Timer(24 * 60 * 60 * 1000);
41 private DateTime startTime = DateTime.Now;
43 private long assetRequestsToday;
44 private long assetRequestsNotFoundToday;
45 private long assetRequestsYesterday;
46 private long assetRequestsNotFoundYesterday;
48 public long AssetRequestsToday {
get {
return assetRequestsToday; } }
49 public long AssetRequestsNotFoundToday {
get {
return assetRequestsNotFoundToday; } }
50 public long AssetRequestsYesterday {
get {
return assetRequestsYesterday; } }
51 public long AssetRequestsNotFoundYesterday {
get {
return assetRequestsNotFoundYesterday; } }
55 ageStatsTimer.Elapsed +=
new ElapsedEventHandler(OnAgeing);
56 ageStatsTimer.Enabled =
true;
59 private void OnAgeing(
object source, ElapsedEventArgs e)
61 assetRequestsYesterday = assetRequestsToday;
65 assetRequestsToday = 0;
67 assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
68 assetRequestsNotFoundToday = 0;
76 assetRequestsNotFoundToday++;
93 double elapsedHours = (DateTime.Now - startTime).TotalHours;
94 if (elapsedHours <= 0) { elapsedHours = 1; }
96 long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
97 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
100 @"Asset requests today : {0} ({1} per hour) of which {2} were not found
101 Asset requests yesterday : {3} ({4} per hour) of which {5} were not found",
102 AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
103 AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
106 public override string XReport(
string uptime,
string version)
108 return OSDParser.SerializeJsonString(OReport(uptime, version));
113 double elapsedHours = (DateTime.Now - startTime).TotalHours;
114 if (elapsedHours <= 0) { elapsedHours = 1; }
116 long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
117 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
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));
override OSDMap OReport(string uptime, string version)
Report back collected statistical information as an OSDMap of key/values
OpenMetaverse.StructuredData.OSDMap OSDMap
override string XReport(string uptime, string version)
Report back collected statistical information in json
override string Report()
Report back collected statistical information.
System.Timers.Timer Timer
void AddRequest()
Record that a request was made to the asset server
void AddNotFoundRequest()
Record that an asset request failed to find an asset
Interactive OpenSim region server
Statistics which all collectors are interested in reporting
Asset service statistics collection