The Gaudi Framework  v30r3 (a5ef0a68)
pfmlib_core.h
Go to the documentation of this file.
1 /*
2  * Intel Core PMU
3  *
4  * Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
5  * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11  * of the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef __PFMLIB_CORE_H__
25 #define __PFMLIB_CORE_H__
26 
27 #include <perfmon/pfmlib.h>
28 /*
29  * privilege level mask usage for Intel Core
30  *
31  * PFM_PLM0 = OS (kernel, hypervisor, ..)
32  * PFM_PLM1 = unused (ignored)
33  * PFM_PLM2 = unused (ignored)
34  * PFM_PLM3 = USR (user level)
35  */
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #define PMU_CORE_NUM_FIXED_COUNTERS 3 /* number of fixed counters */
42 #define PMU_CORE_NUM_GEN_COUNTERS 2 /* number of generic counters */
43 #define PMU_CORE_NUM_COUNTERS 5 /* number of counters */
44 
45 typedef union {
46  unsigned long long val; /* complete register value */
47  struct {
48  unsigned long sel_event_select : 8; /* event mask */
49  unsigned long sel_unit_mask : 8; /* unit mask */
50  unsigned long sel_usr : 1; /* user level */
51  unsigned long sel_os : 1; /* system level */
52  unsigned long sel_edge : 1; /* edge detec */
53  unsigned long sel_pc : 1; /* pin control */
54  unsigned long sel_int : 1; /* enable APIC intr */
55  unsigned long sel_res1 : 1; /* reserved */
56  unsigned long sel_en : 1; /* enable */
57  unsigned long sel_inv : 1; /* invert counter mask */
58  unsigned long sel_cnt_mask : 8; /* counter mask */
59  unsigned long sel_res2 : 32;
60  } perfevtsel;
62 
63 typedef struct {
64  unsigned long cnt_mask; /* threshold (cnt_mask) */
65  unsigned int flags; /* counter specific flag */
67 
68 #define PFM_CORE_SEL_INV 0x1 /* inverse */
69 #define PFM_CORE_SEL_EDGE 0x2 /* edge detect */
70 
71 /*
72  * model-specific parameters for the library
73  */
74 typedef struct {
75  unsigned int pebs_used; /* set to 1 if PEBS is used */
77 
78 typedef struct {
81  uint64_t reserved[4]; /* for future use */
83 
84 typedef struct {
85  uint64_t reserved[8]; /* for future use */
87 
88 #ifdef __cplusplus /* extern C */
89 }
90 #endif
91 
92 /*
93  * PMU-specific interface
94  */
95 extern int pfm_core_is_pebs( pfmlib_event_t* e );
96 
97 #endif /* __PFMLIB_CORE_H__ */
unsigned long long val
Definition: pfmlib_core.h:46
pfmlib_core_pebs_t pfp_core_pebs
Definition: pfmlib_core.h:80
unsigned long cnt_mask
Definition: pfmlib_core.h:64
unsigned long long uint64_t
Definition: instrset.h:143
int pfm_core_is_pebs(pfmlib_event_t *e)
unsigned int pebs_used
Definition: pfmlib_core.h:75
unsigned int flags
Definition: pfmlib_core.h:65
#define PMU_CORE_NUM_COUNTERS
Definition: pfmlib_core.h:43