lua-users home
lua-l archive

Re: [ANN] LuaProfiler 2.0

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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 ,"",ドル
> chris@marrin.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$$b1ドル" |$$ ,` ,$$" ``' $$
> ```"```'" `"` `""` ""` ,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
than enough.
-- 
Glenn Maynard

AltStyle によって変換されたページ (->オリジナル) /