From: "Jiang, YuX" <yux.jiang@intel.com>
To: dts@dpdk.org
Cc: "Jiang,yu" <yux.jiang@intel.com>
Subject: [dts] [PATCH V1] nics/system_info: _strip_memory adapt new output
Date: Fri, 24 Apr 2020 11:32:17 +0800 [thread overview]
Message-ID: <1587699137-89442-1-git-send-email-yux.jiang@intel.com> (raw)
From: "Jiang,yu" <yux.jiang@intel.com>
adapt the new output of memory info
Signed-off-by: Jiang,yu <yux.jiang@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
next reply other threads:[~2020-04-24 3:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 3:32 Jiang, YuX [this message]
2020-04-24 4:05 ` Jiang, YuX
[not found] ` <60652C6914E08D41B9AA1580751B3CA9015EF9BE@SHSMSX103.ccr.corp.intel.com>
2020-04-24 5:34 ` Jiang, MaoX
2020-04-24 5:54 ` Jiang, MaoX
2020-04-24 6:41 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1587699137-89442-1-git-send-email-yux.jiang@intel.com \
--to=yux.jiang@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).