[V1] nics/system_info:adapt some environment memory echo unit is GB

Message ID 1616555317-21677-1-git-send-email-junx.w.zhou@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] nics/system_info:adapt some environment memory echo unit is GB |

Commit Message

Zhou, JunX W March 24, 2021, 3:08 a.m. UTC
  The previous environment memory information unit is MB. 
At present, some new system memory information units are GB,
 and DTS needs to be modified for adaptation.

Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>
---
 nics/system_info.py | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Zhou, JunX W March 24, 2021, 3:13 a.m. UTC | #1
>-----Original Message-----
>From: Zhou, JunX W 
>Sent: Wednesday, March 24, 2021 11:09 AM
>To: dts@dpdk.org
>Cc: Zhou, JunX W <junx.w.zhou@intel.com>
>Subject: [dts][PATCH V1] nics/system_info:adapt some environment memory echo unit is GB
>
>The previous environment memory information unit is MB. 
>At present, some new system memory information units are GB,  and DTS needs to be modified for adaptation.
>
>Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>

Tested-by: Zhou, Jun <junx.w.zhou@intel.com>
  
Tu, Lijuan March 25, 2021, 6 a.m. UTC | #2
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Zhou, JunX W
> Sent: 2021年3月24日 11:14
> To: dts@dpdk.org
> Subject: Re: [dts] [PATCH V1] nics/system_info:adapt some environment
> memory echo unit is GB
> 
> >-----Original Message-----
> >From: Zhou, JunX W
> >Sent: Wednesday, March 24, 2021 11:09 AM
> >To: dts@dpdk.org
> >Cc: Zhou, JunX W <junx.w.zhou@intel.com>
> >Subject: [dts][PATCH V1] nics/system_info:adapt some environment memory
> echo unit is GB
> >
> >The previous environment memory information unit is MB.
> >At present, some new system memory information units are GB,  and DTS
> needs to be modified for adaptation.
> >
> >Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>
> 
> Tested-by: Zhou, Jun <junx.w.zhou@intel.com>

Applied, thaks
  

Patch

diff --git a/nics/system_info.py b/nics/system_info.py
index da73b9f..70fdbf6 100644
--- a/nics/system_info.py
+++ b/nics/system_info.py
@@ -77,6 +77,7 @@  class SystemInfo(object):
         Size: 8192 MB Locator: DIMM_A1 Speed: 2133 MHz
         """
         s_regex = r"(\s+)Size: (\d+) MB"
+        s1_regex = r"(\s+)Size: (\d+) GB"
         l_regex= r"(\s+)Locator: .*_(\w+)"
         speed_regex = r"(\s+)Speed: (.*)"
         size = ""
@@ -88,8 +89,11 @@  class SystemInfo(object):
         total_size = 0
         for line in lines:
             m = re.match(s_regex, line)
+            m1 = re.match(s1_regex, line)
             if m:
                 size = m.group(2)
+            if m1:
+                size = int(m1.group(2)) * 1024
             l_m = re.match(l_regex, line)
             if l_m:
                 locate = l_m.group(2)