Re: Re: [ntdev] KeQueryPerformanceCounter Wraparound question

perfcounter is documented not to roll over in 100 years minimum
How often does QPC roll over?

Not less than 100 years from the most recent system boot, and
potentially longer based on the underlying hardware timer used. For
most applications, rollover isn’t a concern.

as already posted it is 64bit or a LARGE_INTEGER

refer this link for using the quadpart
https://msdn.microsoft.com/en-us/library/windows/hardware/dn553408(v=vs.85).aspx

a simple powershell query to get the type and some dummy calc to use
as seed for verification using windbg (self gratification :slight_smile:

PS C:\>
$j=0
$tickinterval = 1/[diagnostics.Stopwatch]::Frequency
$start = [diagnostics.StopWatch]::GetTimestamp()
for($i=0;$i-lt1000000;$i++){$j++}
$end = [diagnostics.StopWatch]::GetTimestamp()
$sec = ($end - $start) * ($Tickinterval)
$tickinterval;$start;$end;$sec;$j;$start.GetType().Name;$end-$start
2.79365114840015E-07
23941426139
23951144112
2.71486264315716
1000000
Int64
9717973


PS C:\> $hextick = “{0:x}” -f ($end-$start)


PS C:\> kd -kl -c “!whatperftime $hextick;q”

lkd> kd: Reading initial command ‘!whatperftime 9448d5;q’
9717973 Performance Counter in Standard Time: 02.714.862s
quit:

On 7/24/15, Marion Bond wrote:
> If you used QuadPart, then the data type is ULONGLONG and there is no sign
> bit
>
>
> If you are having a problem, then likely you are using the wrong data type
> either explicitly or implicitly in your expression
>
>
>
>
>
>
> Sent from Surface Pro
>
>
>
>
>
> From: xxxxx@gmail.com
> Sent: ‎Thursday‎, ‎July‎ ‎23‎, ‎2015 ‎10‎:‎11‎ ‎AM
> To: Windows System Software Devs Interest List
>
>
>
>
>
> Hi
> thanks , sorry i didn’t meant overflow, I will get negative value when the
> sign bit is “1”, and this cause a problem with the timer.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer