diff options
author | Evan Huus <eapache@gmail.com> | 2013-03-27 17:30:12 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-03-27 17:30:12 +0000 |
commit | ade9361071193f43516b19fb3947ca98f55cba9e (patch) | |
tree | 962b84289c36b7cce1c0d38f55dfc72e96f01258 /epan/wmem | |
parent | d935a280e35055222e49299c47ecabdd820c5462 (diff) |
Loop the timing test 128 times so that statistics work more in our favour.
Print the times to stdout so that in a failure case we can see how badly it
was off.
svn path=/trunk/; revision=48590
Diffstat (limited to 'epan/wmem')
-rw-r--r-- | epan/wmem/wmem_test.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/epan/wmem/wmem_test.c b/epan/wmem/wmem_test.c index 20604cdb0f..c3617818fa 100644 --- a/epan/wmem/wmem_test.c +++ b/epan/wmem/wmem_test.c @@ -23,6 +23,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <stdio.h> #include <glib.h> #include "wmem.h" #include "wmem_allocator.h" @@ -176,23 +177,25 @@ wmem_test_allocator(wmem_allocator_type_t type, wmem_verify_func verify) static void wmem_time_allocator(wmem_allocator_type_t type) { - int i; + int i, j; wmem_allocator_t *allocator; allocator = wmem_allocator_force_new(type); - for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { - wmem_alloc(allocator, 8); - } - wmem_free_all(allocator); + for (j=0; j<128; j++) { + for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { + wmem_alloc(allocator, 8); + } + wmem_free_all(allocator); - for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { - wmem_alloc(allocator, 256); - } - wmem_free_all(allocator); + for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { + wmem_alloc(allocator, 256); + } + wmem_free_all(allocator); - for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { - wmem_alloc(allocator, 1024); + for (i=0; i<MAX_SIMULTANEOUS_ALLOCS; i++) { + wmem_alloc(allocator, 1024); + } } wmem_destroy_allocator(allocator); @@ -211,6 +214,7 @@ wmem_time_allocators(void) wmem_time_allocator(WMEM_ALLOCATOR_BLOCK); block_time = g_test_timer_elapsed(); + printf("(simple: %lf; block: %lf)", simple_time, block_time); g_assert(simple_time > block_time); } |