in reply to Re^2: Time::HiRes sleep does not always work
in thread Time::HiRes sleep does not always work
Could you post the output from the following on one machine that gives good results and one that gives bad:
#! perl -slw use strict; use Time::HiRes qw[ gettimeofday time ]; use Win32::API::Prototype; ApiLink( 'kernel32', q[ BOOL QueryPerformanceCounter( LARGE_INTEGER *lpPerformanceCount ) ]) or die $^E; ApiLink( 'kernel32', q[ BOOL QueryPerformanceFrequency( LARGE_INTEGER *lpPerformanceCount +) ]) or die $^E; sub int64_to_NV { my( $lo, $hi ) = unpack 'VV', $_[ 0 ]; return $hi * 2**32 + $lo; } my $frequency = ' ' x 10; QueryPerformanceFrequency( $frequency ) or die $^E; print 'Counter changes ', int64_to_NV( $frequency ), ' times/second'; for ( 1 .. 10 ) { QueryPerformanceCounter( $frequency )or die $^E; print 'QPC: ',int64_to_NV( $frequency ); } printf "GToD: %.8f\n", scalar gettimeofday() for 1 .. 10; printf "Time: %.8f\n", time() for 1 .. 10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Time::HiRes sleep does not always work
by tone (Novice) on Aug 19, 2008 at 13:05 UTC | |
by BrowserUk (Patriarch) on Aug 19, 2008 at 13:28 UTC | |
by tone (Novice) on Aug 20, 2008 at 08:13 UTC | |
by BrowserUk (Patriarch) on Aug 20, 2008 at 08:53 UTC | |
by tone (Novice) on Aug 20, 2008 at 13:29 UTC |