beginning of a monotonic clock implementation. still needs linux and mac -- clock_gettime() and mach_absolute_time()

db4
Doug Coleman 2009-11-09 01:25:27 -06:00
parent 86be7762b1
commit 4b7a56bdfb
11 changed files with 41 additions and 0 deletions

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,4 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: ;
IN: monotonic-clock.unix.macosx

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 ;