diff options
author | N.N. <matju@users.sourceforge.net> | 2009-11-06 18:33:57 +0000 |
---|---|---|
committer | N.N. <matju@users.sourceforge.net> | 2009-11-06 18:33:57 +0000 |
commit | 5e6bb4f4786dd39158ffe02913590cc3dea21ebd (patch) | |
tree | 17f4c83372dc450503e3106db11c473c513ab7c0 /externals/gridflow/tests/malloc-test.c | |
parent | b4432042844d0a29f7b654245f9c17da950cd33e (diff) |
remove gridflow 0.9.5
svn path=/trunk/; revision=12727
Diffstat (limited to 'externals/gridflow/tests/malloc-test.c')
-rw-r--r-- | externals/gridflow/tests/malloc-test.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/externals/gridflow/tests/malloc-test.c b/externals/gridflow/tests/malloc-test.c deleted file mode 100644 index d5445dcc..00000000 --- a/externals/gridflow/tests/malloc-test.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <stdlib.h> -#include <time.h> -#include <sys/time.h> -#include <stdio.h> - -typedef long long uint64; - -uint64 gf_timeofday () { - timeval t; - gettimeofday(&t,0); - return t.tv_sec*1000000+t.tv_usec; -} -static void test1 (size_t n) { - uint64 t = gf_timeofday(); - for (int i=0; i<10000; i++) free(malloc(n)); - t = gf_timeofday() - t; - printf("10000 mallocs of %7ld bytes takes %7ld us (%f us/malloc)\n",n,(long)t,t/(float)10000); -} -static void test2 (size_t n) { - uint64 t = gf_timeofday(); - // the real calloc is lazy, let's try a manual (strict) calloc - //for (int i=0; i<10000; i++) free(calloc(1,n)); - for (int i=0; i<10000; i++) { - long *p = (long *)malloc(n); - size_t nn=n/sizeof(long); - for (size_t j=0; j<nn; j++) p[j] = 0; - free(p); - } - t = gf_timeofday() - t; - printf("10000 callocs of %7ld bytes takes %7ld us (%f us/calloc)\n",n,(long)t,t/(float)10000); -} -int main () { - for (int i=0; i<20; i++) {test1(4<<i); test2(4<<i);} - //for (int i=0; i<20; i++) test1(4096*(32+i)); - return 0; -} |