/// <summary>Returns the amount of CPU time consumed by this thread only since the last call to <see cref="Tic"/>.</summary> public long Toc() { ulong tocCycles; WinAPI.QueryThreadCycleTime(_threadHandle, out tocCycles); return((long)tocCycles - (long)_ticCycles - _calibrationCycles); }
/// <summary> /// Starts / resets the timer. Returns the the amount of CPU time consumed by this thread only since the last call /// to <see cref="Tic"/>, or zero if this is the first call.</summary> public long Tic() { ulong prevTicCycles = _ticCycles; WinAPI.QueryThreadCycleTime(_threadHandle, out _ticCycles); return(prevTicCycles == 0 ? 0 : ((long)_ticCycles - (long)prevTicCycles - _calibrationCycles)); }