libmsr  0.3.0
A friendlier interface to accessing MSRs on Intel platforms
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
msr_clocks.h
Go to the documentation of this file.
1 /* msr_clocks.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_CLOCKS_H_INCLUDE
35 #define MSR_CLOCKS_H_INCLUDE
36 
37 #include <stdint.h>
38 
39 #include "master.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
52 struct clock_mod {
54  uint64_t raw;
59  // Value | Duty Cycle
60  // 000b = 0 | Reserved
61  // 001b = 1 | 12.5% (default)
62  // 010b = 2 | 25.0%
63  // 011b = 3 | 37.5%
64  // 100b = 4 | 50.0%
65  // 101b = 5 | 63.5%
66  // 110b = 6 | 75.0%
67  // 111b = 7 | 87.5%
68 };
69 
72 struct clocks_data {
74  uint64_t **aperf;
76  uint64_t **mperf;
78  uint64_t **tsc;
79 };
80 
82 struct perf_data {
84  uint64_t **perf_status;
86  uint64_t **perf_ctl;
87 };
88 
95 void clocks_storage(struct clocks_data **cd);
96 
101 void perf_storage(struct perf_data **pd);
102 
106 void dump_clocks_data_terse_label(FILE *writedest);
107 
111 void dump_clocks_data_terse(FILE *writedest);
112 
116 void dump_p_state(FILE *writedest);
117 
123 void set_p_state(unsigned socket,
124  uint64_t pstate);
125 
129 void dump_clocks_data_readable(FILE *writedest);
130 
131 /****************************************/
132 /* Software Controlled Clock Modulation */
133 /****************************************/
134 
140 void dump_clock_mod(struct clock_mod *s,
141  FILE *writedest);
142 
150 void get_clock_mod(int socket,
151  int core,
152  struct clock_mod *s);
153 
161 int set_clock_mod(int socket,
162  int core,
163  struct clock_mod *s);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 #endif