libmsr  0.3.0
A friendlier interface to accessing MSRs on Intel platforms
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
csr_imc.h
Go to the documentation of this file.
1 /* csr_imc.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 CSR_IMC_H_INCLUDE
35 #define CSR_IMC_H_INCLUDE
36 
37 #include <linux/types.h>
38 
39 #include "master.h"
40 
41 /* Integrated Memory Controller (iMC) CSRs */
42 
43 #define NUMCTRS 8
44 
46 struct pmonctrs_data {
47  uint64_t **ctr0;
48  uint64_t **ctr1;
49  uint64_t **ctr2;
50  uint64_t **ctr3;
51  uint64_t **ctr4;
52  // config
53  uint64_t **ctrcfg0;
54  uint64_t **ctrcfg1;
55  uint64_t **ctrcfg2;
56  uint64_t **ctrcfg3;
57  uint64_t **ctrcfg4;
58 };
59 
62  uint64_t **fctr;
63  // config
64  uint64_t **fctrcfg;
65 };
66 
69  uint64_t **unitctrl;
70  uint64_t **unitstatus;
71 };
72 
76 struct pmonctrs_data *pmon_ctr_storage(void);
77 
82 
87 int init_pmon_ctrs(void);
88 
93 int init_pmonctr_global(void);
94 
114 int pmon_config(uint32_t threshold,
115  uint32_t ovf_en,
116  uint32_t edge_det,
117  uint32_t umask,
118  uint8_t event,
119  const unsigned counter);
120 
136 int set_pmon_unit_ctrl(uint32_t ovf_en,
137  uint16_t freeze_en,
138  uint16_t freeze,
139  uint16_t reset,
140  uint8_t reset_cf);
141 
150 int mem_bw_on_ctr(const unsigned counter,
151  const int type);
152 
156 int mem_pct_rw_on_ctr(const unsigned rcounter,
157  const unsigned wcounter);
158 
163 int mem_page_empty_on_ctr(const unsigned act_count,
164  const unsigned pre_count,
165  const unsigned cas_count);
166 
171 int mem_page_miss_on_ctr(const unsigned pre_count,
172  const unsigned cas_count);
173 
180 int read_imc_counter_batch(const unsigned counter);
181 
189 int print_mem_bw_from_ctr(const unsigned counter,
190  FILE *writedest);
191 
203 int print_mem_pct_rw_from_ctr(const unsigned rcounter,
204  const unsigned wcounter,
205  int type,
206  FILE *writedest);
207 
213 int print_mem_page_empty_from_ctr(const unsigned act,
214  const unsigned pre,
215  const unsigned cas,
216  FILE *writedest);
217 
223 int print_mem_page_miss_from_ctr(const unsigned pre,
224  const unsigned cas,
225  FILE *writedest);
226 
230 int print_pmon_ctrs(void);
231 
232 #endif