BitCoinClient.Win32Wrapper.QueryPerformanceCounter C# (CSharp) Method

QueryPerformanceCounter() private method

private QueryPerformanceCounter ( long &lpPerformanceCount ) : bool
lpPerformanceCount long
return bool
        public static extern bool QueryPerformanceCounter(out long lpPerformanceCount);

Usage Example

Example #1
0
        void WorkThread()
        {
            long startTime, endTime, freq;

            Win32Wrapper.QueryPerformanceFrequency(out freq);
            double dfFreq = 1.0 / (double)freq;

            while (true)
            {
                if (mDoWork)
                {
                    uint hashesRemaining = mHashCount - mHashesDone;
                    uint numHashes       = Math.Min(hashesRemaining, cHashChunk);

                    uint start = mHashStart + mHashesDone;

                    Win32Wrapper.QueryPerformanceCounter(out startTime);
                    uint hashesDone = DoHashes(start, numHashes);
                    Win32Wrapper.QueryPerformanceCounter(out endTime);
                    double seconds = (double)(endTime - startTime) * dfFreq;
                    mHashrate = (double)hashesDone / seconds;

                    mHashesDone += hashesDone;
                    if (mHashesDone >= mHashCount)
                    {
                        // Done, didnt find a solution
                        SendWorkComplete(false, 0, mHashesDone);
                    }
                }
            }
        }
All Usage Examples Of BitCoinClient.Win32Wrapper::QueryPerformanceCounter