summaryrefslogtreecommitdiff
path: root/ccan/timer
AgeCommit message (Collapse)Author
2015-05-20timer: simple optimization for large number of timers.Rusty Russell
This is still pretty stupid, but greatly reduces my routing-sim time. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-20timer: brute force corruption fix.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-20timer: put level-0 optimization directly into find_first.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-19timer: fix two corruption bugs.Rusty Russell
We fill the upper buckets after we've moved on from the first bucket in this layer. This means two things: 1) If we have to look at an upper layer, we need to look at the next bucket, unless offset is 0. 2) We need to keep looking up layers in the corner case, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-19timer: better dump code.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-19timer: fix timer_check() to iterate all levels.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-10-31timer: make timer_del() idempotent, add timer_init().Rusty Russell
This catches duplicate timer_add() calls, as well as meaning we don't need to track if the timer is active before calling timer_del(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-10-31timer: change timers_expire() to return a single timer.Rusty Russell
The linked list method was problematic, especially if timers delete other expired timers (eg. the next one in the expired list: the timer_del will delete it from expired, but that's a bit unexpected). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-06-16ccan: Correct some poor conventions in _info includesDavid Gibson
There are a couple of small problems with the includes used in most of ccan's _info files. * _info routinely uses printf(), and so should include <stdio.h>, but only some of them do. We get away with it, because they do include <string.h>, which apparently includes <stdio.h> indirectly, but we should be explicit about it. * Most _info files were including config.h after the system headers. That _seems_ sensible, but actually causes problems. Because config.h defines _GNU_SOURCE it can change the behaviour of the system headers. More specifically it can make them behave differently to how the individual module headers (which have included config.h) expects them to behave. This patch adjusts all the existing _info files and, more importantly, the template constructed by ccanlint. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-06-10io failtest timer tools: fallout from time changes.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-12-12timer: fix abortstring on 64 bit platforms.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-04-05timer: clean up.Rusty Russell
Add examples and a documentation fix. Remove unused cascade function (was used in initial always-step-1-bucket version). Restore timers_dump() to within CCAN_TIMER_DEBUG. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-04-05timer: increase default span to 5.Rusty Russell
There's a sweet spot around 5, without going all the way to 13 (which would make each level 64/128k large). TIMER_LEVEL_BITS 2: 100000000 in 5.833399-5.884659(5.85912+/-0.015) (18 levels / 32) TIMER_LEVEL_BITS 3: 100000000 in 5.267610-5.303589(5.29018+/-0.011) (12-13(12.5+/-0.5) levels / 22) TIMER_LEVEL_BITS 4: 100000000 in 4.215605-4.417297(4.27771+/-0.062) (9-10(9.1+/-0.3) levels / 16) TIMER_LEVEL_BITS 5: 100000000 in 3.859340-3.972603(3.90149+/-0.034) (7-8(7.1+/-0.3) levels / 13) TIMER_LEVEL_BITS 6: 100000000 in 3.976157-4.037230(4.00199+/-0.02) (6 levels / 11) TIMER_LEVEL_BITS 7: 100000000 in 4.014228-4.082031(4.05024+/-0.022) (5-6(5.4+/-0.49) levels / 10) TIMER_LEVEL_BITS 8: 100000000 in 3.915615-3.978781(3.94972+/-0.02) (5 levels / 8) TIMER_LEVEL_BITS 9: 100000000 in 3.859413-4.025842(3.89993+/-0.046) (4-5(4.6+/-0.49) levels / 8) TIMER_LEVEL_BITS 10: 100000000 in 3.983507-4.170152(4.06743+/-0.055) (4 levels / 7) TIMER_LEVEL_BITS 11: 100000000 in 3.468756-3.610746(3.52843+/-0.04) (4 levels / 6) TIMER_LEVEL_BITS 12: 100000000 in 3.274397-3.377530(3.3192+/-0.026) (4 levels / 6) TIMER_LEVEL_BITS 13: 100000000 in 3.116845-3.178162(3.1398+/-0.017) (3 levels / 5) TIMER_LEVEL_BITS 14: 100000000 in 3.152599-3.264060(3.20733+/-0.043) (3 levels / 5) TIMER_LEVEL_BITS 15: 100000000 in 3.186556-3.552432(3.25597+/-0.11) (3 levels / 5) TIMER_LEVEL_BITS 16: 100000000 in 3.139352-3.485653(3.27263+/-0.11) (3 levels / 4) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-04-05timer: cache the minimal value.Rusty Russell
We spend a lot of time searching for the next timer to expire: by caching the minimum, we can skip most of this work. Even if timers are deleted, the minimum will be a starting point for searching. The expected-usage benchmark has to be increased by a factor of 100, otherwise it's now too short. Before: $ ./expected-usage 1000000 in 12.701647935 After: $ ./expected-usage 1000000 1000000 in 0.061095153 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-04-05timers: implementation of lazily-ordered timers.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>