From 25e47996fc04059e3c6705d49be3a98084039c6c Mon Sep 17 00:00:00 2001 From: Shriraj Hegde Date: Thu, 25 Nov 2021 20:14:00 +0530 Subject: [PATCH 1/2] Fix L1 Cache info Improve detection using better grep pattern --- sysmontask/cpu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysmontask/cpu.py b/sysmontask/cpu.py index 0c76b63..e63a122 100644 --- a/sysmontask/cpu.py +++ b/sysmontask/cpu.py @@ -77,15 +77,15 @@ def cpuInit(self): # CPU Caches try: - p=popen('lscpu|grep -i -m1 "L1d"') + p=popen('lscpu|grep -m1 "L1d cache:"') self.cpuL1LabelValue.set_text(sub("[\s]","",p.read().split(':')[1])) p.close() - p=popen('lscpu|grep -i -m1 "L2"') + p=popen('lscpu|grep -i -m1 "L2 cache:"') self.cpuL2LabelValue.set_text(sub('[\s]','',p.read().split(':')[1])) p.close() - p=popen('lscpu|grep -i "L3"') + p=popen('lscpu|grep -i "L2 cache:"') self.cpuL3LabelValue.set_text(sub('[\s]','',p.read().split(':')[1])) p.close() except: From 6363c2878d3cc98a830fc3b69ebaed0dd3cec610 Mon Sep 17 00:00:00 2001 From: Shriraj Hegde Date: Thu, 25 Nov 2021 20:24:25 +0530 Subject: [PATCH 2/2] Fix grep pattern Remove unnecessary case insensitivity --- sysmontask/cpu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysmontask/cpu.py b/sysmontask/cpu.py index e63a122..a363772 100644 --- a/sysmontask/cpu.py +++ b/sysmontask/cpu.py @@ -81,11 +81,11 @@ def cpuInit(self): self.cpuL1LabelValue.set_text(sub("[\s]","",p.read().split(':')[1])) p.close() - p=popen('lscpu|grep -i -m1 "L2 cache:"') + p=popen('lscpu|grep -m1 "L2 cache:"') self.cpuL2LabelValue.set_text(sub('[\s]','',p.read().split(':')[1])) p.close() - p=popen('lscpu|grep -i "L2 cache:"') + p=popen('lscpu|grep -m1 "L2 cache:"') self.cpuL3LabelValue.set_text(sub('[\s]','',p.read().split(':')[1])) p.close() except: