dmidecode-devel
[Top][All Lists]
Advanced

[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: Elliott, Robert (Persistent Memory)
Subject: Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for cache size
Date: Mon, 17 Dec 2018 15:50:18 +0000


> -----Original Message-----
> From: dmidecode-devel <address@hidden>
> On Behalf Of Jean Delvare
> Sent: Tuesday, December 11, 2018 2:20 PM
> To: address@hidden
> Subject: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit
> for cache size
> 
> 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".
> -             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);

The value might not be an integer multiple of the larger prefix; if so,
then you should either use floating point to show the fractional number
(my recommendation), or stick with the smaller prefix.  

Consider using this opportunity to switch to the SI-recommended IEC-defined
prefixes for binary multiples: KiB (1024) and MiB (1024*1024) rather than
KB (1000) and MB (1000*1000).



---
Robert Elliott, HPE Persistent Memory





reply via email to

[Prev in Thread] Current Thread [Next in Thread]