-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delay profiler, align profiler output format
- Loading branch information
Showing
4 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
recipes/llm-voice-assistant/dotnet/LLMVoiceAssistant/DelayProfiler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Diagnostics; | ||
|
||
class DelayProfiler : Profiler | ||
{ | ||
Stopwatch _stopwatch = new Stopwatch(); | ||
public DelayProfiler() { } | ||
|
||
public void Tick() | ||
{ | ||
_stopwatch.Restart(); | ||
} | ||
|
||
public void Tock() | ||
{ | ||
_stopwatch.Stop(); | ||
} | ||
|
||
public string Stats() | ||
{ | ||
return $"Delay: {_stopwatch.ElapsedMilliseconds:F2}ms"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters