PAPI 7.1.0.0
Loading...
Searching...
No Matches
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
38extern "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
45typedef 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
63typedef 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 */
74typedef struct {
75 unsigned int pebs_used; /* set to 1 if PEBS is used */
77
78typedef struct {
81 uint64_t reserved[4]; /* for future use */
83
84typedef 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 */
95extern int pfm_core_is_pebs(pfmlib_event_t *e);
96
97#endif /* __PFMLIB_CORE_H__ */
uint16_t reserved
#define PMU_CORE_NUM_COUNTERS
Definition: pfmlib_core.h:43
int pfm_core_is_pebs(pfmlib_event_t *e)
Definition: pfmlib_core.c:880
unsigned long cnt_mask
Definition: pfmlib_core.h:64
unsigned int flags
Definition: pfmlib_core.h:65
pfmlib_core_pebs_t pfp_core_pebs
Definition: pfmlib_core.h:80
unsigned int pebs_used
Definition: pfmlib_core.h:75
unsigned long sel_cnt_mask
Definition: pfmlib_core.h:58
unsigned long sel_os
Definition: pfmlib_core.h:51
unsigned long sel_inv
Definition: pfmlib_core.h:57
unsigned long sel_res1
Definition: pfmlib_core.h:55
unsigned long sel_en
Definition: pfmlib_core.h:56
unsigned long long val
Definition: pfmlib_core.h:46
unsigned long sel_event_select
Definition: pfmlib_core.h:48
unsigned long sel_usr
Definition: pfmlib_core.h:50
unsigned long sel_unit_mask
Definition: pfmlib_core.h:49
unsigned long sel_int
Definition: pfmlib_core.h:54
unsigned long sel_edge
Definition: pfmlib_core.h:52
unsigned long sel_pc
Definition: pfmlib_core.h:53
unsigned long sel_res2
Definition: pfmlib_core.h:59