aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/timer.erl
AgeCommit message (Collapse)Author
2013-05-06Fix unmatched_returns warnings in STDLIB and KernelHans Bolinder
2013-04-19fix excessive CPU consumption of timer_serverAliaksey Kandratsenka
I've found stdlib's timer to burn CPU without good reason. Here's what happens. The problem is that it sleeps in milliseconds but computes time in microseconds. And there is bug in code to compute milliseconds to sleep. It computes microseconds difference between now and nearest timer event and then does _truncating_ division by 1000. So on average it sleeps 500 microseconds _less than needed_. On wakeup its checks do I have timer tick that already occurred? No. Ok how much I need to sleep ? It does that bad computation again and gets 0 milliseconds. So next gen_server timeout happens right away only to find we're still before closest timer tick and to decide to sleep 0 milliseconds again. And again and again. This commit changes division to pick ceiling of ratio rather than floor. So that we always sleep not less then difference between now and closest event time.
2011-08-15Correct the contract of timer:now_diff/2Hans Bolinder
The contract of timer:now_diff() has been corrected. (Thanks to Alex Morarash).
2011-06-20Add more specs and typesHans Bolinder
An incorrect spec, rpc:yield/1, has been fixed.
2011-05-12Types and specifications have been modified and addedHans Bolinder
2010-09-24Export opaque types so as to be used by other modulesKostis Sagonas
2010-07-07Merge branch 'cf/timer_tc' into devRaimo Niskanen
* cf/timer_tc: Add timer:tc/2 to measure the elapsed time of anonymous functions Conflicts: lib/stdlib/doc/src/timer.xml
2010-05-12timer: Update specs and apply tidier cleanupsKostis Sagonas
2010-04-09Add timer:tc/2 to measure the elapsed time of anonymous functionsChristopher Faulet
Works like timer:tc/3 but for anonymous functions.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP