1
This commit is contained in:
24
Src/Core/Utility/StopWatcher.cs
Normal file
24
Src/Core/Utility/StopWatcher.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace BITKit
|
||||||
|
{
|
||||||
|
public class StopWatcher:IDisposable
|
||||||
|
{
|
||||||
|
private readonly Stopwatch _stopwatch = new Stopwatch();
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly string _message;
|
||||||
|
public StopWatcher(ILogger logger,string message)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_message = message;
|
||||||
|
_logger.LogInformation($"开始计时:{message}");
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_stopwatch.Stop();
|
||||||
|
_logger.LogInformation($"已完成:{_message},耗时{_stopwatch.Elapsed}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Src/Core/Utility/StopWatcher.cs.meta
Normal file
11
Src/Core/Utility/StopWatcher.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 037ac1eb81cc8454998ac1c731e6dd38
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in New Issue
Block a user