Initial work
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Common
|
||||
{
|
||||
public static class PerformanceCounter
|
||||
{
|
||||
private static double _ticksToNs;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the number of ticks in 1 day.
|
||||
/// </summary>
|
||||
@ -53,6 +55,19 @@ namespace Ryujinx.Common
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of nanoseconds elapsed since the system started.
|
||||
/// </summary>
|
||||
public static long ElapsedNanoseconds
|
||||
{
|
||||
get
|
||||
{
|
||||
long timestamp = Stopwatch.GetTimestamp();
|
||||
|
||||
return (long)(timestamp * _ticksToNs);
|
||||
}
|
||||
}
|
||||
|
||||
static PerformanceCounter()
|
||||
{
|
||||
TicksPerMillisecond = Stopwatch.Frequency / 1000;
|
||||
@ -60,6 +75,8 @@ namespace Ryujinx.Common
|
||||
TicksPerMinute = TicksPerSecond * 60;
|
||||
TicksPerHour = TicksPerMinute * 60;
|
||||
TicksPerDay = TicksPerHour * 24;
|
||||
|
||||
_ticksToNs = 1000000000.0 / (double)Stopwatch.Frequency;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user