2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2013, The V3VEE Project <http://www.v3vee.org>
11 * All rights reserved.
13 * Author: Chang S. Bae <chang.bae@eecs.northwestern.edu>
15 * This is free software. You are permitted to use,
16 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vmm.h>
21 #include <palacios/vmm_debug.h>
22 #include <palacios/vmm_types.h>
23 #include <palacios/vm_guest.h>
24 #include <palacios/vmm_lowlevel.h>
25 #include <interfaces/vmm_pmu.h>
27 struct v3_pmu_iface * palacios_pmu = 0;
34 * description: init pmu through the interface on this core
37 void v3_pmu_init(void) {
39 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
40 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->init != NULL);
46 * description: actually stop pmu running through the interface
49 void v3_pmu_deinit(void) {
51 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
52 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->deinit != NULL);
54 palacios_pmu->deinit();
58 * description: init pmu through the interface
61 int v3_pmu_start_tracking(v3_pmon_ctr_t ctr) {
63 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
64 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->start_tracking != NULL);
66 return palacios_pmu->start_tracking(ctr);
70 * description: actually stop pmu running through the interface
72 int v3_pmu_stop_tracking(v3_pmon_ctr_t ctr) {
74 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
75 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->stop_tracking != NULL);
77 return palacios_pmu->stop_tracking(ctr);
81 * description: actually stop pmu running through the interface
83 uint64_t v3_pmu_get_value(v3_pmon_ctr_t ctr) {
85 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
86 V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->get_value != NULL);
88 return palacios_pmu->get_value(ctr);
93 * description: init whole interface to pmu
96 void V3_Init_PMU(struct v3_pmu_iface * pmu_iface) {
97 palacios_pmu = pmu_iface;