| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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;
61 } pfm_core_sel_reg_t;
62
63 typedef struct {
64 unsigned long cnt_mask; /* threshold (cnt_mask) */
65 unsigned int flags; /* counter specific flag */
66 } pfmlib_core_counter_t;
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 */
76 } pfmlib_core_pebs_t;
77
78 typedef struct {
79 pfmlib_core_counter_t pfp_core_counters[PMU_CORE_NUM_COUNTERS];
80 pfmlib_core_pebs_t pfp_core_pebs;
81 uint64_t reserved[4]; /* for future use */
82 } pfmlib_core_input_param_t;
83
84 typedef struct {
85 uint64_t reserved[8]; /* for future use */
86 } pfmlib_core_output_param_t;
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__ */
pfmlib_event_t
Definition: pfmlib.h:85
pfm_core_sel_reg_t::val
unsigned long long val
Definition: pfmlib_core.h:46
pfmlib_core_input_param_t::pfp_core_pebs
pfmlib_core_pebs_t pfp_core_pebs
Definition: pfmlib_core.h:80
pfmlib_core_counter_t::cnt_mask
unsigned long cnt_mask
Definition: pfmlib_core.h:64
pfmlib_core_counter_t
Definition: pfmlib_core.h:63
pfmlib_core_pebs_t
Definition: pfmlib_core.h:74
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
pfm_core_is_pebs
int pfm_core_is_pebs(pfmlib_event_t *e)
pfm_core_sel_reg_t
Definition: pfmlib_core.h:45
pfmlib_core_pebs_t::pebs_used
unsigned int pebs_used
Definition: pfmlib_core.h:75
pfmlib_core_input_param_t
Definition: pfmlib_core.h:78
pfmlib_core_counter_t::flags
unsigned int flags
Definition: pfmlib_core.h:65
pfmlib.h
pfmlib_core_output_param_t
Definition: pfmlib_core.h:84
PMU_CORE_NUM_COUNTERS
#define PMU_CORE_NUM_COUNTERS
Definition: pfmlib_core.h:43