]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/sbuck.c
Added a couple of tests with the old sorter to have reference for speed benchmarks.
[libucw.git] / lib / sorter / sbuck.c
index 287827ee3359f5a08b4162afee5c0eced00ce09e..b1297c156e49be82d210141cd750860038c5d544 100644 (file)
@@ -10,6 +10,7 @@
 #include "lib/lib.h"
 #include "lib/fastbuf.h"
 #include "lib/mempool.h"
+#include "lib/stkstring.h"
 #include "lib/sorter/common.h"
 
 #include <fcntl.h>
@@ -144,7 +145,7 @@ sorter_alloc_buf(struct sort_context *ctx)
   ctx->big_buf_size = 2*bs;
   ctx->big_buf_half = ((byte*) ctx->big_buf) + bs;
   ctx->big_buf_half_size = bs;
-  SORT_XTRACE(2, "Allocated sorting buffer (2*%jd bytes)", (uintmax_t) bs);
+  SORT_XTRACE(2, "Allocated sorting buffer (2*%s)", stk_fsize(bs));
 }
 
 void
@@ -156,22 +157,3 @@ sorter_free_buf(struct sort_context *ctx)
   ctx->big_buf = NULL;
   SORT_XTRACE(2, "Freed sorting buffer");
 }
-
-void
-format_size(byte *buf, u64 x)
-{
-  if (x < 10<<10)
-    sprintf(buf, "%.1fK", (double)x/(1<<10));
-  else if (x < 1<<20)
-    sprintf(buf, "%dK", (int)(x/(1<<10)));
-  else if (x < 10<<20)
-    sprintf(buf, "%.1fM", (double)x/(1<<20));
-  else if (x < 1<<30)
-    sprintf(buf, "%dM", (int)(x/(1<<20)));
-  else if (x < (u64)10<<30)
-    sprintf(buf, "%.1fG", (double)x/(1<<30));
-  else if (x != ~(u64)0)
-    sprintf(buf, "%dG", (int)(x/(1<<30)));
-  else
-    strcpy(buf, "unknown");
-}