1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

40 Commits

Author SHA1 Message Date
Rusty Russell
18cd3dd2ad lib/ccan/htable: benchmark against hsearch(3)
Since that has a fixed hash table size and doesn't support delete, we can't
do a thorough comparison, but we can insert and search.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 95757f0e9d979e7c653e9b53bb640deb4f0ea1f9)
2011-12-05 16:42:49 +10:30
Rusty Russell
5917d97991 lib/ccan/likely: use htable_type
Also general cleanups:
(1) Don't assume that strings are folded by the compiler.
(2) Implement likely_stats_reset().
(3) Return non-const string from likely_stats(), as caller must free it.
(4) Don't use struct info indirection (that was from when we used callbacks?)
(5) Close memory leak in run-debug.c

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0e5d0e30b30bb07b6605843e5ff224210d8083d8)
2011-12-05 16:42:48 +10:30
Rusty Russell
e137404967 lib/ccan/htable: HTABLE_INITIALIZER() for static initialization.
Unfortunately it's a bit of a pain to use for typed hashtables, but it
works.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 60cc720d0797fc49325437ea36a9ffd909c75ed0)
2011-12-05 16:42:48 +10:30
Rusty Russell
0ac7deefbf lib/ccan/htable: clean up interface, document htable_type better.
We change from htable_new()/htable_free() to htable_init/htable_clear.
We also change HTABLE_DEFINE_TYPE() to be the full name, without automatically
prepending htable_.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0c3590dc33d644f73bb8587db454c491830aaf26)
2011-12-05 16:42:47 +10:30
Rusty Russell
19409ddaf2 lib/ccan/htable: start empty.
There's no real reason to start with 128 entries.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 45f24da35118db441e6153f02f6ddd937da1fa1c)
2011-12-05 16:42:47 +10:30
Rusty Russell
1beb793664 lib/ccan/htable, strset: benchmarking tools.
This lets us compare hash table vs. strset vs. the example
implementation of critbit trees.

cbspeed 100 runs, min-max(avg):
#01: Initial insert:   236-245(237)
#02: Initial lookup (match):   180-186(180)
#03: Initial lookup (miss):   171-185(172)
#04: Initial lookup (random):   441-457(444)
#05: Initial delete all:   127-132(128)
#06: Initial re-inserting:   219-225(220)
#07: Deleting first half:   101-104(102)
#08: Adding (a different) half:   158-162(159)
#09: Lookup after half-change (match):   202-207(203)
#10: Lookup after half-change (miss):   217-222(218)
#11: Churn 1:   297-302(299)
#12: Churn 2:   297-305(300)
#13: Churn 3:   301-308(303)
#14: Post-Churn lookup (match):   189-195(190)
#15: Post-Churn lookup (miss):   189-193(190)
#16: Post-Churn lookup (random):   499-513(503)

speed 100 runs, min-max(avg):
#01: Initial insert:   211-218(212)
#02: Initial lookup (match):   161-166(162)
#03: Initial lookup (miss):   157-162(158)
#04: Initial lookup (random):   452-460(454)
#05: Initial delete all:   126-135(127)
#06: Initial re-inserting:   193-201(194)
#07: Deleting first half:   99-107(99)
#08: Adding (a different) half:   143-190(144)
#09: Lookup after half-change (match):   183-195(184)
#10: Lookup after half-change (miss):   197-203(198)
#11: Churn 1:   271-278(274)
#12: Churn 2:   280-287(282)
#13: Churn 3:   277-285(279)
#14: Post-Churn lookup (match):   171-175(171)
#15: Post-Churn lookup (miss):   174-178(175)
#16: Post-Churn lookup (random):   525-552(528)

