void AppendHistoryStats(List <BuildStat> stats, string buildName, StatTable table) { var actualStats = string.IsNullOrEmpty(buildName) ? stats : stats.FindAll(s => IsSameName(s, buildName)); foreach (var stat in actualStats) { var name = stat.Name; var args = stat.Args; var date = stat.Start; var duration = stat.Duration; table.AddNewRow(name, FormatArgs(args), date.ToShortDateString(), Utils.FormatTimeSpan(duration)); } }
void AppendCommonInfo <T>(List <T> stats, string name, StatTable table) where T : ICommonStat { table.AddNewRow(name); table.AddToRow(stats.Count.ToString()); if (stats.Count > 1) { var history = new List <T>(stats); history.Reverse(); history = history.Skip(1).ToList(); var min = history.Min(s => s.Duration.TotalSeconds); var max = history.Max(s => s.Duration.TotalSeconds); var avg = history.Average(s => s.Duration.TotalSeconds); table.AddToRow(Utils.FormatSeconds(min), Utils.FormatSeconds(max), Utils.FormatSeconds(avg)); } else { table.AddToRow("", "", ""); } var last = stats.Last().Duration.TotalSeconds; table.AddToRow(Utils.FormatSeconds(last)); }
void FormatHistoryHeader(StatTable table) { table.AddNewRow("BUILD", "ARGS", "DATE", "DURATION"); }
void FormatStatHeader(StatTable table) { table.AddNewRow("BUILD", "COUNT", "MIN", "MAX", "AVG", "LAST"); }