diff options
author | Jeremy Allison <jra@samba.org> | 2008-01-11 22:38:42 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-01-11 22:38:42 -0800 |
commit | 05fb367a014305f385a6db6653bd327861291563 (patch) | |
tree | 0c0613cccf22ed0cc92498ee0371b95db01f5c8c /source3/lib/talloc/testsuite.c | |
parent | 1d1b996f3879b87418bdde2fd1691ae2cca42cd4 (diff) | |
parent | 45db92cc72eb2472425c17e72ff9254d35d8047c (diff) | |
download | samba-05fb367a014305f385a6db6653bd327861291563.tar.gz samba-05fb367a014305f385a6db6653bd327861291563.tar.bz2 samba-05fb367a014305f385a6db6653bd327861291563.zip |
Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
(This used to be commit 08645826817d42c9d4b42ea0fd5e633d7fd08d35)
Diffstat (limited to 'source3/lib/talloc/testsuite.c')
-rw-r--r-- | source3/lib/talloc/testsuite.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/lib/talloc/testsuite.c b/source3/lib/talloc/testsuite.c index e16c91f8b9..fedbda95aa 100644 --- a/source3/lib/talloc/testsuite.c +++ b/source3/lib/talloc/testsuite.c @@ -813,6 +813,25 @@ static bool test_speed(void) talloc_free(ctx); + ctx = talloc_pool(NULL, 1024); + + tv = timeval_current(); + count = 0; + do { + void *p1, *p2, *p3; + for (i=0;i<loop;i++) { + p1 = talloc_size(ctx, loop % 100); + p2 = talloc_strdup(p1, "foo bar"); + p3 = talloc_size(p1, 300); + talloc_free_children(ctx); + } + count += 3 * loop; + } while (timeval_elapsed(&tv) < 5.0); + + talloc_free(ctx); + + fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/timeval_elapsed(&tv)); + tv = timeval_current(); count = 0; do { @@ -1066,6 +1085,23 @@ static bool test_autofree(void) return true; } +static bool test_pool(void) +{ + void *pool; + void *p1, *p2, *p3, *p4; + + pool = talloc_pool(NULL, 1024); + + p1 = talloc_size(pool, 80); + p2 = talloc_size(pool, 20); + p3 = talloc_size(p1, 50); + p4 = talloc_size(p3, 1000); + + talloc_free(pool); + + return true; +} + struct torture_context; bool torture_local_talloc(struct torture_context *tctx) { @@ -1094,6 +1130,7 @@ bool torture_local_talloc(struct torture_context *tctx) ret &= test_free_parent_deny_child(); ret &= test_talloc_ptrtype(); ret &= test_talloc_free_in_destructor(); + ret &= test_pool(); if (ret) { ret &= test_speed(); |