diff options
| author | jduncanator <jduncanator@users.noreply.github.com> | 2018-10-29 09:31:13 +1100 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-10-28 19:31:13 -0300 |
| commit | c1b7340023b42161d55993de2e40baad68915b86 (patch) | |
| tree | 3b88c6c36b1ba4ae9b4f256cffdf4fb0a5c77648 /Ryujinx.HLE/HOS/Kernel | |
| parent | b956bbc32c7f9fdffebfd9a9416e8e0a2a588abd (diff) | |
Timing: Optimize Timestamp Aquisition (#479)
* Timing: Optimize Timestamp Aquisition
Currently, we make use of Environment.TickCount in a number of places. This has some downsides, mainly being that the TickCount is a signed 32-bit integer, and has an effective limit of ~25 days before overflowing and wrapping around. Due to the signed-ness of the value, this also caused issues with negative numbers. This resolves these issues by using a 64-bit tick count obtained from Performance Counters (via the Stopwatch class). This has a beneficial side effect of being significantly more accurate than the TickCount.
* Timing: Rename ElapsedTicks to ElapsedMilliseconds and expose TicksPerX
* Timing: Some style changes
* Timing: Align static variable initialization
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel')
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/KCoreContext.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/KCoreContext.cs b/Ryujinx.HLE/HOS/Kernel/KCoreContext.cs index 51f27e2a..02354e16 100644 --- a/Ryujinx.HLE/HOS/Kernel/KCoreContext.cs +++ b/Ryujinx.HLE/HOS/Kernel/KCoreContext.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using System; namespace Ryujinx.HLE.HOS.Kernel @@ -25,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Kernel if (Thread != null) { - Thread.LastScheduledTicks = (uint)Environment.TickCount; + Thread.LastScheduledTicks = PerformanceCounter.ElapsedMilliseconds; } if (SelectedThread != CurrentThread) |
