summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm/vmm_stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/amd64/vmm/vmm_stat.c')
-rw-r--r--sys/amd64/vmm/vmm_stat.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/amd64/vmm/vmm_stat.c b/sys/amd64/vmm/vmm_stat.c
index ef9f411..9ecf9af 100644
--- a/sys/amd64/vmm/vmm_stat.c
+++ b/sys/amd64/vmm/vmm_stat.c
@@ -83,12 +83,21 @@ vmm_stat_register(void *arg)
int
vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *buf)
{
- int i;
+ struct vmm_stat_type *vst;
uint64_t *stats;
+ int i;
if (vcpu < 0 || vcpu >= VM_MAXCPU)
return (EINVAL);
-
+
+ /* Let stats functions update their counters */
+ for (i = 0; i < vst_num_types; i++) {
+ vst = vsttab[i];
+ if (vst->func != NULL)
+ (*vst->func)(vm, vcpu, vst);
+ }
+
+ /* Copy over the stats */
stats = vcpu_stats(vm, vcpu);
for (i = 0; i < vst_num_elems; i++)
buf[i] = stats[i];
OpenPOWER on IntegriCloud