| The Gaudi Framework v32r1 (f65d50dc)

perfmon_v2.h
Go to the documentation of this file.
1 /*
2 * This file contains the user level interface description for
3 * the perfmon-2.x interface on Linux.
4 *
5 * Copyright (c) 2001-2006 Hewlett-Packard Development Company, L.P.
6 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
7 */
8 #ifndef __PERFMON_V2_H__
9 #define __PERFMON_V2_H__
10
11 #ifndef __PERFMON_H__
12 # error "this file should never be included directly, use perfmon.h instead"
13 #endif
14
15 /*
16 * argument to v2.3 and onward pfm_create_context()
17 */
18 typedef struct {
19 uint32_t ctx_flags; /* noblock/block/syswide */
20 uint32_t ctx_reserved1; /* for future use */
21 uint64_t ctx_reserved3[7]; /* for future use */
22 } pfarg_ctx_t;
23
24 /*
25 * argument for pfm_write_pmcs()
26 */
27 typedef struct {
28 uint16_t reg_num; /* which register */
29 uint16_t reg_set; /* event set for this register */
30 uint32_t reg_flags; /* REGFL flags */
31 uint64_t reg_value; /* pmc value */
32 uint64_t reg_reserved2[4]; /* for future use */
33 } pfarg_pmc_t;
34
35 /*
36 * argument pfm_write_pmds() and pfm_read_pmds()
37 */
38 typedef struct {
39 uint16_t reg_num; /* which register */
40 uint16_t reg_set; /* event set for this register */
41 uint32_t reg_flags; /* REGFL flags */
42 uint64_t reg_value; /* initial pmc/pmd value */
43 uint64_t reg_long_reset; /* reset after buffer overflow notification */
44 uint64_t reg_short_reset; /* reset after counter overflow */
45 uint64_t reg_last_reset_val; /* return: PMD last reset value */
46 uint64_t reg_ovfl_switch_cnt; /* how many overflow before switch for next set */
47 uint64_t reg_reset_pmds[PFM_PMD_BV]; /* which other PMDS to reset on overflow */
48 uint64_t reg_smpl_pmds[PFM_PMD_BV]; /* which other PMDS to record when the associated PMD overflows */
49 uint64_t reg_smpl_eventid; /* opaque sampling event identifier */
50 uint64_t reg_random_mask; /* bitmask used to limit random value */
51 uint32_t reg_random_seed; /* seed for randomization (DEPRECATED) */
52 uint32_t reg_reserved2[7]; /* for future use */
53 } pfarg_pmd_t;
54
55 /*
56 * optional argument to pfm_start(), pass NULL if no arg needed
57 */
58 typedef struct {
59 uint16_t start_set; /* event set to start with */
60 uint16_t start_reserved1; /* for future use */
61 uint32_t start_reserved2; /* for future use */
62 uint64_t reserved3[3]; /* for future use */
63 } pfarg_start_t;
64
65 /*
66 * argument to pfm_load_context()
67 */
68 typedef struct {
69 uint32_t load_pid; /* thread or CPU to attach to */
70 uint16_t load_set; /* set to load first */
71 uint16_t load_reserved1; /* for future use */
72 uint64_t load_reserved2[3]; /* for future use */
73 } pfarg_load_t;
74
75 #ifndef PFMLIB_OLD_PFMV2
76 typedef struct {
77 uint16_t set_id; /* which set */
78 uint16_t set_reserved1; /* for future use */
79 uint32_t set_flags; /* SETFL flags */
80 uint64_t set_timeout; /* requested/effective switch timeout in nsecs */
81 uint64_t reserved[6]; /* for future use */
82 } pfarg_setdesc_t;
83
84 typedef struct {
85 uint16_t set_id; /* which set */
86 uint16_t set_reserved1; /* for future use */
87 uint32_t set_flags; /* for future use */
88 uint64_t set_ovfl_pmds[PFM_PMD_BV]; /* out: last ovfl PMDs */
89 uint64_t set_runs; /* out: #times set was active */
90 uint64_t set_timeout; /* out: leftover switch timeout (nsecs) */
91 uint64_t set_act_duration; /* out: time set was active (nsecs) */
92 uint64_t set_avail_pmcs[PFM_PMC_BV]; /* out: available PMCs */
93 uint64_t set_avail_pmds[PFM_PMD_BV]; /* out: available PMDs */
94 uint64_t set_reserved3[6]; /* for future use */
95 } pfarg_setinfo_t;
96 #endif
97
98 #ifdef PFMLIB_OLD_PFMV2
99
100 /*
101 * argument to pfm_create_evtsets()/pfm_delete_evtsets()
102 */
103 typedef struct {
104 uint16_t set_id; /* which set */
105 uint16_t set_id_next; /* next set to go to (must use PFM_SETFL_EXPL_NEXT) */
106 uint32_t set_flags; /* SETFL flags */
107 uint64_t set_timeout; /* requested switch timeout in nsecs */
108 uint64_t set_mmap_offset; /* cookie to pass as mmap offset to access 64-bit virtual PMD */
109 uint64_t reserved[5]; /* for future use */
110 } pfarg_setdesc_t;
111
112 /*
113 * argument to pfm_getinfo_evtsets()
114 */
115 typedef struct {
116 uint16_t set_id; /* which set */
117 uint16_t set_id_next; /* output: next set to go to (must use PFM_SETFL_EXPL_NEXT) */
118 uint32_t set_flags; /* output: SETFL flags */
119 uint64_t set_ovfl_pmds[PFM_PMD_BV]; /* output: last ovfl PMDs which triggered a switch from set */
120 uint64_t set_runs; /* output: number of times the set was active */
121 uint64_t set_timeout; /* output:effective/leftover switch timeout in nsecs */
122 uint64_t set_act_duration; /* number of cycles set was active (syswide only) */
123 uint64_t set_mmap_offset; /* cookie to pass as mmap offset to access 64-bit virtual PMD */
124 uint64_t set_avail_pmcs[PFM_PMC_BV];
125 uint64_t set_avail_pmds[PFM_PMD_BV];
126 uint64_t reserved[4]; /* for future use */
127 } pfarg_setinfo_t;
128
129 # ifdef __crayx2
130 # define PFM_MAX_HW_PMDS 512
131 # else
132 # define PFM_MAX_HW_PMDS 256
133 # endif
134 # define PFM_HW_PMD_BV PFM_BVSIZE( PFM_MAX_HW_PMDS )
135
136 typedef struct {
137 uint32_t msg_type; /* PFM_MSG_OVFL */
138 uint32_t msg_ovfl_pid; /* process id */
139 uint64_t msg_ovfl_pmds[PFM_HW_PMD_BV]; /* which PMDs overflowed */
140 uint16_t msg_active_set; /* active set at the time of overflow */
141 uint16_t msg_ovfl_cpu; /* cpu on which the overflow occurred */
142 uint32_t msg_ovfl_tid; /* thread id */
143 uint64_t msg_ovfl_ip; /* instruction pointer where overflow interrupt happened */
144 } pfarg_ovfl_msg_t;
145
146 #endif /* PFMLIB_OLD_PFMV2 */
147
148 extern os_err_t pfm_create_context( pfarg_ctx_t* ctx, char* smpl_name, void* smpl_arg, size_t smpl_size );
149 extern os_err_t pfm_write_pmcs( int fd, pfarg_pmc_t* pmcs, int count );
150 extern os_err_t pfm_write_pmds( int fd, pfarg_pmd_t* pmds, int count );
151 extern os_err_t pfm_read_pmds( int fd, pfarg_pmd_t* pmds, int count );
152 extern os_err_t pfm_load_context( int fd, pfarg_load_t* load );
153 extern os_err_t pfm_start( int fd, pfarg_start_t* start );
154 extern os_err_t pfm_stop( int fd );
155 extern os_err_t pfm_restart( int fd );
156 extern os_err_t pfm_create_evtsets( int fd, pfarg_setdesc_t* setd, int count );
157 extern os_err_t pfm_getinfo_evtsets( int fd, pfarg_setinfo_t* info, int count );
158 extern os_err_t pfm_delete_evtsets( int fd, pfarg_setdesc_t* setd, int count );
159 extern os_err_t pfm_unload_context( int fd );
160
161 #endif /* _PERFMON_V2_H */
pfm_getinfo_evtsets
os_err_t pfm_getinfo_evtsets(int fd, pfarg_setinfo_t *info, int count)
pfarg_setinfo_t::set_timeout
uint64_t set_timeout
Definition: perfmon_v2.h:90
pfarg_pmd_t::reg_short_reset
uint64_t reg_short_reset
Definition: perfmon_v2.h:44
pfarg_pmc_t::reg_flags
uint32_t reg_flags
Definition: perfmon_v2.h:30
pfm_write_pmds
os_err_t pfm_write_pmds(int fd, pfarg_pmd_t *pmds, int count)
pfarg_setinfo_t::set_act_duration
uint64_t set_act_duration
Definition: perfmon_v2.h:91
gaudirun.fd
fd
Definition: gaudirun.py:559
pfm_create_context
os_err_t pfm_create_context(pfarg_ctx_t *ctx, char *smpl_name, void *smpl_arg, size_t smpl_size)
PFM_PMC_BV
#define PFM_PMC_BV
Definition: perfmon.h:58
pfarg_pmd_t::reg_ovfl_switch_cnt
uint64_t reg_ovfl_switch_cnt
Definition: perfmon_v2.h:46
pfarg_setdesc_t::set_id
uint16_t set_id
Definition: perfmon_v2.h:77
pfm_delete_evtsets
os_err_t pfm_delete_evtsets(int fd, pfarg_setdesc_t *setd, int count)
os_err_t
int os_err_t
Definition: perfmon.h:69
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
uint64_t
unsigned long long uint64_t
Definition: instrset.h:143
pfarg_ovfl_msg_t
Definition: perfmon.h:184
pfarg_setinfo_t::set_reserved1
uint16_t set_reserved1
Definition: perfmon_v2.h:86
uint16_t
unsigned short int uint16_t
Definition: instrset.h:139
pfm_write_pmcs
os_err_t pfm_write_pmcs(int fd, pfarg_pmc_t *pmcs, int count)
IOTest.start
def start
Definition: IOTest.py:97
pfm_unload_context
os_err_t pfm_unload_context(int fd)
pfarg_pmd_t::reg_random_seed
uint32_t reg_random_seed
Definition: perfmon_v2.h:51
pfarg_load_t
Definition: perfmon_v2.h:68
pfarg_pmd_t::reg_long_reset
uint64_t reg_long_reset
Definition: perfmon_v2.h:43
pfarg_load_t::load_set
uint16_t load_set
Definition: perfmon_v2.h:70
pfarg_start_t::start_set
uint16_t start_set
Definition: perfmon_v2.h:59
pfarg_ctx_t::ctx_flags
uint32_t ctx_flags
Definition: perfmon_v2.h:19
pfarg_setinfo_t::set_flags
uint32_t set_flags
Definition: perfmon_v2.h:87
pfarg_pmd_t::reg_set
uint16_t reg_set
Definition: perfmon_v2.h:40
pfarg_setdesc_t
Definition: perfmon_v2.h:76
pfarg_pmd_t::reg_flags
uint32_t reg_flags
Definition: perfmon_v2.h:41
pfm_restart
os_err_t pfm_restart(int fd)
pfarg_pmd_t::reg_smpl_eventid
uint64_t reg_smpl_eventid
Definition: perfmon_v2.h:49
pfarg_load_t::load_reserved1
uint16_t load_reserved1
Definition: perfmon_v2.h:71
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
pfm_create_evtsets
os_err_t pfm_create_evtsets(int fd, pfarg_setdesc_t *setd, int count)
pfarg_setdesc_t::set_reserved1
uint16_t set_reserved1
Definition: perfmon_v2.h:78
pfarg_pmd_t
Definition: perfmon_v2.h:38
pfarg_ctx_t
Definition: perfmon_v2.h:18
pfarg_setinfo_t::set_id
uint16_t set_id
Definition: perfmon_v2.h:85
pfm_start
os_err_t pfm_start(int fd, pfarg_start_t *start)
pfarg_start_t::start_reserved2
uint32_t start_reserved2
Definition: perfmon_v2.h:61
uint32_t
unsigned int uint32_t
Definition: instrset.h:141
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
pfarg_pmc_t::reg_set
uint16_t reg_set
Definition: perfmon_v2.h:29
pfarg_setdesc_t::set_flags
uint32_t set_flags
Definition: perfmon_v2.h:79
pfarg_pmc_t
Definition: perfmon_v2.h:27
pfarg_setinfo_t::set_runs
uint64_t set_runs
Definition: perfmon_v2.h:89
pfarg_setinfo_t
Definition: perfmon_v2.h:84
pfarg_setdesc_t::set_timeout
uint64_t set_timeout
Definition: perfmon_v2.h:80
PFM_PMD_BV
#define PFM_PMD_BV
Definition: perfmon.h:57
pfm_load_context
os_err_t pfm_load_context(int fd, pfarg_load_t *load)
pfarg_start_t
Definition: perfmon_v2.h:58
pfm_read_pmds
os_err_t pfm_read_pmds(int fd, pfarg_pmd_t *pmds, int count)
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
pfarg_pmd_t::reg_random_mask
uint64_t reg_random_mask
Definition: perfmon_v2.h:50
pfarg_start_t::start_reserved1
uint16_t start_reserved1
Definition: perfmon_v2.h:60
pfarg_pmd_t::reg_last_reset_val
uint64_t reg_last_reset_val
Definition: perfmon_v2.h:45
pfm_stop
os_err_t pfm_stop(int fd)
pfarg_ctx_t::ctx_reserved1
uint32_t ctx_reserved1
Definition: perfmon_v2.h:20
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42