Agreed - I'll try and get this done tonight.
BTW, I don't have a windows or mac machine for testing factor on so I'll 
take a stab at what I think should work on these platforms and then 
hopefully somebody else cat check it?

Cheers,

Phil

Daniel Ehrenberg wrote:
> I'm wondering, is it possible to do this without adding a primitive,
> just using the FFI as in your example? You could use hooks for proper
> cross-platform behavior.
> 
> Dan
> 
> On Tue, Jun 24, 2008 at 1:59 AM, Phil Dawes <[EMAIL PROTECTED]> wrote:
>> 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
>>
> 
> -------------------------------------------------------------------------
> 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
> 



-------------------------------------------------------------------------
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