mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added AutoStopwatchPerf
This commit is contained in:
parent
23b777c6f8
commit
0918c702c6
1 changed files with 18 additions and 0 deletions
|
@ -139,4 +139,22 @@ namespace System.Diagnostics
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class AutoStopwatchPerf
|
||||
{
|
||||
String mName ~ delete _;
|
||||
Stopwatch mStopwatch = new .() ~ delete _;
|
||||
|
||||
public this(StringView name)
|
||||
{
|
||||
mName = new .(name);
|
||||
mStopwatch.Start();
|
||||
}
|
||||
|
||||
public ~this()
|
||||
{
|
||||
mStopwatch.Stop();
|
||||
Debug.WriteLine($"{mName} {mStopwatch.Elapsed}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue