X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsorter%2Fsort-test.c;h=524a4cdc763da9d2608cf497436b626af19699d5;hb=8c8736b23823acce9df684b85c6320cc36e43f76;hp=bc6ef60871ed1a10fe8d2bf53ab8767b19d0e5e1;hpb=fdf07fb99f6fa420946e71c92bf89287d8647761;p=libucw.git diff --git a/lib/sorter/sort-test.c b/lib/sorter/sort-test.c index bc6ef608..524a4cdc 100644 --- a/lib/sorter/sort-test.c +++ b/lib/sorter/sort-test.c @@ -11,6 +11,7 @@ #include "lib/getopt.h" #include "lib/conf.h" #include "lib/fastbuf.h" +#include "lib/ff-binary.h" #include "lib/hashfunc.h" #include "lib/md5.h" @@ -18,19 +19,24 @@ #include #include #include +#include /*** Time measurement ***/ +static timestamp_t timer; + static void start(void) { - init_timer(); + sync(); + init_timer(&timer); } static void stop(void) { - log(L_INFO, "Test took %.3fs", get_timer() / 1000.); + sync(); + log(L_INFO, "Test took %.3fs", get_timer(&timer) / 1000.); } /*** Simple 4-byte integer keys ***/ @@ -53,7 +59,7 @@ test_int(int mode, u64 size) { uns N = size ? nextprime(MIN(size/4, 0xffff0000)) : 0; uns K = N/4*3; - log(L_INFO, ">>> Integers (%s, N=%d)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N); + log(L_INFO, ">>> Integers (%s, N=%u)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N); struct fastbuf *f = bopen_tmp(65536); for (uns i=0; i>> Counted integers (%s, N=%d, mult=%d)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N, mult); + log(L_INFO, ">>> Counted integers (%s, N=%u, mult=%u)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N, mult); struct fastbuf *f = bopen_tmp(65536); for (uns m=0; m>> Hashes (%s, N=%d)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N); + log(L_INFO, ">>> Hashes (%s, N=%u)", ((char *[]) { "increasing", "decreasing", "random" })[mode], N); struct key3 k, lastk; struct fastbuf *f = bopen_tmp(65536); @@ -323,7 +329,7 @@ test_strings(uns mode, u64 size) { uns avg_item_size = KEY4_MAX/2 + 4 + (mode ? 128 : 0); uns N = MIN(size / avg_item_size, 0xffffffff); - log(L_INFO, ">>> Strings %s(N=%d)", (mode ? "with data " : ""), N); + log(L_INFO, ">>> Strings %s(N=%u)", (mode ? "with data " : ""), N); srand(1); struct key4 k, lastk; @@ -407,7 +413,6 @@ static int s5_gen(struct s5_pair *p) static void s5_write_merged(struct fastbuf *f, struct key5 **keys, void **data, uns n, void *buf) { - /* FIXME: Allow mode where this function is not defined? */ u32 *a = buf; uns m = 0; for (uns i=0; i>> Graph%s (N=%d)", (mode ? "" : " with custom presorting"), N); + log(L_INFO, ">>> Graph%s (N=%u)", (mode ? "" : " with custom presorting"), N); s5_N = N; s5_K = N/4*3; s5_L = N/3*2;