Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -36,23 +36,23 @@ namespace Server.Diagnostics
_stopwatch = new Stopwatch();
}
public string Name{ get; }
public string Name { get; }
public long Count{ get; private set; }
public long Count { get; private set; }
public TimeSpan AverageTime => TimeSpan.FromTicks(TotalTime.Ticks / Math.Max(1, Count));
public TimeSpan PeakTime{ get; private set; }
public TimeSpan PeakTime { get; private set; }
public TimeSpan TotalTime{ get; private set; }
public TimeSpan TotalTime { get; private set; }
public static void WriteAll<T>(TextWriter op, IEnumerable<T> profiles) where T : BaseProfile
{
List<T> list = new List<T>(profiles);
var list = new List<T>(profiles);
list.Sort(delegate(T a, T b) { return -a.TotalTime.CompareTo(b.TotalTime); });
list.Sort((a, b) => -a.TotalTime.CompareTo(b.TotalTime));
foreach (T prof in list)
foreach (var prof in list)
{
prof.WriteTo(op);
op.WriteLine();
@ -68,7 +68,7 @@ namespace Server.Diagnostics
public virtual void Finish()
{
TimeSpan elapsed = _stopwatch.Elapsed;
var elapsed = _stopwatch.Elapsed;
TotalTime += elapsed;
@ -85,4 +85,4 @@ namespace Server.Diagnostics
PeakTime.TotalSeconds, TotalTime.TotalSeconds);
}
}
}
}