using System; using System.Runtime.CompilerServices; namespace System.Diagnostics { /// Provides a set of methods and properties that you can use to accurately measure elapsed time. /// 1 // Token: 0x020000F4 RID: 244 public class Stopwatch { /// Gets the current number of ticks in the timer mechanism. /// A long integer representing the tick counter value of the underlying timer mechanism. /// 1 // Token: 0x0600089B RID: 2203 [MethodImpl(MethodImplOptions.InternalCall)] public static extern long GetTimestamp(); /// Initializes a new instance, sets the elapsed time property to zero, and starts measuring elapsed time. /// A that has just begun measuring elapsed time. /// 1 // Token: 0x0600089C RID: 2204 RVA: 0x00016D2C File Offset: 0x00014F2C public static Stopwatch StartNew() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); return stopwatch; } /// Gets the total elapsed time measured by the current instance. /// A read-only representing the total elapsed time measured by the current instance. /// 1 // Token: 0x17000245 RID: 581 // (get) Token: 0x0600089D RID: 2205 RVA: 0x00016D48 File Offset: 0x00014F48 public TimeSpan Elapsed { get { if (Stopwatch.IsHighResolution) { return TimeSpan.FromTicks(this.ElapsedTicks / (Stopwatch.Frequency / 10000000L)); } return TimeSpan.FromTicks(this.ElapsedTicks); } } /// Gets the total elapsed time measured by the current instance, in milliseconds. /// A read-only long integer representing the total number of milliseconds measured by the current instance. /// 1 // Token: 0x17000246 RID: 582 // (get) Token: 0x0600089E RID: 2206 RVA: 0x00016D84 File Offset: 0x00014F84 public long ElapsedMilliseconds { get { if (Stopwatch.IsHighResolution) { return this.ElapsedTicks / (Stopwatch.Frequency / 1000L); } return checked((long)this.Elapsed.TotalMilliseconds); } } /// Gets the total elapsed time measured by the current instance, in timer ticks. /// A read-only long integer representing the total number of timer ticks measured by the current instance. /// 1 // Token: 0x17000247 RID: 583 // (get) Token: 0x0600089F RID: 2207 RVA: 0x00016DC0 File Offset: 0x00014FC0 public long ElapsedTicks { get { return (!this.is_running) ? this.elapsed : (Stopwatch.GetTimestamp() - this.started + this.elapsed); } } /// Gets a value indicating whether the timer is running. /// true if the instance is currently running and measuring elapsed time for an interval; otherwise, false. /// 1 // Token: 0x17000248 RID: 584 // (get) Token: 0x060008A0 RID: 2208 RVA: 0x00016DEC File Offset: 0x00014FEC public bool IsRunning { get { return this.is_running; } } /// Stops time interval measurement and resets the elapsed time to zero. /// 1 // Token: 0x060008A1 RID: 2209 RVA: 0x00016DF4 File Offset: 0x00014FF4 public void Reset() { this.elapsed = 0L; this.is_running = false; } /// Starts, or resumes, measuring elapsed time for an interval. /// 1 // Token: 0x060008A2 RID: 2210 RVA: 0x00016E08 File Offset: 0x00015008 public void Start() { if (this.is_running) { return; } this.started = Stopwatch.GetTimestamp(); this.is_running = true; } /// Stops measuring elapsed time for an interval. /// 1 // Token: 0x060008A3 RID: 2211 RVA: 0x00016E28 File Offset: 0x00015028 public void Stop() { if (!this.is_running) { return; } this.elapsed += Stopwatch.GetTimestamp() - this.started; this.is_running = false; } /// Gets the frequency of the timer as the number of ticks per second. This field is read-only. /// 1 // Token: 0x040002B6 RID: 694 public static readonly long Frequency = 10000000L; /// Indicates whether the timer is based on a high-resolution performance counter. This field is read-only. /// 1 // Token: 0x040002B7 RID: 695 public static readonly bool IsHighResolution = true; // Token: 0x040002B8 RID: 696 private long elapsed; // Token: 0x040002B9 RID: 697 private long started; // Token: 0x040002BA RID: 698 private bool is_running; } }