Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Jan 2020 16:28:35 +0000
From:      Robert Crowston <crowston@protonmail.com>
To:        FreeBSD virtualization <freebsd-virtualization@freebsd.org>
Subject:   RFC: in-guest CPU tick counters
Message-ID:  <6fKdhaZusPRl6_RJb__9Pb0G7qzUKz9Jm-1cX26HDLrz3DJexiSJ2i-qNV5-iseDRjy1K_PE7ABijXolae03iM223LA4MOsMQ74E2rVu2qA=@protonmail.com>

next in thread | raw e-mail | index | archive | help

I have written a patch that exposes to a sysctl the ticks spent by each CPU executing guest code under bhyve.

This new feature differs from the existing vmm_stats code in that the existing code expresses per-vm information on a per-virtual-cpu basis. This new patch provides a per-physical-cpu counter of the aggregate number of ticks dedicated to executing guest-mode code since the vmm.ko module was loaded. Following the example of kern.cp_times, it is expressed as a new sysctl ("hw.vmm.stat.guest_ticks") rather than a system call, but I am not particularly attached to that.

The diffs may be seen here:
https://github.com/freebsd/freebsd/compare/master...RobCrowston:vmm-host-stats

I am looking for comments. If the general idea meets with this list's approval, I will submit it to phabricator.

The new data are intended to be used by utilities like htop. To that end, I have written a separate patch for htop that colours the CPU bars to express the time spent for guest execution. After re-compiling htop, enable it with F2 ("Setup") -> "Display Options" -> "Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)". Presently, htop only supports this feature for Linux hosts. If the above patch is accepted, I will submit the following patch to htop separately:
https://github.com/hishamhm/htop/compare/master...RobCrowston:freebsd-vmm-counter-1

Happy New Year,
Rob Crowston.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6fKdhaZusPRl6_RJb__9Pb0G7qzUKz9Jm-1cX26HDLrz3DJexiSJ2i-qNV5-iseDRjy1K_PE7ABijXolae03iM223LA4MOsMQ74E2rVu2qA=>