* Insert 'assets served per hour' speed to asset server stats
parent
8f5c55c79b
commit
ce07854a45
|
@ -26,6 +26,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
|
@ -37,11 +38,12 @@ namespace OpenSim.Grid.AssetServer
|
||||||
public class AssetStatsReporter
|
public class AssetStatsReporter
|
||||||
{
|
{
|
||||||
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
|
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
|
||||||
|
private DateTime startTime = DateTime.Now;
|
||||||
|
|
||||||
private long assetRequestsToday;
|
private long assetRequestsToday;
|
||||||
public long AssetRequestsToday { get { return assetRequestsToday; } }
|
|
||||||
|
|
||||||
private long assetRequestsYesterday;
|
private long assetRequestsYesterday;
|
||||||
|
|
||||||
|
public long AssetRequestsToday { get { return assetRequestsToday; } }
|
||||||
public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
|
public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
|
||||||
|
|
||||||
public AssetStatsReporter()
|
public AssetStatsReporter()
|
||||||
|
@ -73,10 +75,17 @@ namespace OpenSim.Grid.AssetServer
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string Report()
|
public string Report()
|
||||||
{
|
{
|
||||||
|
double elapsedHours = (DateTime.Now - startTime).TotalHours;
|
||||||
|
if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero
|
||||||
|
|
||||||
|
long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
|
||||||
|
long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
|
||||||
|
|
||||||
return string.Format(
|
return string.Format(
|
||||||
@"Asset requests today : {0}
|
@"Asset requests today : {0} ({1} per hour)
|
||||||
Asset requests yesterday : {1}",
|
Asset requests yesterday : {2} ({3} per hour)",
|
||||||
AssetRequestsToday, AssetRequestsYesterday);
|
AssetRequestsToday, assetRequestsTodayPerHour,
|
||||||
|
AssetRequestsYesterday, assetRequestsYesterdayPerHour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue