diff options
| author | Bond_009 <Bond.009@outlook.com> | 2019-02-25 18:26:17 +0100 |
|---|---|---|
| committer | Bond_009 <Bond.009@outlook.com> | 2019-02-25 18:26:17 +0100 |
| commit | 0f9006c81fae1c9bd74c284b0affa76115a89ad2 (patch) | |
| tree | 61bcbe413f39c09300205b728958a69a3b744bc8 /Emby.Server.Implementations/ApplicationHost.cs | |
| parent | b3438559ccaeae05fa406eb01cbcc140619008d7 (diff) | |
Use stopwatch for more accurate measurements and reduce log spam
DateTime.Now is suitible for small timespans
Replaced the needlessly complex and verbose logging for the httpserver
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 042b04b3b..553d9b9dd 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -550,16 +550,18 @@ namespace Emby.Server.Implementations var entryPoints = GetExports<IServerEntryPoint>(); - var now = DateTime.UtcNow; + var stopWatch = new Stopwatch(); + stopWatch.Start(); await Task.WhenAll(StartEntryPoints(entryPoints, true)); - Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:fff} ms", DateTime.Now - now); + Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:fff} ms", stopWatch.Elapsed); Logger.LogInformation("Core startup complete"); HttpServer.GlobalResponse = null; - now = DateTime.UtcNow; + stopWatch.Restart(); await Task.WhenAll(StartEntryPoints(entryPoints, false)); - Logger.LogInformation("Executed all post-startup entry points in {Elapsed:fff} ms", DateTime.Now - now); + Logger.LogInformation("Executed all post-startup entry points in {Elapsed:fff} ms", stopWatch.Elapsed); + stopWatch.Stop(); } private IEnumerable<Task> StartEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup) |
