public override string ToString() { if (Times.Count > 0) { Times.Sort(); var median = Times.Sum() / (Times.Count / 2); return($":: {TimeTakenMs,-15:N0} {SuccessResponses,-10} {ErrorResponses,-10} {Times.Min(),-10:N4}{Times.Max(),-10:N2}{Times.Average(),-10:N4}{median,-10:N4}"); } return($";; no response."); }
public BenchmarkStats(IEnumerable <TimeSpan> times) { Times = times.ToList(); TotalAverageTime = TimeSpan.FromSeconds(Times.Average(t => t.TotalSeconds)); }
/// <summary> /// Outputs the profiler information as an HTML table /// </summary> /// <returns>Table containing profiler information</returns> public virtual string ToHTML() { CompileData(); StringBuilder Builder = new StringBuilder(); if (Level == 0) { Builder.Append("<table><tr><th>Called From</th><th>Function Name</th><th>Total Time</th><th>Max Time</th><th>Min Time</th><th>Average Time</th><th>Times Called</th></tr>"); } Builder.AppendFormat(CultureInfo.InvariantCulture, "<tr><td>{0}</td><td>", CalledFrom); if (Level == 0) { Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Function, 0, 0, 0, 0, Times.Count); } else { Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Function, Times.Sum(), Times.Max(), Times.Min(), string.Format(CultureInfo.InvariantCulture, "{0:0.##}", Times.Average()), Times.Count); } foreach (Profiler Child in Children) { Builder.AppendLineFormat(Child.ToHTML()); } if (Level == 0) { Builder.Append("</table>"); } return(Builder.ToString()); }
/// <summary> /// Outputs the profiler information as an HTML table /// </summary> /// <returns>Table containing profiler information</returns> public override string ToHTML() { CompileData(); StringBuilder Builder = new StringBuilder(); Builder.AppendFormat(CultureInfo.InvariantCulture, "<tr><td>{0}</td><td>", CalledFrom); Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Query, Times.Sum(), Times.Max(), Times.Min(), string.Format(CultureInfo.InvariantCulture, "{0:0.##}", Times.Average()), Times.Count); foreach (Profiler Child in Children) { Builder.AppendLineFormat(Child.ToHTML()); } return(Builder.ToString()); }