From patchwork Thu Jun 1 19:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0194C7EE2F for ; Thu, 1 Jun 2023 19:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbjFATbc (ORCPT ); Thu, 1 Jun 2023 15:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbjFATb2 (ORCPT ); Thu, 1 Jun 2023 15:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BFD186 for ; Thu, 1 Jun 2023 12:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=IWA2hylJFXzxJIy5ivhZSUmdcxBHJTCbw1nxUxKV5qY=; b=OI32nRrXOx2uYuT37uyAfJ+cMDBoEpfiemWUcc7pQ4yj6Z3aMaXzXYX3d7B+rq2exOEbHS b6buFEs7O8206LiePSwNlJmeM6MZCSYAaUOTFUK9RFo6p6+aJAQfwAFgJibDnQ0+jcCIIt Q/stemUloIhRVzvMDx26N0B01kktPys= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-107-clu4afMdO4Cm3Dje0gfmsQ-1; Thu, 01 Jun 2023 15:30:40 -0400 X-MC-Unique: clu4afMdO4Cm3Dje0gfmsQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB216101A531 for ; Thu, 1 Jun 2023 19:30:39 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6A0D202696C; Thu, 1 Jun 2023 19:30:39 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 01/10] rteval: Use f-strings in rtevalclient.py Date: Thu, 1 Jun 2023 15:29:20 -0400 Message-Id: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/rtevalclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/rtevalclient.py b/rteval/rtevalclient.py index 26c953005326..7ff7d2700cfc 100644 --- a/rteval/rtevalclient.py +++ b/rteval/rtevalclient.py @@ -61,7 +61,7 @@ class rtevalclient: cmpr = compr.compress(fbuf.getvalue()) data = base64.b64encode(cmpr + compr.flush()) ret = self.srv.SendReport(self.hostname, data) - print("rtevalclient::SendReport() - Sent %i bytes (XML document length: %i bytes, compression ratio: %.02f%%)" % (len(data), doclen, (1-(float(len(data)) / float(doclen)))*100 )) + print(f"rtevalclient::SendReport() - Sent {len(data)} bytes (XML document length: {doclen} bytes, compression ratio: {(1-(float(len(data)) / float(doclen)))*100}:.2f)") return ret def SendDataAsFile(self, fname, data, decompr = False): From patchwork Thu Jun 1 19:29:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C755C7EE2E for ; Thu, 1 Jun 2023 19:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbjFATbb (ORCPT ); Thu, 1 Jun 2023 15:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjFATb2 (ORCPT ); Thu, 1 Jun 2023 15:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CD4189 for ; Thu, 1 Jun 2023 12:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQ0hh2c8Huh/eKpAsqGhwwpPLifbHs1YpZ5kWxuoRiM=; b=SUWAQ4bNMki5awMWCRip5RKD1f2rFBnkUBY5EeedMIpXHGHyXmw0b3D8jpmo3N5uDoUfd+ rhsn4QRRVks2VhobhjSQIpmSQ6E1wo4OM69EKvGa3Gc2LOLH2T+jIDXuJC71by5Y385bLB Zyw0rRCgKqNogmBs/vwZpps6oXTSumg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-372-r0ys3hbdM1ae4ug5J9KV1w-1; Thu, 01 Jun 2023 15:30:40 -0400 X-MC-Unique: r0ys3hbdM1ae4ug5J9KV1w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1440E1C12F83 for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5894200AE6F; Thu, 1 Jun 2023 19:30:39 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 02/10] rteval: Use f-strings in rtevalConfig Date: Thu, 1 Jun 2023 15:29:21 -0400 Message-Id: <20230601192928.809434-2-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 rteval: Use f-strings in rtevalConfig X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/rtevalConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py index de88924642ca..41f1a567720f 100644 --- a/rteval/rtevalConfig.py +++ b/rteval/rtevalConfig.py @@ -115,7 +115,7 @@ class rtevalCfgSection: "Simple method for dumping config when object is used as a string" if not self.__cfgdata: return "# empty" - return "\n".join(["%s: %s" % (k, v) for k, v in list(self.__cfgdata.items())]) + "\n" + return "\n".join([f"{k}: {v}" for k, v in list(self.__cfgdata.items())]) + "\n" def __setattr__(self, key, val): From patchwork Thu Jun 1 19:29:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BDE5C77B7A for ; Thu, 1 Jun 2023 19:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbjFATcJ (ORCPT ); Thu, 1 Jun 2023 15:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbjFATcJ (ORCPT ); Thu, 1 Jun 2023 15:32:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D616198 for ; Thu, 1 Jun 2023 12:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=66/FcngQ5PqypxxLsAf9ElB4anRCE+JJe73pxab9p9k=; b=Lon6ZcEMmXSRIQVZ2aUipc8zzS/uWI8eOwwJVj8ISdEOeHPEIqGVrdVhbT5xA8bEcaOtw3 tqAw9xsgp2GsX3Z7jAHJ4bQUuSVBG7kTZXCNUUQ/W0yf0mkVSs2A7eSbkFK3eUgI/pcTEK lk8bceZdLl5HfyvB0xPNzvvyHFOelRk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-tUPq9qiPPlisJJQUV3NPSw-1; Thu, 01 Jun 2023 15:30:40 -0400 X-MC-Unique: tUPq9qiPPlisJJQUV3NPSw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E61885A5BA for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F17F20296C6; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 03/10] rteval: Use f-strings in cputopology Date: Thu, 1 Jun 2023 15:29:22 -0400 Message-Id: <20230601192928.809434-3-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/cputopology.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py index ced7e1f295b7..2bb632312320 100644 --- a/rteval/sysinfo/cputopology.py +++ b/rteval/sysinfo/cputopology.py @@ -124,9 +124,7 @@ def unit_test(rootdir): x.saveFormatFileEnc('-', 'UTF-8', 1) print(" ---- getCPUcores() / getCPUscokets() ---- ") - print("CPU cores: %i (online: %i) - CPU sockets: %i" % (cputop.cpu_getCores(False), - cputop.cpu_getCores(True), - cputop.cpu_getSockets())) + print(f"CPU cores: {cputop.cpu_getCores(False)} (online: {cputop.cpu_getCores(True)}) - CPU sockets: {cputop.cpu_getSockets()}") return 0 except Exception as e: # import traceback From patchwork Thu Jun 1 19:29:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEA4FC7EE2D for ; Thu, 1 Jun 2023 19:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbjFATbb (ORCPT ); Thu, 1 Jun 2023 15:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbjFATb2 (ORCPT ); Thu, 1 Jun 2023 15:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94C68184 for ; Thu, 1 Jun 2023 12:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8BjNaaOHrmms3A/1DQjl1r3+RbmscKjEwMazBiGpu0w=; b=fzf/Wuvlu8ks0kucevuOQEM7reLIYhyPKuBAIIvFP4UCuysMtmQGVUOz+DMont6U4/limx PBGlGVeRG3BblQVniEY4PDQ/nxjzUVzuyimYj8AVQkUMwrbTabbjEoyMpf07SADMuzpisj mWV3MHH1XcvAF+tIhKfq+hc8IEFJ3UQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-8IRv5L_QM4aFmJ5TfTvN_A-1; Thu, 01 Jun 2023 15:30:40 -0400 X-MC-Unique: 8IRv5L_QM4aFmJ5TfTvN_A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BC011C12F86 for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D156202696C; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 04/10] rteval: Use f-strings in kernel.py Date: Thu, 1 Jun 2023 15:29:23 -0400 Message-Id: <20230601192928.809434-4-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rteval/sysinfo/kernel.py b/rteval/sysinfo/kernel.py index f2e9d72ac2ef..ba5cadda40c5 100644 --- a/rteval/sysinfo/kernel.py +++ b/rteval/sysinfo/kernel.py @@ -47,8 +47,8 @@ class KernelInfo: policies = {'DLN': 'deadline', 'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'} ret_kthreads = {} self.__log(Log.DEBUG, "getting kthread status") - cmd = '%s -eocommand,pid,policy,rtprio,comm' % getcmdpath('ps') - self.__log(Log.DEBUG, "cmd: %s" % cmd) + cmd = f"{getcmdpath('ps')} -eocommand,pid,policy,rtprio,comm" + self.__log(Log.DEBUG, f"cmd: {cmd}") c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) for p in c.stdout: v = p.strip().split() From patchwork Thu Jun 1 19:29:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BE5FC7EE23 for ; Thu, 1 Jun 2023 19:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231970AbjFATb3 (ORCPT ); Thu, 1 Jun 2023 15:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjFATb2 (ORCPT ); Thu, 1 Jun 2023 15:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED13A18C for ; Thu, 1 Jun 2023 12:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=93YW2dGum1BiCdXA4cJrSKpgeaDXLSpeQoBCWAHMDnU=; b=Cl6eo1Z7IBXSEUIHWl9KB27fRXZBFVZ95BfhAH99UhpL7rQ3Dd45V/WF5b43wqah62Zv8g C/8H0SctqGUxmXfb5OBai3r2TsOezCQ/m2xR7bjLzyb7UpdYgebLQYC+45M/DBrdfr5RkN TAhORCXZ+PYijd4cScy1/dg8+jt9f60= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-402-a3iEF-7fOC6FIyng0PB-hw-1; Thu, 01 Jun 2023 15:30:40 -0400 X-MC-Unique: a3iEF-7fOC6FIyng0PB-hw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B7733C13933 for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CFA9200AE6F; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 05/10] rteval: Use f-strings in memory.py Date: Thu, 1 Jun 2023 15:29:24 -0400 Message-Id: <20230601192928.809434-5-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/memory.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py index 7c5fd6f315cf..cc2fa2cfa4be 100644 --- a/rteval/sysinfo/memory.py +++ b/rteval/sysinfo/memory.py @@ -49,7 +49,7 @@ class MemoryInfo: if l.startswith('MemTotal:'): parts = l.split() if parts[2].lower() != 'kb': - raise RuntimeError("Units changed from kB! (%s)" % parts[2]) + raise RuntimeError(f"Units changed from kB! ({parts[2]})") rawsize = int(parts[1]) f.close() break @@ -76,7 +76,7 @@ class MemoryInfo: memsize = self.mem_get_size() mem_n = libxml2.newNode("memory_size") - mem_n.addContent("%.3f" % memsize[0]) + mem_n.addContent(f"{memsize[0]:.3f}") mem_n.newProp("unit", memsize[1]) rep_n.addChild(mem_n) @@ -88,8 +88,8 @@ def unit_test(rootdir): import sys try: mi = MemoryInfo() - print("Numa nodes: %i" % mi.mem_get_numa_nodes()) - print("Memory: %i %s" % mi.mem_get_size()) + print(f"Numa nodes: {mi.mem_get_numa_nodes()}") + print(f"Memory: {int(mi.mem_get_size()[0])} {mi.mem_get_size()[1]}") except Exception as e: import traceback traceback.print_exc(file=sys.stdout) From patchwork Thu Jun 1 19:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24620C7EE2E for ; Thu, 1 Jun 2023 19:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjFATcQ (ORCPT ); Thu, 1 Jun 2023 15:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbjFATcO (ORCPT ); Thu, 1 Jun 2023 15:32:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D37518F for ; Thu, 1 Jun 2023 12:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J437BOjCG1YcGUNm4LlxjLBptDTj2ar5JlFGoTx+Ne0=; b=MHDpRRrE19BaKN5ssx25T4bDmVyEuIAdWZqcoQMkKfpSlXNkoc2TkEiqgawctdW1R8uRth ARNorjzIyByH8knLKjZZxe1y2039WjLn9pLG9w28YFi3kGjA+LfjtOeWqVl9gPMZ84f4yA VJtRaYkxUAQPPhdAVxXEr3KnrIfh9tM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-N4ppVD_SP_S2GDwoo6elMA-1; Thu, 01 Jun 2023 15:30:41 -0400 X-MC-Unique: N4ppVD_SP_S2GDwoo6elMA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C1ED4800159 for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5CDA20296C6; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 06/10] rteval: Use f-strings in osinfo Date: Thu, 1 Jun 2023 15:29:25 -0400 Message-Id: <20230601192928.809434-6-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/osinfo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py index 7b7bfe9ce4ec..83dc78b96fdd 100644 --- a/rteval/sysinfo/osinfo.py +++ b/rteval/sysinfo/osinfo.py @@ -55,9 +55,9 @@ class OSInfo: shutil.copyfile(dpath, os.path.join(repdir, "dmesg")) return if os.path.exists('/usr/bin/dmesg'): - subprocess.call('/usr/bin/dmesg > %s' % os.path.join(repdir, "dmesg"), shell=True) + subprocess.call(f'/usr/bin/dmesg > {os.path.join(repdir, "dmesg")}', shell=True) return - print("dmesg file not found at %s and no dmesg exe found!" % dpath) + print(f"dmesg file not found at {dpath} and no dmesg exe found!") @@ -69,16 +69,16 @@ class OSInfo: else: raise RuntimeError("Can't find sosreport/sysreport") - self.__logger.log(Log.DEBUG, "report tool: %s" % exe) + self.__logger.log(Log.DEBUG, f"report tool: {exe}") options = ['-k', 'rpm.rpmva=off', '--name=rteval', '--batch'] self.__logger.log(Log.INFO, "Generating SOS report") - self.__logger.log(Log.INFO, "using command %s" % " ".join([exe]+options)) + self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}") subprocess.call([exe] + options) for s in glob('/tmp/s?sreport-rteval-*'): - self.__logger.log(Log.DEBUG, "moving %s to %s" % (s, repdir)) + self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}") shutil.move(s, repdir) @@ -118,11 +118,11 @@ def unit_test(rootdir): log = Log() log.SetLogVerbosity(Log.DEBUG|Log.INFO) osi = OSInfo(logger=log) - print("Base OS: %s" % osi.get_base_os()) + print(f"Base OS: {osi.get_base_os()}") print("Testing OSInfo::copy_dmesg('/tmp'): ", end=' ') osi.copy_dmesg('/tmp') -- 2.31.1 From patchwork Thu Jun 1 19:29:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688136 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC57AC77B7A for ; Thu, 1 Jun 2023 19:31:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232050AbjFATba (ORCPT ); Thu, 1 Jun 2023 15:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjFATb2 (ORCPT ); Thu, 1 Jun 2023 15:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FCBC18D for ; Thu, 1 Jun 2023 12:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NwKEAenOiJ13O1WiSfEAoOxpyVZDR5w07DAswKojY/4=; b=BWl5iOV2BnvR3ORhwzscvHHD/h/vS+GTySw+vYROr3EGzX05SYId9DXMnfgy3ykJLuVi0r lXdCZxorf4OT7ErLqeBmSwq39Mpto7eaZFCAI9nBKKOUHqDJVwZXXhXoMBeAim86Xo1xHM Kg/0gqNZLf+W9b5R+qXEge7XRaRP518= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-157-p67n_WdZPq6kzoVc4ak0TQ-1; Thu, 01 Jun 2023 15:30:41 -0400 X-MC-Unique: p67n_WdZPq6kzoVc4ak0TQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EACC83C13934 for ; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDD7C20296C6; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 07/10] rteval: Use f-strings in services.py Date: Thu, 1 Jun 2023 15:29:26 -0400 Message-Id: <20230601192928.809434-7-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rteval/sysinfo/services.py b/rteval/sysinfo/services.py index c85980e19165..a87b4abeea76 100644 --- a/rteval/sysinfo/services.py +++ b/rteval/sysinfo/services.py @@ -55,17 +55,17 @@ class SystemServices: break if not servicesdir: raise RuntimeError("No services dir (init.d) found on your system") - self.__log(Log.DEBUG, "Services located in %s, going through each service file to check status" % servicesdir) + self.__log(Log.DEBUG, f"Services located in {servicesdir}, going through each service file to check status") ret_services = {} for service in glob.glob(os.path.join(servicesdir, '*')): servicename = os.path.basename(service) if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \ and os.access(service, os.X_OK): - cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service) + cmd = f'{getcmdpath("grep")} -qs "\(^\|\W\)status)" {service}' c = subprocess.Popen(cmd, shell=True, encoding='utf-8') c.wait() if c.returncode == 0: - cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status'] + cmd = ['env', '-i', f'LANG="{os.environ["LANG"]}"', f'PATH="{os.environ["PATH"]}"', f'TERM="{os.environ["TERM"]}"', service, 'status'] c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') c.wait() if c.returncode == 0 and (c.stdout.read() or c.stderr.read()): @@ -79,8 +79,8 @@ class SystemServices: def __get_services_systemd(self): ret_services = {} - cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl') - self.__log(Log.DEBUG, "cmd: %s" % cmd) + cmd = f'{getcmdpath("systemctl")} list-unit-files -t service --no-legend' + self.__log(Log.DEBUG, f"cmd: {cmd}") c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') for p in c.stdout: # p are lines like b'servicename.service status' @@ -133,7 +133,7 @@ def unit_test(rootdir): return 0 except Exception as err: - print("** EXCEPTION: %s" % str(err)) + print(f"** EXCEPTION: {str(err)}") return 1 From patchwork Thu Jun 1 19:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7016C7EE2D for ; Thu, 1 Jun 2023 19:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231994AbjFATcP (ORCPT ); Thu, 1 Jun 2023 15:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbjFATcM (ORCPT ); Thu, 1 Jun 2023 15:32:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4E6192 for ; Thu, 1 Jun 2023 12:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gw9sb8fMi5aYTmHsNwVlME0TmZSIXxWsDhOkH6wAcw8=; b=QwV9GGSuAOwyF2o32ZHNhwqcHMtxFSB+1/Bahx6hm6RAG2rBJTEshv2LXL+vfBdWZT0ll5 OiRQtemtgluoXePrDbInm8lakZzp7KcbhSXlksRcUE/tcRTnj6EWa09yBYI0pDRAAvsyeT K/jofokQwIYHDvAA2bRFSDB1jrUDjnc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-219-It3itaDmOw-F_5mPxbKeqg-1; Thu, 01 Jun 2023 15:30:41 -0400 X-MC-Unique: It3itaDmOw-F_5mPxbKeqg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FE38811E8F for ; Thu, 1 Jun 2023 19:30:41 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01D6D20296C6; Thu, 1 Jun 2023 19:30:40 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 08/10] rteval: Use f-strings in tools.py Date: Thu, 1 Jun 2023 15:29:27 -0400 Message-Id: <20230601192928.809434-8-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/sysinfo/tools.py b/rteval/sysinfo/tools.py index 3993da413d8a..aa00b3d3eafc 100644 --- a/rteval/sysinfo/tools.py +++ b/rteval/sysinfo/tools.py @@ -40,5 +40,5 @@ def getcmdpath(which): pathSave[which] = cmdfile break if not pathSave[which]: - raise RuntimeError("Command '%s' is unknown on this system" % which) + raise RuntimeError(f"Command '{which}' is unknown on this system") return pathSave[which] From patchwork Thu Jun 1 19:29:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B914C7EE31 for ; Thu, 1 Jun 2023 19:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbjFATcS (ORCPT ); Thu, 1 Jun 2023 15:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjFATcR (ORCPT ); Thu, 1 Jun 2023 15:32:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60FD193 for ; Thu, 1 Jun 2023 12:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jaYoRmEIBii1kG0MCgP08Jwfc8TkSSOJFC1qw5ZM60I=; b=h56rcvc9pois5qZOojrZRIRdFfGbeKxYw+ZodY46Ty1JZUMyegrUMpOmIpgstlwF+PayVa cWyKxbjZArf6/aAZd7tz2XM/C2FXgPVTO0aTTHh7MO+M2fzbUrWkkO9FM23NEmHU5Vjqu5 ROIWoabVLPhtrsN5QNODQn35he+cM2o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-CRbqSoeyOkyTdcb6bEFcKA-1; Thu, 01 Jun 2023 15:30:41 -0400 X-MC-Unique: CRbqSoeyOkyTdcb6bEFcKA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 498EA858EEC for ; Thu, 1 Jun 2023 19:30:41 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BE94200BA8A; Thu, 1 Jun 2023 19:30:41 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 09/10] Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class Date: Thu, 1 Jun 2023 15:29:28 -0400 Message-Id: <20230601192928.809434-9-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/newnet.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/rteval/sysinfo/newnet.py b/rteval/sysinfo/newnet.py index 63417d9e59f1..2911400ceb6c 100644 --- a/rteval/sysinfo/newnet.py +++ b/rteval/sysinfo/newnet.py @@ -72,19 +72,23 @@ class IPv6Addresses(): and a list of ipv6addresses ''' MYP = '/proc/net/if_inet6' - with open(MYP, 'r') as f: - mystr = f.readline().strip() - while len(mystr) > 0: - ipv6addr , _, _, _, _, intf = mystr.split() - ipv6addr = compress_iv6(ipv6addr) - if intf == 'lo': - mystr = f.readline().strip() - continue - if intf not in self.data: - self.data[intf] = [ipv6addr] - else: - self.data[intf].append(ipv6addr) + try: + with open(MYP, 'r') as f: mystr = f.readline().strip() + while len(mystr) > 0: + ipv6addr , _, _, _, _, intf = mystr.split() + ipv6addr = compress_iv6(ipv6addr) + if intf == 'lo': + mystr = f.readline().strip() + continue + if intf not in self.data: + self.data[intf] = [ipv6addr] + else: + self.data[intf].append(ipv6addr) + mystr = f.readline().strip() + # if IPv6 is disabled, the if_net6 files does not exist, so we can pass + except FileNotFoundError: + pass class IPv4Addresses(): ''' Obtains a list of IPv4 addresses from the proc file system ''' From patchwork Thu Jun 1 19:29:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0158CC7EE2D for ; Thu, 1 Jun 2023 19:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232386AbjFATcU (ORCPT ); Thu, 1 Jun 2023 15:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbjFATcS (ORCPT ); Thu, 1 Jun 2023 15:32:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6AF5196 for ; Thu, 1 Jun 2023 12:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685647847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Ygh0OCBSOjQXhel+Y36borvm09Eo6MROMhwFNU3TZM=; b=XqEMi8LeewgLNTbJo7+HjTPjJ4aPDyPwjfTjExtxOyxh9ZKmY1SAU6Y//Dd0lklgokLCyc 8LCcoFluxGbH7OsIcJX4U0NdHzOA9EsZ+NklK8e9aSFI7TB5Hua3S7S3yK7yXzM3xVNhn3 I2BDIRCycqK2LrRSW6UKL8J1Tjj8hrA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-75-0-9wLaseNlWMg2PjsDyExQ-1; Thu, 01 Jun 2023 15:30:41 -0400 X-MC-Unique: 0-9wLaseNlWMg2PjsDyExQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72AFC1C12F80 for ; Thu, 1 Jun 2023 19:30:41 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54CA9200B68F; Thu, 1 Jun 2023 19:30:41 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH 10/10] rteval: Use f-strings in __init__.py Date: Thu, 1 Jun 2023 15:29:29 -0400 Message-Id: <20230601192928.809434-10-ashelat@redhat.com> In-Reply-To: <20230601192928.809434-1-ashelat@redhat.com> References: <20230601192928.809434-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Signed-off-by: Anubhav Shelat --- rteval/sysinfo/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py index 5767e5b7f6fe..31059c564d59 100644 --- a/rteval/sysinfo/__init__.py +++ b/rteval/sysinfo/__init__.py @@ -83,27 +83,23 @@ if __name__ == "__main__": print(f"\tRunning on {si.get_base_os()}") print(f"\tNUMA nodes: {si.mem_get_numa_nodes()}") - print("\tMemory available: %03.2f %s\n" % si.mem_get_size()) + print(f"\tMemory available: {si.mem_get_size()[0]:03.2f} {si.mem_get_size()[1]}\n") print("\tServices: ") for (s, r) in list(si.services_get().items()): - print("\t\t%s: %s" % (s, r)) + print(f"\t\t{s}: {r}") (curr, avail) = si.kernel_get_clocksources() - print("\tCurrent clocksource: %s" % curr) - print("\tAvailable clocksources: %s" % avail) + print(f"\tCurrent clocksource: {curr}") + print(f"\tAvailable clocksources: {avail}") print("\tModules:") for m in si.kernel_get_modules(): - print("\t\t%s: %s" % (m['modname'], m['modstate'])) + print(f"\t\t{m['modname']}: {m['modstate']}") print("\tKernel threads:") for (p, i) in list(si.kernel_get_kthreads().items()): - print("\t\t%-30.30s pid: %-5.5s policy: %-7.7s prio: %-3.3s" % ( - str(i["name"])+":", p, i["policy"], i["priority"] - )) + print(f"\t\t{str(i['name'])[:30]+':':<30} pid: {str(p)[:5]:<5} policy: {str(i['policy'])[:7]:<7} prio: {str(i['priority'])[:3]:<3}") - print("\n\tCPU topology info - cores: %i online: %i sockets: %i" % ( - si.cpu_getCores(False), si.cpu_getCores(True), si.cpu_getSockets() - )) + print(f"\n\tCPU topology info - cores: {si.cpu_getCores(False)} online: {si.cpu_getCores(True)} sockets: {si.cpu_getSockets()}") xml = si.MakeReport() xml_d = libxml2.newDoc("1.0")