Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


PMU Host Interface and initial implementation for Linux and AMD/Intel
[palacios.git] / palacios / include / interfaces / vmm_pmu.h
1 /*
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.
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2013, The V3VEE Project <http://www.v3vee.org>
11  * All rights reserved.
12  *
13  * Author: Chang S. Bae <chang.bae@eecs.northwestern.edu>
14  *
15  * This is free software.  You are permitted to use,
16  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
17  */
18
19 #ifndef __VMM_PMU
20 #define __VMM_PMU
21
22 #include <palacios/vmm_types.h>
23
24 /*
25  * defines
26  */
27
28 /*
29  * The following is the set of performance
30  * counters available in Palacios.  The implementation
31  * of the interface translates these names to
32  * the underlying counters needed on the specific platform
33  */
34 typedef enum {
35   V3_PMON_RETIRED_INST_COUNT=0,
36   V3_PMON_CLOCK_COUNT,
37   V3_PMON_MEM_LOAD_COUNT,
38   V3_PMON_MEM_STORE_COUNT,
39   V3_PMON_CACHE_MISS_COUNT,
40   V3_PMON_TLB_MISS_COUNT
41
42   //V3_PMON_TLB_INVALIDATION_COUNT
43   /* you can add more here, but then need to implement them
44      in the interface */
45
46 } v3_pmon_ctr_t;
47
48
49 struct v3_pmu_iface {
50     /* init/deinit pmu data on the core on which it is called */
51
52
53     void  (*init)(void);
54     void  (*deinit)(void);
55
56     // Request tracking of a counter, returns -1 if it is not possible
57     int (*start_tracking)(v3_pmon_ctr_t ctr);
58     // Get the counter value, provided it being tracked
59     uint64_t (*get_value)(v3_pmon_ctr_t ctr);
60     // Stop tracking a counter
61     int (*stop_tracking)(v3_pmon_ctr_t ctr);
62
63 };
64
65
66 /*
67  *  function prototypes
68  */
69
70 extern void V3_Init_PMU(struct v3_pmu_iface * palacios_pmu);
71
72 #ifdef __V3VEE__
73
74 /* This is a PER PHYSICAL CORE init/deinit */
75 void v3_pmu_init(void);
76
77 // Call these after an init
78 int v3_pmu_start_tracking(v3_pmon_ctr_t ctr);
79 int v3_pmu_stop_tracking(v3_pmon_ctr_t ctr);
80 uint64_t v3_pmu_get_value(v3_pmon_ctr_t ctr);
81
82 // Call this after you are done with the PMU
83 void v3_pmu_deinit(void);
84
85
86
87 #endif
88
89 #endif