File: iothreadinfo.pl

package info (click to toggle)
libsys-virt-perl 11.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,088 kB
  • sloc: perl: 2,187; sh: 12; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- perl -*-
use strict;
use warnings;
use Sys::Virt;

my $addr = @ARGV ? shift @ARGV : "";
print "Addr $addr\n";
my $con = Sys::Virt->new(address => $addr, readonly => 1);

print "VMM type: ", $con->get_type(), "\n";

foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_all_domains) {
    print "Domain: {\n";
    print "  ID: ", $dom->get_id(), " '" , $dom->get_name(), "'\n";
    print "  UUID: ", $dom->get_uuid_string(), "\n";
    my $nodeinfo = $con->get_node_info;
    my @info = $dom->get_iothread_info(Sys::Virt::Domain::AFFECT_CONFIG);

    foreach my $info (@info) {
	print "  IOThread: {\n";
	foreach (sort { $a cmp $b } keys %{$info}) {
	    if ($_ eq "affinity") {
		print "    ", $_, ": ";
                my @bits = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_}));
                print join ("", @bits), "\n";
	    } else {
		print "    ", $_, ": ", $info->{$_}, "\n";
	    }
	}
	print "  }\n";
    }
    print "}\n";
}