Merge branch 'monotonic' of git://factorcode.org/git/factor into monotonic

db4
Doug Coleman 2009-11-15 00:02:23 -06:00
commit f3d301d1b9
12 changed files with 63 additions and 2 deletions

View File

@ -1622,8 +1622,8 @@ FUNCTION: HANDLE OpenProcess ( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD
! FUNCTION: QueryDosDeviceW
! FUNCTION: QueryInformationJobObject
! FUNCTION: QueryMemoryResourceNotification
! FUNCTION: QueryPerformanceCounter
! FUNCTION: QueryPerformanceFrequency
FUNCTION: BOOL QueryPerformanceCounter ( LARGE_INTEGER* lpPerformanceCount ) ;
FUNCTION: BOOL QueryPerformanceFrequency ( LARGE_INTEGER* lpFrequency ) ;
! FUNCTION: QueryWin31IniFilesMappedToRegistry
! FUNCTION: QueueUserAPC
! FUNCTION: QueueUserWorkItem

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,7 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: system ;
IN: monotonic-clock
HOOK: monotonic-count os ( -- n )

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,4 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: ;
IN: monotonic-clock.unix.linux

View File

@ -0,0 +1 @@
unportable

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,24 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.syntax classes.struct kernel math
monotonic-clock system unix.types ;
IN: monotonic-clock.unix.macosx
STRUCT: mach_timebase_info
{ numer uint32_t }
{ denom uint32_t } ;
TYPEDEF: mach_timebase_info* mach_timebase_info_t
TYPEDEF: mach_timebase_info mach_timebase_info_data_t
FUNCTION: uint64_t mach_absolute_time ( ) ;
FUNCTION: kern_return_t mach_timebase_info ( mach_timebase_info_t info ) ;
FUNCTION: kern_return_t mach_wait_until ( uint64_t deadline ) ;
ERROR: mach-timebase-info ret ;
M: macosx monotonic-count
mach_absolute_time
\ mach_timebase_info <struct> [
mach_timebase_info [ mach-timebase-info ] unless-zero
] keep [ numer>> ] [ denom>> ] bi / * ;

View File

@ -0,0 +1 @@
unportable

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1 @@
unportable

View File

@ -0,0 +1,19 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.data fry kernel monotonic-clock
system windows.errors windows.kernel32 ;
IN: monotonic-clock.windows
<PRIVATE
: execute-performance-query ( word -- n )
[ "LARGE_INTEGER*" <c-object> ] dip
'[ _ execute win32-error=0/f ] keep *ulonglong ; inline
PRIVATE>
M: windows monotonic-count ( -- n )
\ QueryPerformanceCounter execute-performance-query ;
: cpu-frequency ( -- n )
\ QueryPerformanceFrequency execute-performance-query ;