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 384E62C66 for ; Wed, 9 Mar 2016 06:51:01 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 08 Mar 2016 21:50:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,310,1455004800"; d="scan'208";a="760726981" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 08 Mar 2016 21:50:59 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 8 Mar 2016 21:50:59 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 8 Mar 2016 21:50:58 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by shsmsx102.ccr.corp.intel.com ([169.254.2.232]) with mapi id 14.03.0248.002; Wed, 9 Mar 2016 13:50:57 +0800 From: "Xu, HuilongX" To: "Liu, Yong" , gowrishankar Thread-Topic: [dts] [PATCH 2/9] framework: platform independent cpu info parsing Thread-Index: AQHRecem4QOn/5Cplk+YVWbwIrm0nQ== Date: Wed, 9 Mar 2016 05:50:56 +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> <56D50914.7060008@linux.vnet.ibm.com> <86228AFD5BCD8E4EBFD2B90117B5E81E144FF0F7@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E144FF0F7@SHSMSX103.ccr.corp.intel.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 Cc: dts 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: Wed, 09 Mar 2016 05:51:01 -0000 Hi yong, Yocto is a embedded os, so it not include rpm package tools. I can't install lscpu in it, except rebuild yocto image.=20 Thanks a lot > -----Original Message----- > From: Liu, Yong > Sent: Tuesday, March 01, 2016 8:42 PM > To: gowrishankar; Xu, HuilongX > Cc: dts > Subject: RE: [dts] [PATCH 2/9] framework: platform independent cpu info > parsing >=20 > Huilong, > "lscpu" is one of linux system utilities, it packed in util-linux rpm fil= e > in fedora distribution. > Could you whether there is available installation package in yocto? >=20 > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of gowrishankar > > Sent: Tuesday, March 01, 2016 11:14 AM > > To: Xu, HuilongX > > Cc: dts > > Subject: Re: [dts] [PATCH 2/9] framework: platform independent cpu info > > parsing > > > > Hi, > > Thanks for this check. For yocto or any other platform which do not hav= e > > lscpu by default, we can add a function to convert cpu info into a > > parsable > > format as given by lscpu. Any thoughts ?. > > > > Thanks, > > Gowrishankar > > > > On Monday 29 February 2016 07:43 AM, Xu, HuilongX wrote: > > > Hi Gowrishankar, > > > Lscpu cmdline not default in yocto os. > > > 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 > > >> > > >> 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. > > >> > > >> Signed-off-by: Gowrishankar > > >> --- > > >> framework/crb.py | 40 ++++++++++++---------------------------- > > >> 1 file changed, 12 insertions(+), 28 deletions(-) > > >> > > >> 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): > > >> > > >> cpuinfo =3D \ > > >> self.send_expect( > > >> - "grep --color=3Dnever \"processor\\|physical id\\|c= ore > > >> id\\|^$\" /proc/cpuinfo", > > >> + "lscpu -p|grep -v \#", > > >> "#", alt_session=3DTrue) > > >> > > >> - if "processor" not in cpuinfo: > > >> - # yocto not support --color=3Dnever, but ubuntu must ne= ed > - > > - > > >> 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 > > socket =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 soc= ket > =3D=3D > > '0': > > >> + self.logger.info("Core0 bypassed") > > >> + continue > > >> + self.cores.append( > > >> {'thread': thread, 'socket': socket, 'core': > > >> coremap[core]}) > > >> > > >> self.number_of_cores =3D len(self.cores) > > >> -- > > >> 1.7.10.4 > > > > >