primMicrosecondClock?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

primMicrosecondClock?

Yoshiki Ohshima-2
  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?

  Searching in the email archive, it appears that it "works" on Unix
VM.  Is it reliably working?  How about Mac?

-- Yoshiki

Reply | Threaded
Open this post in threaded view
|

Re: primMicrosecondClock?

johnmci
Well I had to go back and find my note January 17, 2010 3:57:10 PM PST
        microsecond timing for GC work
on
Squeak Virtual Machine Development Discussion <[hidden email]>

There was lots of discussion, solutions and  well up to the maintainers to provide or not provide the api.

Seems to work on a 5.8b11 mac cog vm, but since it's window dressing on top of the vm, it's hard to know
if it's compiled into the vm you have (well other than see it returns 0).

On 2011-01-06, at 2:58 PM, Yoshiki Ohshima 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?
>
>  Searching in the email archive, it appears that it "works" on Unix
> VM.  Is it reliably working?  How about Mac?
>
> -- Yoshiki
>

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





Reply | Threaded
Open this post in threaded view
|

Re: primMicrosecondClock?

Eliot Miranda-2
In reply to this post by Yoshiki Ohshima-2
Hi Yoshiki,

On Thu, Jan 6, 2011 at 2:58 PM, Yoshiki Ohshima <[hidden email]> 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.


 Searching in the email archive, it appears that it "works" on Unix
VM.  Is it reliably working?  How about Mac?

-- Yoshiki




Reply | Threaded
Open this post in threaded view
|

Re: primMicrosecondClock?

Yoshiki Ohshima-2
At Thu, 6 Jan 2011 16:48:11 -0800,
Eliot Miranda wrote:

>
> On Thu, Jan 6, 2011 at 2:58 PM, Yoshiki Ohshima <[hidden email]> 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