From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 3F2AF6944 for ; Mon, 29 Feb 2016 03:13:46 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 28 Feb 2016 18:13:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,518,1449561600"; d="scan'208";a="923055763" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 28 Feb 2016 18:13:45 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 28 Feb 2016 18:13:44 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 28 Feb 2016 18:13:44 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.24]) with mapi id 14.03.0248.002; Mon, 29 Feb 2016 10:13:38 +0800 From: "Xu, HuilongX" To: Gowrishankar , dts Thread-Topic: [dts] [PATCH 2/9] framework: platform independent cpu info parsing Thread-Index: AQHRcH8ZiUIFdqOa3E+cGdhcroEySp9CS5bQ Date: Mon, 29 Feb 2016 02:13:37 +0000 Message-ID: References: <1456481834-10027-1-git-send-email-gowrishankar.m@linux.vnet.ibm.com> <1456481834-10027-3-git-send-email-gowrishankar.m@linux.vnet.ibm.com> In-Reply-To: <1456481834-10027-3-git-send-email-gowrishankar.m@linux.vnet.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 2/9] framework: platform independent cpu info parsing 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: , X-List-Received-Date: Mon, 29 Feb 2016 02:13:46 -0000 Hi Gowrishankar, Lscpu cmdline not default in yocto os.=20 Thanks a lot > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Gowrishankar > Sent: Friday, February 26, 2016 6:17 PM > To: dts > Subject: [dts] [PATCH 2/9] framework: platform independent cpu info > parsing >=20 > To collect thread/core/socket, /proc/cpuinfo would not help in case of > powerpc. > Instead, lscpu seems to be a better alternative and platform neutral > approach. >=20 > Signed-off-by: Gowrishankar > --- > framework/crb.py | 40 ++++++++++++---------------------------- > 1 file changed, 12 insertions(+), 28 deletions(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py > index c6fd9fb..1711f37 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -495,41 +495,25 @@ class Crb(object): >=20 > cpuinfo =3D \ > self.send_expect( > - "grep --color=3Dnever \"processor\\|physical id\\|core > id\\|^$\" /proc/cpuinfo", > + "lscpu -p|grep -v \#", > "#", alt_session=3DTrue) >=20 > - if "processor" not in cpuinfo: > - # yocto not support --color=3Dnever, but ubuntu must need -- > color=3Dnever, > - # so check cpuinfo, before parsing cpuinfo, if cpuifo get > error, delete --color=3Dnever > - # and get cpuinfo again > - cpuinfo =3D \ > - self.send_expect( > - r'grep "processor\|physical id\|core id\|^$" > /proc/cpuinfo', > - "#", alt_session=3DTrue) > - > - cpuinfo =3D cpuinfo.split('\r\n\r\n') > + cpuinfo =3D cpuinfo.split() > # haswell cpu on cottonwood core id not correct > # need addtional coremap for haswell cpu > core_id =3D 0 > coremap =3D {} > for line in cpuinfo: > - m =3D re.search("processor\t: (\d+)\r\n" + > - "physical id\t: (\d+)\r\n" + > - "core id\t\t: (\d+)", line) > - > - if m: > - thread =3D m.group(1) > - socket =3D m.group(2) > - core =3D m.group(3) > - > - if core not in coremap.keys(): > - coremap[core] =3D core_id > - core_id +=3D 1 > - > - if self.crb['bypass core0'] and core =3D=3D '0' and sock= et =3D=3D > '0': > - self.logger.info("Core0 bypassed") > - continue > - self.cores.append( > + (thread, core, socket) =3D line.split(',')[0:3] > + > + if core not in coremap.keys(): > + coremap[core] =3D core_id > + core_id +=3D 1 > + > + if self.crb['bypass core0'] and core =3D=3D '0' and socket = =3D=3D '0': > + self.logger.info("Core0 bypassed") > + continue > + self.cores.append( > {'thread': thread, 'socket': socket, 'core': > coremap[core]}) >=20 > self.number_of_cores =3D len(self.cores) > -- > 1.7.10.4