mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-30 11:30:47 -07:00
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
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Graphics.Gal;
|
||||
using Ryujinx.Graphics.Memory;
|
||||
using Ryujinx.Graphics.Texture;
|
||||
@ -851,7 +852,7 @@ namespace Ryujinx.Graphics
|
||||
//TODO: Implement counters.
|
||||
long Counter = 1;
|
||||
|
||||
long Timestamp = (uint)Environment.TickCount;
|
||||
long Timestamp = PerformanceCounter.ElapsedMilliseconds;
|
||||
|
||||
Timestamp = (long)(Timestamp * 615384.615385);
|
||||
|
||||
|
Reference in New Issue
Block a user