]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/common.h
Added a couple of tests with the old sorter to have reference for speed benchmarks.
[libucw.git] / lib / sorter / common.h
index 5e71be66e0f18cfb316660237f411ee01b26bb9a..3097ea2de2cdf267a75f63ec13264d573ff18cc9 100644 (file)
@@ -24,6 +24,7 @@ enum sort_debug {
   SORT_DEBUG_NO_PRESORT = 1,
   SORT_DEBUG_NO_JOIN = 2,
   SORT_DEBUG_KEEP_BUCKETS = 4,
   SORT_DEBUG_NO_PRESORT = 1,
   SORT_DEBUG_NO_JOIN = 2,
   SORT_DEBUG_KEEP_BUCKETS = 4,
+  SORT_DEBUG_NO_RADIX = 8,
 };
 
 struct sort_bucket;
 };
 
 struct sort_bucket;
@@ -46,10 +47,15 @@ struct sort_context {
   // Two-way split/merge: merge up to 2 source buckets to up to 2 destination buckets.
   // Bucket arrays are NULL-terminated.
   void (*twoway_merge)(struct sort_context *ctx, struct sort_bucket **ins, struct sort_bucket **outs);
   // Two-way split/merge: merge up to 2 source buckets to up to 2 destination buckets.
   // Bucket arrays are NULL-terminated.
   void (*twoway_merge)(struct sort_context *ctx, struct sort_bucket **ins, struct sort_bucket **outs);
+  // Radix split according to hash function
+  void (*radix_split)(struct sort_context *ctx, struct sort_bucket *in, struct sort_bucket **outs, uns bitpos, uns numbits);
 
   // State variables of internal_sort
   void *key_buf;
   int more_keys;
 
   // State variables of internal_sort
   void *key_buf;
   int more_keys;
+
+  // Timing
+  u64 start_time;
 };
 
 void sorter_run(struct sort_context *ctx);
 };
 
 void sorter_run(struct sort_context *ctx);
@@ -92,9 +98,6 @@ sh_off_t sbuck_size(struct sort_bucket *b);
 struct fastbuf *sbuck_read(struct sort_bucket *b);
 struct fastbuf *sbuck_write(struct sort_bucket *b);
 void sbuck_swap_out(struct sort_bucket *b);
 struct fastbuf *sbuck_read(struct sort_bucket *b);
 struct fastbuf *sbuck_write(struct sort_bucket *b);
 void sbuck_swap_out(struct sort_bucket *b);
-
-#define F_SIZE(x) ({ byte buf[16]; format_size(buf, x); buf; })
-#define F_BSIZE(b) F_SIZE(sbuck_size(b))
 void format_size(byte *buf, u64 x);
 
 #endif
 void format_size(byte *buf, u64 x);
 
 #endif