stringspeed 100 runs, min-max(avg):
#01: Initial insert:   300-343(308)
#02: Initial lookup (match):   98-136(99)
#03: Initial lookup (miss):   73-102(75)
#04: Initial lookup (random):   230-282(233)
#05: Initial delete all:   66-102(69)
#06: Initial re-inserting:   62-99(64)
#07: Deleting first half:   43-52(43)
#08: Adding (a different) half:   101-156(106)
#09: Lookup after half-change (match):   114-156(120)
#10: Lookup after half-change (miss):   94-103(95)
#11: Churn 1:   98-105(99)
#12: Churn 2:   96-104(98)
#13: Churn 3:   174-184(176)
#14: Post-Churn lookup (match):   93-112(94)
#15: Post-Churn lookup (miss):   77-107(79)
#16: Post-Churn lookup (random):   229-265(232)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 5c559e7df1d31b4c0ddf26451fac972dc8a0c2c9)
2011-12-05 16:42:46 +10:30
Rusty Russell
00b226bfe4 lib/ccan/str: fix warnings.
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0845e79650c9257aa0ddef8ff99fd815b5edffac)
2011-12-05 16:42:46 +10:30
Rusty Russell
ed349eabd9 lib/ccan/str: relicense to public domain.
LGPL is overkill for trivial wrappers like this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 942f2788e165bb203b0f160f29bd4592f32dc344)
2011-12-05 16:42:45 +10:30
Rusty Russell
4e377c28a9 lib/ccan/typesafe_cb: fix example macro ordering in typesafe_cb_preargs documentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 12652625db55f6586e95fc5edc73e1e85bae8a5c)
2011-12-05 16:42:45 +10:30
Rusty Russell
a0bff7d062 lib/ccan/htable: fix tools/speed.
As pointed out by Christian Thaeter, it has bitrotted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit f725bbb1987284933e0f21dfb8f2ce7a1f0806e5)
2011-12-05 16:42:44 +10:30
Joey Adams
11c90462cd lib/ccan/build_assert: Remove stale LGPL license comment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d3d4303acd139e8c34f11067333c000a3f885307)
2011-12-05 16:42:43 +10:30
Rusty Russell
bc318580e4 lib/ccan/array_size: relicense under public domain.
It's just a header, I don't care what's done with it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d06b67d244657da7054e3da580a771c365566d3c)
2011-12-05 16:42:40 +10:30
Rusty Russell
abb437c0ab ccan: configure check for HAVE_BUILTIN_CHOOSE_EXPR
We weren't testing for this, and without it, typesafe_cb just casts
its function argument.  This is why I didn't get a warning when one of
my patches amended a function incorrectly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:05:13 +09:30
Rusty Russell
b88e0c40b7 ccan: fix likely redefinition warnings with --enable-tdb2
When we do --enable-tdb2, we start clashing with the replace.h
version:

In file included from ../lib/tdb2/tools/../private.h:25:0,
                 from ../lib/tdb2/tools/tdb2torture.c:60:
../lib/ccan/likely/likely.h:32:0: warning: "likely" redefined
../lib/replace/replace.h:762:0: note: this is the location of the previous definition
../lib/ccan/likely/likely.h:53:0: warning: "unlikely" redefined
../lib/replace/replace.h:765:0: note: this is the location of the previous definition

