[squeak-dev] primMicrosecondClock?

Yoshiki Ohshima yoshiki at vpri.org
Fri Jan 7 06:01:10 UTC 2011


At Thu, 6 Jan 2011 16:48:11 -0800,
Eliot Miranda wrote:
> 
> On Thu, Jan 6, 2011 at 2:58 PM, Yoshiki Ohshima <yoshiki at vpri.org> wrote:
> 
>     Hello,
>    
>     I'm looking at primMicrosecondClock on Windows with 4.1.1 VM and Cog
>     2341 just to profile parts of my code (so when is the epoch, and
>     etc. does not matter here).
>    
>     I code snippet like this:
>    
>     | t |
>     t := Time primMicrosecondClock.
>     (Delay forSeconds: 1) wait.
>     Time primMicrosecondClock - t
>    
>     and I get "1001" or "1000" on 4.1.1 and "0" on Cog... Where does it
>     stand?
> 
> Cog supports a 64-bit microsecond clock, epoch 1st Jan 1901. Primitive 240 is utcMicrosecondsFrom1901, 241 is
> localMicrosecondsFrom1901. Cog doesn't support the 32-bit microsecond clock in the standard VM, because a clock that
> wraps in at most 11 hours makes no sense to me, whereas a single clock that'll serve for high-resolution and won't wrap
> for a few thousand years does. Hopefully we'll harmonise on the
> 64-bit clock.

  Ah ok, for measuring period of time, I thought I could use it.  The
actual thing I'm trying to measure (instead of Delay in the code
above) is a primitive that runs hundreds of milliseconds to a few
milliseconds but does not do any allocation; since sends/sec number
can be north of 10s of millions, I thought I might get reasonable
estimate of how long the primtive runs.

  But I can just repeat the primitive...

-- Yoshiki



More information about the Squeak-dev mailing list