[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH OSSTEST] examine/cpu: fix fetching number of threads


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 23 Apr 2020 16:43:03 +0200
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: ian.jackson@xxxxxxxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 23 Apr 2020 14:43:40 +0000
  • Ironport-sdr: OolVIUDptq52i7xalbS+OChH4n9xumSf2OwlCbjh+a5/2jt51Jt3Vhz2izdflP0hqByt9pmkEV 2q3Lrk1iCc08qyElGLk796LvmPsXMMx324WSu36hMV6BK94ayBsZ58kECyauXsYPaPpQYV/11c y9plY3vZt7KgV/NPapjupaKAnGUKxxhnz/UwAWudvPD8F6oW19JMf3vpE9ObO3+FFhQgzWl5UI XMm3dN1CxkaEChjf/3Ed1rx7ut/tX9NxPbmBgKLFwl5n3JZCAHXHBJYxFztsrIMai9rdnSByyU N4o=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The way to fetch the number of threads from the output of xl info is
wrong, as the result of =~ is either true or false, but will never be a
numeric value.

Fix the regex to have a capture group in order to fetch the number of
threads, and store the capture in the threads variable.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 ts-examine-cpu | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ts-examine-cpu b/ts-examine-cpu
index 81cf7544..fbf01dfb 100755
--- a/ts-examine-cpu
+++ b/ts-examine-cpu
@@ -26,7 +26,8 @@ our ($whhost) = @ARGV;
 $whhost ||= 'host';
 our $ho= selecthost($whhost);
 our $info = target_cmd_output_root($ho, 'xl info', 10);
-our $threads = $info =~ /^threads_per_core\s*:\s.*/m;
+$info =~ /^threads_per_core\s*:\s(.*)$/m or die "missing or malformed info";
+our $threads = $1;
 
 logm("$ho->{Ident} threads per core: $threads");
 hostflag_putative_record($ho, "hw-smt", $threads > 1);
-- 
2.26.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.