Commit 58ed4968 authored by John Ferlan's avatar John Ferlan

Update the vcpuinfo.pl example

Based on the review of my iothreadsinfo.pl example which I took from
vcpuinfo.pl, this patch updates the vcpuinfo.pl to follow the changes
made in iothreadsinfo.pl
parent bedfea18
......@@ -5,6 +5,7 @@ Revision history for perl module Sys::Virt
- Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE constant
- Add VIR_DOMAIN_CONTROL_ERROR_* constants
- Add virDomainGetIOThreads and virDomainPinIOThread API bindings
- Update the vcpuinfo.pl example to use unpack
1.2.13 2015-03-05
......
......@@ -21,10 +21,8 @@ foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_all_domains) {
foreach (sort { $a cmp $b } keys %{$info}) {
if ($_ eq "affinity") {
print " ", $_, ": ";
my @mask = split //, $info->{$_};
for (my $p = 0 ; $p < $nodeinfo->{cpus} ; $p++) {
print ((ord($mask[$p/8]) & (1 << ($p % 8))) ? 1 : 0);
}
my @mask = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_}));
print join ("", @mask), "\n";
print "\n";
} else {
print " ", $_, ": ", $info->{$_}, "\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment