From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00982A00C4; Fri, 24 Apr 2020 05:39:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCFAB1C227; Fri, 24 Apr 2020 05:39:46 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 91E4A1C227 for ; Fri, 24 Apr 2020 05:39:45 +0200 (CEST) IronPort-SDR: wRFkhjDBy8fdVWgWSzdosvwAkEfm1dOoYdFJ8gRLAFn7mSTR/P1E0ukznPjJxNHFNtZvBwFLYu Cp/qx6DcAybg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 20:39:44 -0700 IronPort-SDR: vb9nKO8G5oD0iN/43ImeFQr7x3yz/i8quA3OP3qOUhDl85oRQLgxRqelemtgQGcSl5GP2k9vOo 0NqaZqsDL0bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,310,1583222400"; d="scan'208";a="274466774" Received: from unknown (HELO dpdk-zhaohy-t.localdomain) ([10.240.183.68]) by orsmga002.jf.intel.com with ESMTP; 23 Apr 2020 20:39:43 -0700 From: "Jiang, YuX" To: dts@dpdk.org Cc: "Jiang,yu" Date: Fri, 24 Apr 2020 11:32:17 +0800 Message-Id: <1587699137-89442-1-git-send-email-yux.jiang@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V1] nics/system_info: _strip_memory adapt new output X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" From: "Jiang,yu" adapt the new output of memory info Signed-off-by: Jiang,yu --- 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