namespace Swan.Diagnostics { using System; using System.Diagnostics; /// /// Provides access to a high-resolution, time measuring device. /// /// public class HighResolutionTimer : Stopwatch { /// /// Initializes a new instance of the class. /// /// High-resolution timer not available. public HighResolutionTimer() { if (!IsHighResolution) throw new NotSupportedException("High-resolution timer not available"); } /// /// Gets the number of microseconds per timer tick. /// public static double MicrosecondsPerTick { get; } = 1000000d / Frequency; /// /// Gets the elapsed microseconds. /// public long ElapsedMicroseconds => (long)(ElapsedTicks * MicrosecondsPerTick); } }