The Gaudi Framework
master (37c0b60a)
pfmlib_gen_ia32.h
Go to the documentation of this file.
1
/*
2
* Intel architectural PMU v1, v2, v3
3
*
4
* Copyright (c) 2006-2007 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_GEN_IA32_H__
25
#define __PFMLIB_GEN_IA32_H__
26
27
#include <
perfmon/pfmlib.h
>
28
/*
29
* privilege level mask usage for architected PMU:
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
/*
42
* upper limit, actual number determined dynamically
43
*/
44
#define PMU_GEN_IA32_MAX_COUNTERS PFMLIB_MAX_PMCS
45
46
/*
47
* Even though, CPUID 0xa returns in eax the actual counter
48
* width, the architecture specifies that writes are limited
49
* to lower 32-bits. As such, only the lower 32-bit have full
50
* degree of freedom. That is the "useable" counter width.
51
*/
52
#define PMU_GEN_IA32_COUNTER_WIDTH 32
53
54
typedef
union
{
55
unsigned
long
long
val
;
/* complete register value */
56
struct
{
57
unsigned
long
sel_event_select
: 8;
/* event mask */
58
unsigned
long
sel_unit_mask
: 8;
/* unit mask */
59
unsigned
long
sel_usr
: 1;
/* user level */
60
unsigned
long
sel_os
: 1;
/* system level */
61
unsigned
long
sel_edge
: 1;
/* edge detec */
62
unsigned
long
sel_pc
: 1;
/* pin control */
63
unsigned
long
sel_int
: 1;
/* enable APIC intr */
64
unsigned
long
sel_any
: 1;
/* any thread (v3) */
65
unsigned
long
sel_en
: 1;
/* enable */
66
unsigned
long
sel_inv
: 1;
/* invert counter mask */
67
unsigned
long
sel_cnt_mask
: 8;
/* counter mask */
68
unsigned
long
sel_res2
: 32;
69
} perfevtsel;
70
}
pfm_gen_ia32_sel_reg_t
;
71
72
typedef
struct
{
73
unsigned
long
cnt_mask
;
/* threshold (cnt_mask) */
74
unsigned
int
flags
;
/* counter specific flag */
75
}
pfmlib_gen_ia32_counter_t
;
76
77
#define PFM_GEN_IA32_SEL_INV 0x1
/* inverse */
78
#define PFM_GEN_IA32_SEL_EDGE 0x2
/* edge detect */
79
#define PFM_GEN_IA32_SEL_ANYTHR 0x4
/* measure on any thread (v3 and up) */
80
81
/*
82
* model-specific parameters for the library
83
*/
84
typedef
struct
{
85
pfmlib_gen_ia32_counter_t
pfp_gen_ia32_counters[
PMU_GEN_IA32_MAX_COUNTERS
];
86
uint64_t reserved[4];
/* for future use */
87
}
pfmlib_gen_ia32_input_param_t
;
88
89
typedef
struct
{
90
uint64_t reserved[8];
/* for future use */
91
}
pfmlib_gen_ia32_output_param_t
;
92
93
#ifdef __cplusplus
/* extern C */
94
}
95
#endif
96
97
#endif
/* __PFMLIB_GEN_IA32_H__ */
pfm_gen_ia32_sel_reg_t::sel_os
unsigned long sel_os
Definition:
pfmlib_gen_ia32.h:60
pfmlib_gen_ia32_counter_t
Definition:
pfmlib_gen_ia32.h:72
pfm_gen_ia32_sel_reg_t::sel_cnt_mask
unsigned long sel_cnt_mask
Definition:
pfmlib_gen_ia32.h:67
pfm_gen_ia32_sel_reg_t::sel_pc
unsigned long sel_pc
Definition:
pfmlib_gen_ia32.h:62
pfm_gen_ia32_sel_reg_t::sel_en
unsigned long sel_en
Definition:
pfmlib_gen_ia32.h:65
pfm_gen_ia32_sel_reg_t::val
unsigned long long val
Definition:
pfmlib_gen_ia32.h:55
pfm_gen_ia32_sel_reg_t::sel_edge
unsigned long sel_edge
Definition:
pfmlib_gen_ia32.h:61
pfm_gen_ia32_sel_reg_t::sel_res2
unsigned long sel_res2
Definition:
pfmlib_gen_ia32.h:68
pfm_gen_ia32_sel_reg_t::sel_inv
unsigned long sel_inv
Definition:
pfmlib_gen_ia32.h:66
pfmlib_gen_ia32_counter_t::flags
unsigned int flags
Definition:
pfmlib_gen_ia32.h:74
pfmlib_gen_ia32_output_param_t
Definition:
pfmlib_gen_ia32.h:89
pfm_gen_ia32_sel_reg_t
Definition:
pfmlib_gen_ia32.h:54
PMU_GEN_IA32_MAX_COUNTERS
#define PMU_GEN_IA32_MAX_COUNTERS
Definition:
pfmlib_gen_ia32.h:44
pfm_gen_ia32_sel_reg_t::sel_event_select
unsigned long sel_event_select
Definition:
pfmlib_gen_ia32.h:57
pfmlib_gen_ia32_counter_t::cnt_mask
unsigned long cnt_mask
Definition:
pfmlib_gen_ia32.h:73
pfmlib.h
pfm_gen_ia32_sel_reg_t::sel_unit_mask
unsigned long sel_unit_mask
Definition:
pfmlib_gen_ia32.h:58
pfm_gen_ia32_sel_reg_t::sel_any
unsigned long sel_any
Definition:
pfmlib_gen_ia32.h:64
pfm_gen_ia32_sel_reg_t::sel_usr
unsigned long sel_usr
Definition:
pfmlib_gen_ia32.h:59
pfm_gen_ia32_sel_reg_t::sel_int
unsigned long sel_int
Definition:
pfmlib_gen_ia32.h:63
pfmlib_gen_ia32_input_param_t
Definition:
pfmlib_gen_ia32.h:84
GaudiProfiling
src
component
perfmon
pfmlib_gen_ia32.h
Generated on Thu Dec 19 2024 15:35:05 for The Gaudi Framework by
1.8.18