]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/sort-test.c
Completely rewritten buffer management of the sorter.
[libucw.git] / lib / sorter / sort-test.c
index 5464f744fd1eb226d2af7df4a82d8b43805021fb..3990254d27bab7f699976fd623c13a7461bfc25e 100644 (file)
@@ -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"
 
 
 /*** Time measurement ***/
 
+static timestamp_t timer;
+
 static void
 start(void)
 {
   sync();
-  init_timer();
+  init_timer(&timer);
 }
 
 static void
 stop(void)
 {
   sync();
-  log(L_INFO, "Test took %.3fs", get_timer() / 1000.);
+  log(L_INFO, "Test took %.3fs", get_timer(&timer) / 1000.);
 }
 
 /*** Simple 4-byte integer keys ***/
@@ -48,6 +51,7 @@ struct key1 {
 #define SORT_OUTPUT_FB
 #define SORT_UNIQUE
 #define SORT_INT(k) (k).x
+#define SORT_DELETE_INPUT 0
 
 #include "lib/sorter/sorter.h"
 
@@ -410,7 +414,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<n; i++)
@@ -492,6 +495,7 @@ static int s5_presort(struct fastbuf *dest, void *buf, size_t bufsize)
 #define SORT_PREFIX(x) s5_##x
 #define SORT_DATA_SIZE(k) (4*(k).cnt)
 #define SORT_UNIFY
+#define SORT_UNIFY_WORKSPACE(k) SORT_DATA_SIZE(k)
 #define SORT_INPUT_PRESORT
 #define SORT_OUTPUT_THIS_FB
 #define SORT_INT(k) (k).x
@@ -502,6 +506,7 @@ static int s5_presort(struct fastbuf *dest, void *buf, size_t bufsize)
 #define SORT_PREFIX(x) s5b_##x
 #define SORT_DATA_SIZE(k) (4*(k).cnt)
 #define SORT_UNIFY
+#define SORT_UNIFY_WORKSPACE(k) SORT_DATA_SIZE(k)
 #define SORT_INPUT_FB
 #define SORT_OUTPUT_THIS_FB
 #define SORT_INT(k) (k).x