From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp01.in.ibm.com (e28smtp01.in.ibm.com [125.16.236.1]) by dpdk.org (Postfix) with ESMTP id DBEF493FA for ; Tue, 1 Mar 2016 04:14:45 +0100 (CET) Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 1 Mar 2016 08:44:44 +0530 Received: from d28relay05.in.ibm.com (9.184.220.62) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 1 Mar 2016 08:44:42 +0530 X-IBM-Helo: d28relay05.in.ibm.com X-IBM-MailFrom: gowrishankar.m@linux.vnet.ibm.com X-IBM-RcptTo: dts@dpdk.org Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u213Eb0N8651212 for ; Tue, 1 Mar 2016 08:44:39 +0530 Received: from d28av01.in.ibm.com (localhost [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u218hoUe029907 for ; Tue, 1 Mar 2016 14:13:50 +0530 Received: from [9.77.92.100] ([9.77.92.100]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u218hoSa029884; Tue, 1 Mar 2016 14:13:50 +0530 Message-ID: <56D50914.7060008@linux.vnet.ibm.com> Date: Tue, 01 Mar 2016 08:44:28 +0530 From: gowrishankar User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: "Xu, HuilongX" 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: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 16030103-4790-0000-0000-00000D8D7E1A 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: Tue, 01 Mar 2016 03:14:46 -0000 Hi, Thanks for this check. For yocto or any other platform which do not have 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 = \ >> self.send_expect( >> - "grep --color=never \"processor\\|physical id\\|core >> id\\|^$\" /proc/cpuinfo", >> + "lscpu -p|grep -v \#", >> "#", alt_session=True) >> >> - if "processor" not in cpuinfo: >> - # yocto not support --color=never, but ubuntu must need -- >> color=never, >> - # so check cpuinfo, before parsing cpuinfo, if cpuifo get >> error, delete --color=never >> - # and get cpuinfo again >> - cpuinfo = \ >> - self.send_expect( >> - r'grep "processor\|physical id\|core id\|^$" >> /proc/cpuinfo', >> - "#", alt_session=True) >> - >> - cpuinfo = cpuinfo.split('\r\n\r\n') >> + cpuinfo = cpuinfo.split() >> # haswell cpu on cottonwood core id not correct >> # need addtional coremap for haswell cpu >> core_id = 0 >> coremap = {} >> for line in cpuinfo: >> - m = re.search("processor\t: (\d+)\r\n" + >> - "physical id\t: (\d+)\r\n" + >> - "core id\t\t: (\d+)", line) >> - >> - if m: >> - thread = m.group(1) >> - socket = m.group(2) >> - core = m.group(3) >> - >> - if core not in coremap.keys(): >> - coremap[core] = core_id >> - core_id += 1 >> - >> - if self.crb['bypass core0'] and core == '0' and socket == >> '0': >> - self.logger.info("Core0 bypassed") >> - continue >> - self.cores.append( >> + (thread, core, socket) = line.split(',')[0:3] >> + >> + if core not in coremap.keys(): >> + coremap[core] = core_id >> + core_id += 1 >> + >> + if self.crb['bypass core0'] and core == '0' and socket == '0': >> + self.logger.info("Core0 bypassed") >> + continue >> + self.cores.append( >> {'thread': thread, 'socket': socket, 'core': >> coremap[core]}) >> >> self.number_of_cores = len(self.cores) >> -- >> 1.7.10.4 >