Created
May 20, 2011 00:55
-
-
Save amtal/982122 to your computer and use it in GitHub Desktop.
Playing with now()'s clock skew effect at high call rates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(now_skew). | |
-compile(export_all). | |
go() -> | |
A = os:timestamp(), | |
NA = now(), | |
Master = self(), | |
spawn(fun()->loop(1000000), Master!done end), | |
%spawn(fun()->loop(500000), Master!done end), | |
receive done->ok end, | |
%receive done->ok end, | |
B = os:timestamp(), | |
NB = now(), | |
DeltaNow = timer:now_diff(NB,NA), | |
DeltaOS = timer:now_diff(B,A), | |
[{now,DeltaNow}, {os,DeltaOS}, {diff,DeltaNow-DeltaOS} | |
,{skew,DeltaNow/DeltaOS}]. | |
loop(0) -> done; | |
loop(N) -> now(), loop(N-1). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment