From 7967ffd7143ec15fddc06e69c5e522797412969e Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 23 Sep 2022 00:25:45 +0200 Subject: [PATCH] M #-: Fix CPU capacity For some versions of lscpu scaling is also returned in the form: CPU(s): 8 CPU(s) scaling MHz: 55% So /CPU\(s\)/ matches both lines and the TOTAL_CPU value is not properly computed (cherry picked from commit 62c265b5028395a929ca50505886a6c595b70fa2) --- src/im_mad/remotes/lib/linux.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/im_mad/remotes/lib/linux.rb b/src/im_mad/remotes/lib/linux.rb index d555558b36..6c05251123 100644 --- a/src/im_mad/remotes/lib/linux.rb +++ b/src/im_mad/remotes/lib/linux.rb @@ -44,7 +44,7 @@ class LinuxHost @net = {} cpuinfo.split(/\n/).each do |line| - if line =~ /^CPU\(s\)/ + if line =~ /^CPU\(s\):/ @cpu[:total] = line.split(':')[1].strip.to_i * 100 elsif line =~ /^CPU MHz:/ @cpu[:speed] = Float(line.split(':')[1].strip.split(' ')[0]).round