The Gaudi Framework
master (37c0b60a)
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_core_pebs_t
Definition:
pfmlib_core.h:74
pfm_core_sel_reg_t::val
unsigned long long val
Definition:
pfmlib_core.h:46
pfmlib_core_output_param_t
Definition:
pfmlib_core.h:84
pfmlib_core_counter_t
Definition:
pfmlib_core.h:63
pfmlib_core_input_param_t
Definition:
pfmlib_core.h:78
pfmlib_core_input_param_t::pfp_core_pebs
pfmlib_core_pebs_t pfp_core_pebs
Definition:
pfmlib_core.h:80
pfmlib_core_counter_t::flags
unsigned int flags
Definition:
pfmlib_core.h:65
pfm_core_sel_reg_t::sel_pc
unsigned long sel_pc
Definition:
pfmlib_core.h:53
pfm_core_sel_reg_t::sel_os
unsigned long sel_os
Definition:
pfmlib_core.h:51
pfm_core_sel_reg_t::sel_res2
unsigned long sel_res2
Definition:
pfmlib_core.h:59
pfm_core_sel_reg_t::sel_usr
unsigned long sel_usr
Definition:
pfmlib_core.h:50
PMU_CORE_NUM_COUNTERS
#define PMU_CORE_NUM_COUNTERS
Definition:
pfmlib_core.h:43
pfm_core_sel_reg_t::sel_int
unsigned long sel_int
Definition:
pfmlib_core.h:54
pfm_core_sel_reg_t::sel_event_select
unsigned long sel_event_select
Definition:
pfmlib_core.h:48
pfm_core_sel_reg_t::sel_edge
unsigned long sel_edge
Definition:
pfmlib_core.h:52
pfmlib_core_counter_t::cnt_mask
unsigned long cnt_mask
Definition:
pfmlib_core.h:64
pfm_core_is_pebs
int pfm_core_is_pebs(pfmlib_event_t *e)
pfmlib_core_pebs_t::pebs_used
unsigned int pebs_used
Definition:
pfmlib_core.h:75
pfm_core_sel_reg_t::sel_unit_mask
unsigned long sel_unit_mask
Definition:
pfmlib_core.h:49
pfm_core_sel_reg_t
Definition:
pfmlib_core.h:45
pfmlib.h
pfm_core_sel_reg_t::sel_cnt_mask
unsigned long sel_cnt_mask
Definition:
pfmlib_core.h:58
pfmlib_event_t
Definition:
pfmlib.h:84
pfm_core_sel_reg_t::sel_res1
unsigned long sel_res1
Definition:
pfmlib_core.h:55
pfm_core_sel_reg_t::sel_en
unsigned long sel_en
Definition:
pfmlib_core.h:56
pfm_core_sel_reg_t::sel_inv
unsigned long sel_inv
Definition:
pfmlib_core.h:57
GaudiProfiling
src
component
perfmon
pfmlib_core.h
Generated on Thu Dec 19 2024 15:35:05 for The Gaudi Framework by
1.8.18