[dts] [PATCH V1] nics/system_info: _strip_memory adapt new output

Tu, Lijuan lijuan.tu at intel.com
Fri Apr 24 08:41:22 CEST 2020


Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Jiang, YuX
> Sent: Friday, April 24, 2020 11:32 AM
> To: dts at dpdk.org
> Cc: Jiang, YuX <yux.jiang at intel.com>
> Subject: [dts] [PATCH V1] nics/system_info: _strip_memory adapt new
> output
> 
> From: "Jiang,yu" <yux.jiang at intel.com>
> 
> adapt the new output of memory info
> 
> Signed-off-by: Jiang,yu <yux.jiang at intel.com>
> ---
>  nics/system_info.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/nics/system_info.py b/nics/system_info.py index
> da73b9f..5f796be 100644
> --- a/nics/system_info.py
> +++ b/nics/system_info.py
> @@ -75,9 +75,12 @@ class SystemInfo(object):
>      def _strip_memory(self, memories):
>          """
>          Size: 8192 MB Locator: DIMM_A1 Speed: 2133 MHz
> +        Size: 32 GB Locator: DIMMB1 Speed: 2400 MT/s
>          """
>          s_regex = r"(\s+)Size: (\d+) MB"
> +        s_regex_gb = r"(\s+)Size: (\d+) GB"
>          l_regex= r"(\s+)Locator: .*_(\w+)"
> +        l_regex_x= r"(\s+)Locator:.*DIMM(\w+)"
>          speed_regex = r"(\s+)Speed: (.*)"
>          size = ""
>          locate = ""
> @@ -88,11 +91,17 @@ class SystemInfo(object):
>          total_size = 0
>          for line in lines:
>              m = re.match(s_regex, line)
> +            m_gb = re.match(s_regex_gb, line)
>              if m:
>                  size = m.group(2)
> +            elif m_gb:
> +                size = m_gb.group(2)*1024
>              l_m = re.match(l_regex, line)
> +            l_mx = re.match(l_regex_x, line)
>              if l_m:
>                  locate = l_m.group(2)
> +            elif l_mx:
> +                locate = l_mx.group(2)
>              s_m = re.match(speed_regex, line)
>              if s_m:
>                  speed = s_m.group(2)
> --
> 2.17.2



More information about the dts mailing list