Finally I modified the test to do some representative work: We now load a real Windows XP guest, inspect it (a heavyweight operation), and mount and stat each filesystem. I won’t reproduce the entire test program again because only the test subroutine has changed:
sub test {
my $g = Sys::Guestfs->new;
$g->add_drive_ro ("/tmp/winxp.img");
$g->launch ();
# Inspect the guest (ignore the result).
$g->inspect_os ();
# Approximate what virt-df does.
my %fses = $g->list_filesystems ();
foreach (keys %fses) {
my $mounted = 0;
eval { $g->mount_ro ($_, "/"); $mounted = 1; };
if ($mounted) {
$g->statvfs ("/");
$g->umount_all ();
}
}
return $g;
}
Even with all that work going on, I was able to inspect more than 1 disk per second on my laptop, and run 60 threads in parallel with good performance and scalability:

