Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Diagnostics
|
|||
if (!Core.Profiling)
|
||||
return null;
|
||||
|
||||
if (!_profiles.TryGetValue(type, out GumpProfile prof))
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
_profiles.Add(type, prof = new GumpProfile(type));
|
||||
|
||||
return prof;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Server.Diagnostics
|
|||
{
|
||||
}
|
||||
|
||||
public long TotalLength{ get; private set; }
|
||||
public long TotalLength { get; private set; }
|
||||
|
||||
public double AverageLength => (double)TotalLength / Math.Max(1, Count);
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Diagnostics
|
|||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
public static PacketSendProfile Acquire(Type type)
|
||||
{
|
||||
if (!_profiles.TryGetValue(type, out PacketSendProfile prof))
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
_profiles.Add(type, prof = new PacketSendProfile(type));
|
||||
|
||||
return prof;
|
||||
|
|
@ -99,7 +99,7 @@ namespace Server.Diagnostics
|
|||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
public static PacketReceiveProfile Acquire(int packetId)
|
||||
{
|
||||
if (!_profiles.TryGetValue(packetId, out PacketReceiveProfile prof))
|
||||
if (!_profiles.TryGetValue(packetId, out var prof))
|
||||
_profiles.Add(packetId, prof = new PacketReceiveProfile(packetId));
|
||||
|
||||
return prof;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Diagnostics
|
|||
if (!Core.Profiling)
|
||||
return null;
|
||||
|
||||
if (!_profiles.TryGetValue(type, out TargetProfile prof))
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
_profiles.Add(type, prof = new TargetProfile(type));
|
||||
|
||||
return prof;
|
||||
|
|
|
|||
|
|
@ -34,18 +34,18 @@ namespace Server.Diagnostics
|
|||
|
||||
public static IEnumerable<TimerProfile> Profiles => _profiles.Values;
|
||||
|
||||
public long Created{ get; set; }
|
||||
public long Created { get; set; }
|
||||
|
||||
public long Started{ get; set; }
|
||||
public long Started { get; set; }
|
||||
|
||||
public long Stopped{ get; set; }
|
||||
public long Stopped { get; set; }
|
||||
|
||||
public static TimerProfile Acquire(string name)
|
||||
{
|
||||
if (!Core.Profiling)
|
||||
return null;
|
||||
|
||||
if (!_profiles.TryGetValue(name, out TimerProfile prof))
|
||||
if (!_profiles.TryGetValue(name, out var prof))
|
||||
_profiles.Add(name, prof = new TimerProfile(name));
|
||||
|
||||
return prof;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue