X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=977796cd59dd9a8682f32f80973a8973f62f977d;hp=44edd1e97b35fca609b7969c2e8340842d49f927;hb=0d1cd207e409a36313784cb9596990c819775f77;hpb=7c9b1bce094d58c374b086bbb780c08265623ea4 diff --git a/stat.c b/stat.c index 44edd1e9..977796cd 100644 --- a/stat.c +++ b/stat.c @@ -10,49 +10,6 @@ #include "fio.h" #include "diskutil.h" -/* - * Cheesy number->string conversion, complete with carry rounding error. - */ -static char *num2str(unsigned long num, int maxlen, int base, int pow2) -{ - char postfix[] = { ' ', 'K', 'M', 'G', 'P', 'E' }; - unsigned int thousand; - char *buf; - int i; - - if (pow2) - thousand = 1024; - else - thousand = 1000; - - buf = malloc(128); - - for (i = 0; base > 1; i++) - base /= thousand; - - do { - int len, carry = 0; - - len = sprintf(buf, "%'lu", num); - if (len <= maxlen) { - if (i >= 1) { - buf[len] = postfix[i]; - buf[len + 1] = '\0'; - } - return buf; - } - - if ((num % thousand) >= (thousand / 2)) - carry = 1; - - num /= thousand; - num += carry; - i++; - } while (i <= 5); - - return buf; -} - void update_rusage_stat(struct thread_data *td) { struct thread_stat *ts = &td->ts;