X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fsorter%2Fsbuck.c;h=b1297c156e49be82d210141cd750860038c5d544;hb=332c927b8301d01c2c2d8f047a091a4396a6bc82;hp=53dfed3133c52c7a2fc0cb7a685f1684f08e3b1b;hpb=2ee3df97a48340eea72f09c118c03c1e6d2d436c;p=libucw.git diff --git a/lib/sorter/sbuck.c b/lib/sorter/sbuck.c index 53dfed31..b1297c15 100644 --- a/lib/sorter/sbuck.c +++ b/lib/sorter/sbuck.c @@ -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 @@ -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 (%jd bytes)", (uintmax_t) bs); + SORT_XTRACE(2, "Allocated sorting buffer (2*%s)", stk_fsize(bs)); } void @@ -156,20 +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 - sprintf(buf, "%dG", (int)(x/(1<<30))); -}