Hi Factor List,

I've been doing some code profiling that requires a microsecond timer
(measuring the accumulated time spent in words that take less than a
millisecond for each invocation). To handle this on my 32bit linux box I
used the following:

FUNCTION: int gettimeofday ( void* TP, void* TZP ) ;

: micros ( -- n )
   8 <byte-array> dup f gettimeofday drop 2 c-ulong-array> first2
   [ 1000000 * ] dip + ;

...which obviously isn't portable. Looking at the source in os_unix.c
and os_windows*.c it looks like the timers on all the platforms are of
microsecond precision so I was wondering whether there was any objection
to me putting a 'micros' primitive in the vm?

(Actually I'm guessing that probably I don't know what I'm talking about
and that there's a good reason why only 'millis' exists in factor)

Cheers,

Phil



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to