perf tools: Add unit_number__scnprintf function
[linux-block.git] / tools / perf / util / evlist.c
index 23e6f33edcf2f5b5913ecd7e4db48e9760c89615..dc4df3d2660e6d085c27ba28b19a0ca20494d82d 100644 (file)
@@ -1224,12 +1224,16 @@ static long parse_pages_arg(const char *str, unsigned long min,
        if (pages == 0 && min == 0) {
                /* leave number of pages at 0 */
        } else if (!is_power_of_2(pages)) {
+               char buf[100];
+
                /* round pages up to next power of 2 */
                pages = roundup_pow_of_two(pages);
                if (!pages)
                        return -EINVAL;
-               pr_info("rounding mmap pages size to %lu bytes (%lu pages)\n",
-                       pages * page_size, pages);
+
+               unit_number__scnprintf(buf, sizeof(buf), pages * page_size);
+               pr_info("rounding mmap pages size to %s (%lu pages)\n",
+                       buf, pages);
        }
 
        if (pages > max)