]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/common.h
Remember size of the input file.
[libucw.git] / lib / sorter / common.h
index 99bc6a5f7e68497bfac047bdfddc010ecbcab6ef..5e71be66e0f18cfb316660237f411ee01b26bb9a 100644 (file)
@@ -18,7 +18,7 @@ extern uns sorter_debug;
 extern u64 sorter_bufsize;
 
 #define SORT_TRACE(x...) do { if (sorter_trace) log(L_DEBUG, x); } while(0)
-#define SORT_XTRACE(x...) do { if (sorter_trace > 1) log(L_DEBUG, x); } while(0)
+#define SORT_XTRACE(level, x...) do { if (sorter_trace >= level) log(L_DEBUG, x); } while(0)
 
 enum sort_debug {
   SORT_DEBUG_NO_PRESORT = 1,
@@ -32,6 +32,7 @@ struct sort_context {
   struct fastbuf *in_fb;
   struct fastbuf *out_fb;
   uns hash_bits;
+  u64 in_size;
 
   struct mempool *pool;
   clist bucket_list;
@@ -92,4 +93,8 @@ 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