[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for
From: |
Neil Horman |
Subject: |
Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for cache size |
Date: |
Tue, 11 Dec 2018 16:05:05 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Dec 11, 2018 at 08:19:41PM +0100, Jean Delvare wrote:
> As newer CPUs have larger and larger cache, using kB to represent the
> cache size is getting less convenient. Reuse the same function we have
> for system memory size so that large units will be used as
> appropriate. For example, a cache size reported as "20 MB" looks nicer
> than as "20480 kB".
>
> Signed-off-by: Jean Delvare <address@hidden>
> ---
> dmidecode.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> --- dmidecode.orig/dmidecode.c 2018-12-11 12:50:32.762493048 +0100
> +++ dmidecode/dmidecode.c 2018-12-11 12:55:34.948912010 +0100
> @@ -1560,17 +1560,22 @@ static void dmi_cache_size(u16 code)
>
> static void dmi_cache_size_2(u32 code)
> {
> + u64 size;
> +
> if (code & 0x80000000)
> {
> code &= 0x7FFFFFFFLU;
> - /* Use a more convenient unit for large cache size */
> - if (code >= 0x8000)
> - printf(" %u MB", code >> 4);
> - else
> - printf(" %u kB", code << 6);
> + size.l = code << 6;
> + size.h = code >> 26;
> }
> else
> - printf(" %u kB", code);
> + {
> + size.l = code;
> + size.h = 0;
> + }
> +
> + /* Use a more convenient unit for large cache size */
> + dmi_print_memory_size(size, 1);
> }
>
> static void dmi_cache_types(u16 code, const char *sep)
>
>
> --
> Jean Delvare
> SUSE L3 Support
>
> _______________________________________________
> https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
>
Series
Acked-by: Neil Horman <address@hidden>