| The Gaudi Framework v29r1 (5cd95fa2)

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

- File List
- File Members

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