I don't like to #ifndef-protect them in general, since you don't want
different parts of the code to silently have different definitions,
but it's the simplest fix for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-08-31 13:57:14 +09:30
Volker Lendecke
f7b820c359 Adapt tally_histogram to Samba coding conventions
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Aug 10 21:12:59 CEST 2011 on sn-devel-104
2011-08-10 21:12:59 +02:00
Volker Lendecke
fed9775140 Adapt get_max_bucket to Samba coding conventions 2011-08-10 19:56:12 +02:00
Volker Lendecke
35550ba641 Adapt tally_approx_median to Samba coding conventions 2011-08-10 19:56:12 +02:00
Volker Lendecke
eac2f44cde Adapt bucket_range to Samba coding conventions 2011-08-10 19:56:12 +02:00
Volker Lendecke
06a4159455 Adapt tally_mean to Samba coding conventions 2011-08-10 19:56:12 +02:00
Volker Lendecke
f589af1982 Adapt divls64 to Samba coding conventions 2011-08-10 19:56:11 +02:00
Volker Lendecke
b32f086d64 Avoid some // style comments in divls64 2011-08-10 19:56:11 +02:00
Volker Lendecke
ee91004f4b Adapt divlu64 to Samba coding conventions 2011-08-10 19:56:11 +02:00
Volker Lendecke
26795b3dd1 Avoid some // style comments in divlu64 2011-08-10 19:56:11 +02:00
Volker Lendecke
73414d0ee7 Adapt fls64 to Samba coding conventions 2011-08-10 19:56:11 +02:00
Volker Lendecke
3f67063dfa Adapt tally_num to Samba coding conventions 2011-08-10 19:56:11 +02:00
Volker Lendecke
9c32c86783 Adapt tally_add to Samba coding conventions 2011-08-10 19:56:11 +02:00
Volker Lendecke
1fa4236c40 Adapt renormalize to Samba coding conventions 2011-08-10 19:56:10 +02:00
Volker Lendecke
4a3913fbb9 Adapt shift_overflows to Samba coding conventions 2011-08-10 19:56:10 +02:00
Volker Lendecke
a2d1d0b514 Adapt bucket_min to Samba coding conventions 2011-08-10 19:56:10 +02:00
Volker Lendecke
68d0843437 Adapt bucket_of to Samba coding conventions 2011-08-10 19:56:10 +02:00
Volker Lendecke
c6ae297d61 Adapt tally_new to Samba coding conventions 2011-08-10 19:56:10 +02:00
Volker Lendecke
066d36a1a6 Slightly simplify tally_new 2011-08-10 19:56:10 +02:00
Volker Lendecke
cb5c6f441f Fix a c++ warning 2011-08-10 19:56:09 +02:00
Volker Lendecke
54282e9f4e Fix a c++ warning 2011-08-10 19:56:09 +02:00
Rusty Russell
6e72370fd7 lib/ccan: update to init-1192-gdd04041
This imports licensing clarifications and updates as discussed on
samba-technical ("Subject: Re: ccan code breaks older build farm
systems").

In particular, the recent version have per-file license markers, and
some modules are relicenced more liberally: in particular Simo pointed
out that htable was GPL, and indirectly included by libtdb2, which
would have made that GPL as well.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Mon Jul 25 12:03:40 CEST 2011 on sn-devel-104
2011-07-25 12:03:40 +02:00
Rusty Russell
91bc5a0d75 lib/ccan: add README
README points out that these code snippets have their own licenses,
and that their home is elsewhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-07-25 18:07:11 +09:30
Rusty Russell
c019302e65 ccan/tally: don't use SIZE_MAX.
Michael Adam points out this broke the build farm (ie. OSF1 axp V5.1 2650 alpha)
so fixed in CCAN and imported from af7a902d74a7926693f55da9e21a67dde46931d4:

    Turns out it's not standard (thanks Samba build farm!)
    And the previous test had a hole in it anyway.  This one is more conservative.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Wed Jul  6 08:34:05 CEST 2011 on sn-devel-104
2011-07-06 08:34:05 +02:00
Rusty Russell
4e63ac6191 ccan: fix configure tests for __builtin_clz etc.
It's not enough to compile-test them: Michael Adam points out that nonexistant
functions merely cause a warning.  We have to try to link them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Jul  5 07:08:55 CEST 2011 on sn-devel-104
2011-07-05 07:08:55 +02:00
Rusty Russell
894b0273fc lib/ccan/tally.h: update for FreeBSD compile.
Based on commit 0284423676209380a2e07086b9b356096a2f93e6 from CCAN:
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Tue Jun 21 10:43:31 2011 +0930

    tally: fix FreeBSD compile, memleak in tests.

    Posix says ssize_t is in sys/types.h; on Linux stdlib.h is enough.

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Jun 21 05:52:12 CEST 2011 on sn-devel-104
2011-06-21 05:52:12 +02:00
Rusty Russell
754c677b0b lib: import ccan modules for tdb2
Imported from git://git.ozlabs.org/~ccan/ccan init-1161-g661d41f

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:34 +02:00