libmsr
0.3.0
A friendlier interface to accessing MSRs on Intel platforms
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Enumerations
Enumerator
Macros
Pages
include
msr_counters.h
Go to the documentation of this file.
1
/* msr_counters.h
2
*
3
* Copyright (c) 2011-2016, Lawrence Livermore National Security, LLC.
4
* LLNL-CODE-645430
5
*
6
* Produced at Lawrence Livermore National Laboratory
7
* Written by Barry Rountree, rountree@llnl.gov
8
* Scott Walker, walker91@llnl.gov
9
* Kathleen Shoga, shoga1@llnl.gov
10
*
11
* All rights reserved.
12
*
13
* This file is part of libmsr.
14
*
15
* libmsr is free software: you can redistribute it and/or modify it under the
16
* terms of the GNU Lesser General Public License as published by the Free
17
* Software Foundation, either version 3 of the License, or (at your option)
18
* any later version.
19
*
20
* libmsr is distributed in the hope that it will be useful, but WITHOUT ANY
21
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
23
* details.
24
*
25
* You should have received a copy of the GNU Lesser General Public License
26
* along with libmsr. If not, see <http://www.gnu.org/licenses/>.
27
*
28
* This material is based upon work supported by the U.S. Department of
29
* Energy's Lawrence Livermore National Laboratory. Office of Science, under
30
* Award number DE-AC52-07NA27344.
31
*
32
*/
33
34
#ifndef MSR_COUNTERS_H_INCLUDE
35
#define MSR_COUNTERS_H_INCLUDE
36
37
#include <stdint.h>
38
#include <stdio.h>
39
40
#include "
msr_core.h
"
41
#include "
master.h
"
42
43
// Note: It should not matter which platform header (i.e., master header) you
44
// are using because the counter MSRs are architectural and should remain
45
// consistent across platforms.
46
47
#ifdef __cplusplus
48
extern
"C"
{
49
#endif
50
54
struct
fixed_counter
{
57
uint64_t *
enable
;
61
uint64_t *
ring_level
;
65
uint64_t *
anyThread
;
69
uint64_t *
pmi
;
71
uint64_t **
value
;
72
uint64_t *
overflow
;
73
};
74
77
struct
fixed_counter_config
{
80
int
num_counters
;
82
int
width
;
83
};
84
86
struct
perfevtsel
{
88
uint64_t **
perf_evtsel0
;
90
uint64_t **
perf_evtsel1
;
92
uint64_t **
perf_evtsel2
;
94
uint64_t **
perf_evtsel3
;
96
uint64_t **
perf_evtsel4
;
98
uint64_t **
perf_evtsel5
;
100
uint64_t **
perf_evtsel6
;
102
uint64_t **
perf_evtsel7
;
103
};
104
106
struct
pmc
{
108
uint64_t **
pmc0
;
110
uint64_t **
pmc1
;
112
uint64_t **
pmc2
;
114
uint64_t **
pmc3
;
116
uint64_t **
pmc4
;
118
uint64_t **
pmc5
;
120
uint64_t **
pmc6
;
122
uint64_t **
pmc7
;
123
};
124
127
struct
unc_perfevtsel
{
129
uint64_t **
c0
;
131
uint64_t **
c1
;
133
uint64_t **
c2
;
135
uint64_t **
c3
;
136
};
137
140
struct
unc_counters
{
142
uint64_t **
c0
;
144
uint64_t **
c1
;
146
uint64_t **
c2
;
148
uint64_t **
c3
;
149
};
150
152
void
print_available_counters
(
void
);
153
154
/*************************************/
155
/* Programmable Performance Counters */
156
/*************************************/
157
161
void
perfevtsel_storage
(
struct
perfevtsel
**e);
162
166
void
pmc_storage
(
struct
pmc
**p);
167
183
void
set_pmc_ctrl_flags
(uint64_t cmask,
184
uint64_t flags,
185
uint64_t umask,
186
uint64_t eventsel,
187
int
pmcnum,
188
unsigned
thread);
189
204
void
set_all_pmc_ctrl
(uint64_t cmask,
205
uint64_t flags,
206
uint64_t umask,
207
uint64_t eventsel,
208
int
pmcnum);
209
214
int
enable_pmc
(
void
);
215
217
void
clear_all_pmc
(
void
);
218
224
int
clear_pmc
(
int
idx);
225
229
void
dump_pmc_data_readable
(FILE *writedest);
230
231
/*************************************/
232
/* Uncore PCU Performance Monitoring */
233
/*************************************/
234
239
void
unc_perfevtsel_storage
(
struct
unc_perfevtsel
**uevt);
240
246
void
unc_counters_storage
(
struct
unc_counters
**uc);
247
264
void
set_pcu_ctrl_flags
(uint64_t flags,
265
uint64_t reset,
266
uint64_t occ,
267
uint64_t eventsel,
268
int
pcunum,
269
unsigned
socket);
270
287
void
set_all_pcu_ctrl
(uint64_t flags,
288
uint64_t reset,
289
uint64_t occ,
290
uint64_t eventsel,
291
int
pcunum);
292
294
void
enable_pcu
(
void
);
295
297
void
clear_all_pcu
(
void
);
298
304
int
clear_pcu
(
int
idx);
305
309
void
dump_unc_counter_data_label
(FILE *writedest);
310
314
void
dump_unc_counter_data
(FILE *writedest);
315
316
/*****************************************/
317
/* Fixed Counters Performance Monitoring */
318
/*****************************************/
319
329
void
fixed_counter_storage
(
struct
fixed_counter
**ctr0,
330
struct
fixed_counter
**ctr1,
331
struct
fixed_counter
**ctr2);
332
343
void
fixed_counter_ctrl_storage
(uint64_t ***perf_ctrl,
344
uint64_t ***fixed_ctrl);
345
349
void
init_fixed_counter
(
struct
fixed_counter
*ctr);
350
360
void
get_fixed_counter_ctrl
(
struct
fixed_counter
*ctr0,
361
struct
fixed_counter
*ctr1,
362
struct
fixed_counter
*ctr2);
363
373
void
set_fixed_counter_ctrl
(
struct
fixed_counter
*ctr0,
374
struct
fixed_counter
*ctr1,
375
struct
fixed_counter
*ctr2);
376
382
void
get_fixed_counter_config
(
struct
fixed_counter_config
*data);
383
386
void
enable_fixed_counters
(
void
);
387
390
void
disable_fixed_counters
(
void
);
391
395
void
dump_fixed_counter_data_terse
(FILE *writedest);
396
401
void
dump_fixed_counter_data_terse_label
(FILE *writedest);
402
406
void
dump_fixed_counter_data_readable
(FILE *writedest);
407
408
#ifdef __cplusplus
409
}
410
#endif
411
#endif
Generated by
1.8.2