[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] LuaProfiler 2.0
- From: Glenn Maynard <glenn@...>
- Date: Tue, 14 Jun 2005 20:42:10 -0400
On Tue, Jun 14, 2005 at 05:19:49PM -0700, Chris Marrin wrote:
> I have gotten recent experience with QueryPerformanceCounter(). I
> naively tried to get its value and divide it by the value in
> QueryPerformanceFrequency(), first converting both to doubles. I found
> that this conversion reduced the precision down to about 100ms. This is
> because on my shiny new 3GHz P4 machine, the frequency is 3GHz! That
> means the counter increments by 3 billion every second. Since it's a 64
> bit counter it will still not rollover for about 200 years. But if your
> machine has been running for a month or so like mine was, the number
> gets too big to be represented very precisely by a double!
Stick with 64-bit integer math. If you want microseconds:
__int64 n = 10000000000ll;
__int64 divisor = 3000000000ll;
__int64 precision = 1000000;
__int64 result = n * precision / divisor;
> chris marrin ,""$,
> email@example.com b` $ ,,.
> mP b' , 1$'
> ,.` ,b` ,` :$$'
> ,|` mP ,` ,mm
> ,b" b" ,` ,mm m$$ ,m ,`P$$
> m$` ,b` .` ,mm ,'|$P ,|"1$` ,b$P ,` :$1
> b$` ,$: :,`` |$$ ,` $$` ,|` ,$$,,`"$$ .` :$|
> b$| _m$`,:` :$1 ,` ,$Pm|` ` :$$,..;"' |$:
> P$b, _;b$$b$1" |$$ ,` ,$$" ``' $$
> ```"```'" `"` `""` ""` ,P`
> "As a general rule,don't solve puzzles that open portals to Hell"'
Could you please use a more reasonable sig? Four or five lines is more