perf tools: Move units conversion/formatting routines to separate object
[sfrench/cifs-2.6.git] / tools / perf / util / util.c
index bc42c459f586d008c16c74a561f31c19a12cfe3b..7741d5f6022b2106ccad925c56eebcf928882c1a 100644 (file)
@@ -272,28 +272,6 @@ int copyfile(const char *from, const char *to)
        return copyfile_mode(from, to, 0755);
 }
 
-unsigned long convert_unit(unsigned long value, char *unit)
-{
-       *unit = ' ';
-
-       if (value > 1000) {
-               value /= 1000;
-               *unit = 'K';
-       }
-
-       if (value > 1000) {
-               value /= 1000;
-               *unit = 'M';
-       }
-
-       if (value > 1000) {
-               value /= 1000;
-               *unit = 'G';
-       }
-
-       return value;
-}
-
 static ssize_t ion(bool is_read, int fd, void *buf, size_t n)
 {
        void *buf_start = buf;
@@ -731,16 +709,3 @@ int fetch_current_timestamp(char *buf, size_t sz)
 
        return 0;
 }
-
-int unit_number__scnprintf(char *buf, size_t size, u64 n)
-{
-       char unit[4] = "BKMG";
-       int i = 0;
-
-       while (((n / 1024) > 1) && (i < 3)) {
-               n /= 1024;
-               i++;
-       }
-
-       return scnprintf(buf, size, "%" PRIu64 "%c", n, unit[i]);
-}