Rusty Russell [Mon, 28 Oct 2013 11:20:58 +0000 (21:50 +1030)]
Merge branch 'master' of ozlabs.org:ccan
Ahmed Samy [Fri, 25 Oct 2013 14:02:10 +0000 (16:02 +0200)]
cpuid: Use __asm for MSVC
MSVC only supports inline assembly and does not support the keyword
volatile for assembly.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Wed, 23 Oct 2013 15:39:25 +0000 (17:39 +0200)]
cpuid: use a sprintf-like function to get cputype as a string
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Mon, 21 Oct 2013 11:45:19 +0000 (13:45 +0200)]
cpuid: avoid unions in parsing data
This is a much more cleaner way to do it and _should_ be easier for people
to use.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Mon, 21 Oct 2013 10:24:36 +0000 (12:24 +0200)]
cpuid: apply the 32-bit fix
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Rusty Russell [Mon, 21 Oct 2013 05:33:58 +0000 (16:03 +1030)]
io: add io_conn_fd()
Useful for getsockname().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 21 Oct 2013 05:10:02 +0000 (15:40 +1030)]
io: io_set_alloc()
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Wed, 16 Oct 2013 09:20:12 +0000 (19:50 +1030)]
ccan/io: make union more generic.
I really wanted an array of bytes in there, so make it more flexible.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Ahmed Samy [Mon, 14 Oct 2013 23:45:27 +0000 (01:45 +0200)]
Merge branch 'master' of ozlabs.org:ccan
Rusty Russell [Mon, 14 Oct 2013 11:03:51 +0000 (21:33 +1030)]
Merge branch 'io'
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: add examples.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: io_connect()
Not a perfect solution (we'd ideally want to go to another plan
immediately, but that would involve a malloc).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain further.
Don't call through io_loop, but have it pass the connection back
and call manually.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain.
Don't call from the plan-construction function, call after it returns.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: update and improve documentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: save errno on io_close, for finish functions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:02:58 +0000 (21:32 +1030)]
ccan/io: handle errors on poll()
Without this, closing an fd results in a spin...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:02:57 +0000 (21:32 +1030)]
ccan/io: io_close_cb()
Overloading io_close() as a callback is ugly: create an explicit
io_close_cb().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:01:18 +0000 (21:31 +1030)]
ccan/io: simplify I/O callbacks.
Use a -1 for error codes. This makes it easier to write your own io funcs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 11:01:16 +0000 (21:31 +1030)]
ccan/io: io_set_finish()
Rather than insisting on supplying them on every call to io_new_conn().
Also, this way it can be changed on a connection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: test custom io functions.
And rename debug_io_plan() to io_plan_debug() so it can be exposed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: go linear for debugging.
Debugging an async library is a pain: it's nice to force it into a
linear call chain to try to track problems.
Ugly code, though.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: test read after hangup.
In particular, make sure that idle connections don't get closed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: simplify do_ready.
Have it set the plan itself, rather than passing it back.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: make io functions more generic.
Pass fd and plan explicitly, so they don't need to know the definition
of struct io_conn, and return a bool instead of an enum.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: remove io_state.
Use a NULL next pointer instead to indicate a closing connection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: remove IO_IDLE state.
Use a NULL io pointer instead to indicate an idle connection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: remove IO_NEXT state.
It was only used for initial connections which hadn't started I/O. Now
they are initialized with an io_plan, it can be eliminated.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: initialize connection with an explicit I/O plan.
Rather than going via a callback, which tends to just set up I/O, do
any setup before the call to io_new_conn(), then pass it the io_plan
directly.
The patch shows how much this simplifies our test code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: generic init function for listening connections.
Instead of assuming they want a connection made from the new fd, hand
the fd to a callback.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: remove conn arg from io_plan constructors.
No longer needed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: pass struct io_plan explicitly.
This simplifies some things: in particular, we can construct an
io_plan without needing the current io_conn.
On the other hand, we need to expose the structure now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: replace backend_set_state with backend_wakeup()
We only use it in one place: for wakeup.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: make enum io_state namespace-safe.
Ready for exposure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: use explicit IO callback functions, instead of io_state values.
Explicit callbacks are slower, but more flexible.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: remove next & finish from union.
Sure, both listener and conn need them, but for different things
(listener uses them simply to set up conn). Putting them in the
common union was a mistake.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: put explicit poll flags in the plan.
Weaning off enum io_state, to allow custom ones.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: get rid of io_next(), pass callbacks directly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: rename io_op to io_plan.
This is a better description, since it's I/O we plan to do next.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: timer support.
Upgrade license, since timer is LGPL.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: check for all idle.
It's probably a bug if we're waiting for nothing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:58:20 +0000 (21:28 +1030)]
ccan/io: io_duplex.
Cleaner model for I/O, with cost of complexity if you really want bidir.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:04:35 +0000 (20:34 +1030)]
ccan/io: benchmarks.
More stress test than benchmarks, but provides a beginning.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 14 Oct 2013 10:04:07 +0000 (20:34 +1030)]
ccan/io: new module.
Designed for async I/O.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Ahmed Samy [Fri, 11 Oct 2013 11:10:07 +0000 (13:10 +0200)]
cpuid: minor fixes
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Fri, 11 Oct 2013 11:09:19 +0000 (13:09 +0200)]
cpuid: cache processor brand string
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Fri, 11 Oct 2013 11:08:48 +0000 (13:08 +0200)]
cpuid: remove the static func has_feature
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Fri, 11 Oct 2013 11:05:03 +0000 (13:05 +0200)]
cpuid: fix build on 64-bit systems
Some instructions needed to use their correct prefix and correct
registers, such as "eax -> rax" and "pushl -> pushq"
Reported-by: Emilio G. Cota <cota@braap.org>
Tested-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Rusty Russell [Wed, 2 Oct 2013 08:23:37 +0000 (17:53 +0930)]
net: add async operation helpers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Wed, 2 Oct 2013 08:23:26 +0000 (17:53 +0930)]
net: fix leak in test.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Wed, 2 Oct 2013 06:29:48 +0000 (15:59 +0930)]
opt: add allocator setting.
Good for tal usage.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Fri, 27 Sep 2013 18:41:59 +0000 (04:11 +0930)]
cpuid: ccanlint fixes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Fri, 27 Sep 2013 18:40:40 +0000 (04:10 +0930)]
Merge branch 'cpuid' of https://github.com/decltype/ccan
Ahmed Samy [Thu, 26 Sep 2013 14:13:12 +0000 (14:13 +0000)]
cpuid: parse CPU L1 cache and TLB identifications
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Thu, 26 Sep 2013 13:59:55 +0000 (13:59 +0000)]
cpuid: use uint32_t instead of int/unsigned
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Wed, 25 Sep 2013 16:44:20 +0000 (16:44 +0000)]
cpuid: small fix
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Wed, 25 Sep 2013 14:46:09 +0000 (14:46 +0000)]
cpuid: Minor improvements
Remove the assembly file that checks if the CPUID instruction is
supported and have it in inline assembly as suggested by Rusty.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
David Gibson [Mon, 23 Sep 2013 11:37:01 +0000 (21:37 +1000)]
net: Fix potential uninitialized use of variables in net_bind()
If the list of addrinfos give to net_bind() contains only IPv4 or only
IPv6 addresses, then the ipv4 and ipv6 variables may be used uninitialized.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Ahmed Samy [Mon, 23 Sep 2013 22:40:41 +0000 (22:40 +0000)]
cpuid: only compile source file if x86 cpu
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Mon, 23 Sep 2013 08:20:08 +0000 (08:20 +0000)]
cpuid: prefix every function with cpuid_
Also merge extended features and non-extended in 1 function.
Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Sun, 22 Sep 2013 07:42:15 +0000 (07:42 +0000)]
cpuid: add 2 new functions + some more tests
The new functions are:
- get_cpu_type
- get_cpu_type_string
Also add more tests on how one would parse the low-level stuff.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Sat, 21 Sep 2013 10:03:11 +0000 (10:03 +0000)]
cpuid: add proper documentation
Forgot to add this to the main commit, sorry.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ahmed Samy [Sat, 21 Sep 2013 09:45:06 +0000 (09:45 +0000)]
cpuid: new module
This module parses data provided by the cpuid instruction.
It still needs more work, however, it works for most important
stuff.
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Rusty Russell [Fri, 13 Sep 2013 00:08:40 +0000 (09:38 +0930)]
Merge branch 'master' of ozlabs.org:ccan
Rusty Russell [Fri, 13 Sep 2013 00:05:14 +0000 (09:35 +0930)]
Add bitmap module to Makefile.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Fri, 13 Sep 2013 00:01:17 +0000 (09:31 +0930)]
Merge https://github.com/dgibson/ccan
Emilio G. Cota [Thu, 12 Sep 2013 16:45:49 +0000 (12:45 -0400)]
heap: add example on empty heap check
Suggested-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Emilio G. Cota [Tue, 10 Sep 2013 00:32:19 +0000 (20:32 -0400)]
heap: new module
Signed-off-by: Emilio G. Cota <cota@braap.org>
Rusty Russell [Mon, 9 Sep 2013 07:23:38 +0000 (16:53 +0930)]
ilog: reformat so webpage doesn't get confused.
The extra spaces make my web formatter think they're literal text, which
looks weird.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 9 Sep 2013 07:21:14 +0000 (16:51 +0930)]
ilog: relicense to Public Domain.
I noted to Timothy in 2011:
I finally got around to implementing license checking in ccanlint,
and it shows that your public domain ccan/isaac module uses your LGPL
ccan/ilog module, which partially defeats the point.
You and I are the only ones who did anything significant to ilog; I'm
happy to relicense to PD or whatever else you want. Or leave it, in
which case I'll need to document it clearly.
He finally got back to me, and I sent him this patch, to which he replied:
Ack.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 8 Sep 2013 06:53:02 +0000 (16:23 +0930)]
tal: add tal_resizez for zero-padded expansion.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 8 Sep 2013 04:13:05 +0000 (13:43 +0930)]
endian: add documentation on endian typedefs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 8 Sep 2013 04:11:35 +0000 (13:41 +0930)]
short_types: update documentation on be32/le32 etc.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 8 Sep 2013 04:09:12 +0000 (13:39 +0930)]
endian/short_types: sparse support.
If you're doing endian work, sparse's bitwise annotation is extremely useful.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
David Gibson [Thu, 5 Sep 2013 14:37:14 +0000 (00:37 +1000)]
bitmap: Add helper macro to statically declare bitmaps
For use as direct locals, or when the size is a constant, inside
structure definitions.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
David Gibson [Thu, 5 Sep 2013 14:28:36 +0000 (00:28 +1000)]
bitmap: Rework to assume always multiple of words storage length
Handling bitmaps which extend some odd number of bits, and assuring they
don't clobber partially overlapped variables is not worth the bother.
Also avoid namespace pollution.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
David Gibson [Thu, 5 Sep 2013 12:40:19 +0000 (22:40 +1000)]
bitmap: Rework types and sizing macros
Go with "words" rather than explicitly referencing longs in the macros
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
David Gibson [Wed, 4 Sep 2013 14:16:47 +0000 (00:16 +1000)]
bitmap: Use a typesafe(ish) parameters instead of void *
This also fixes a bug which will hit on platforms where it's not safe to
dereference a (long *) which is not correctly aligned.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Rusty Russell [Thu, 29 Aug 2013 00:48:47 +0000 (10:18 +0930)]
list: add list_next and list_prev helpers.
Some way towards iterating in the middle of the list.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
David Gibson [Thu, 22 Aug 2013 12:39:02 +0000 (22:39 +1000)]
bitmap: Add first cut at a bitmap module
This adds a module for manipulating bitmaps, based on the API from the
Linux kernel's bitmap.h. So far it's missing the trickier bits, but is
a little more flexible, allowing bitmaps that don't have to be contained
in an integer number of unsigned longs.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Volker Lendecke [Thu, 11 Jul 2013 12:57:53 +0000 (14:57 +0200)]
ccan: Fix calling memset with zero length parameter
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Tue, 11 Jun 2013 05:10:49 +0000 (14:40 +0930)]
tal/path: fix unset vars in error paths.
Compiling with optimization FTW.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 27 May 2013 12:23:55 +0000 (21:53 +0930)]
breakpoint: new module.
Thanks to Jeremy Kerr for the idea!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 13 May 2013 06:52:53 +0000 (16:22 +0930)]
endian: remove unnecessary _CONST postfixes.
It makes the names longer, whereas the CAPS is probably sufficient.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 8 Apr 2013 07:08:24 +0000 (16:38 +0930)]
endian: add constant versions.
Sometimes you really need a compile-time constant, but there's no generic way
to create a macro which does this and only evaluates its argument once.
Thus we need specific const macros.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 8 Apr 2013 05:38:08 +0000 (15:08 +0930)]
endian: change license to CC0.
Not worth LGPL for just this header.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Fri, 5 Apr 2013 06:33:54 +0000 (17:03 +1030)]
timer: clean up.
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>
Rusty Russell [Fri, 5 Apr 2013 06:13:49 +0000 (16:43 +1030)]
timer: increase default span to 5.
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>
Rusty Russell [Fri, 5 Apr 2013 06:13:48 +0000 (16:43 +1030)]
timer: cache the minimal value.
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>
Rusty Russell [Fri, 5 Apr 2013 06:13:27 +0000 (16:43 +1030)]
timers: implementation of lazily-ordered timers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Thu, 4 Apr 2013 23:59:01 +0000 (10:29 +1030)]
Add Henry Eshbaugh's log module to junkcode for the moment.
It's got some useful stuff in it, but doesn't pass ccanlint here.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 1 Apr 2013 03:22:55 +0000 (13:52 +1030)]
Makefile: don't separate all modules with external dependencies.
Using ccanlint's --deps-fail-ignore, we can just test every module
with "make check". Still exclude them from the 'libccan.a' build
though.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 1 Apr 2013 03:22:35 +0000 (13:52 +1030)]
nfs: add licenses into generated files.
Otherwise ccanlint complains about missing license comments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 1 Apr 2013 02:44:00 +0000 (13:14 +1030)]
ccanlint: --deps-fail-ignore.
Useful for bulk testing modules, where some might not have required
external (non-CCAN) dependencies.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Mon, 1 Apr 2013 00:00:30 +0000 (10:30 +1030)]
ogg_to_pcm: fix compilation of example in _info.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 31 Mar 2013 06:40:50 +0000 (17:10 +1030)]
ccanlint: don't crash if given bad directory name.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Peter Hutterer [Wed, 27 Mar 2013 23:38:48 +0000 (09:38 +1000)]
Add a set of simple version comparison helpers
These version helpers help to compare major.minor style version numbers,
without the need for open-coded and error-prone bitshifting, multiplication,
and similar.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 17 Mar 2013 04:48:10 +0000 (15:18 +1030)]
net: add server support.
Creating a server for IPv4 and IPv6 has similar issues to clients,
with some novel twists. Slightly different arguments need to be given
to getaddrinfo(), but worse, some platforms (Linux without
/proc/sys/net/ipv6/bindv6only set) automatically bind IPv6 sockets to IPv4
ports as well.
Thus we need a function which can bind (and listen) to one or two fds.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 17 Mar 2013 04:42:14 +0000 (15:12 +1030)]
list: list_pop
list_top + list_del, as suggested by Ben Herrenschmidt.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Sun, 17 Mar 2013 04:41:48 +0000 (15:11 +1030)]
list: list_append_list / list_prepend_list
Operations for moving the entire contents of a list.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>