|
using System;
namespace Kaleida.ServiceMonitor.Model.Statistics
{
public class ResponseTimePercentile
{
private readonly decimal percentage;
private readonly TimeSpan? value;
public ResponseTimePercentile(decimal percentage, TimeSpan? value)
{
if (percentage < 0 || percentage > 100)
throw new ArgumentOutOfRangeException("percentage", percentage, "Must be between 0 and 100");
this.percentage = percentage;
this.value = value;
}
public decimal Percentage
{
get { return percentage; }
}
public TimeSpan? Value
{
get { return value; }
}
public override string ToString()
{
var durationString = value == null ? "n/a" : value.Value.TotalMilliseconds.ToString("0");
return string.Format("{0:D2}% of requests received within {1} ms", percentage, durationString);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Stuart Wheelwright is the Principal Architect and Software Developer at
BlackJet Software Ltd.
He has over 16 years commercial experience producing robust, maintainable, web-based solutions and bespoke systems for Microsoft platforms.
His latest project is
Shopping UK, an elegantly simple shopping list for iPhone.