Roman Bogorodskiy wrote:
For per CPU stats, implement virBhyveGetDomainPercpuStats() that
uses bhyvectl tool to obtain the guest's vcpu stats.
For total CPU stats, add virBhyveGetDomainTotalCpuStats() that
gets the hypervisor process CPU stats using kvm (kernel
memory interface).
---
configure.ac | 7 +++
src/bhyve/bhyve_driver.c | 38 +++++++++++++
src/bhyve/bhyve_process.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_process.h | 10 ++++
4 files changed, 191 insertions(+)
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index a557bc5..e1f4324 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
...
+int
+virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
+ virTypedParameterPtr params ATTRIBUTE_UNUSED,
+ unsigned int nparams)
+{
+ struct kinfo_proc* kp;
+ kvm_t* kd;
Just noticed that it should be:
struct kinfo_proc *kp;
kvm_t *kd;
I will not re-send the patch just because of that and will include the
fix in the next version.
+ char errbuf[_POSIX2_LINE_MAX];
+ int nprocs;
+ int ret = -1;
Roman Bogorodskiy