Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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));
        }