1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 #ifndef POWER_MANAGER_H_
6 #define POWER_MANAGER_H_
12 uint64_t last_branches;
13 uint64_t last_branch_misses;
14 uint16_t global_enabled_cpus;
21 struct core_details *cd;
22 float branch_ratio_threshold;
25 #define BRANCH_RATIO_THRESHOLD 0.1
33 #define RTE_LOGTYPE_POWER_MANAGER RTE_LOGTYPE_USER1
35 /* Maximum number of CPUS to manage */
36 #define POWER_MGR_MAX_CPUS 256
38 * Initialize power management.
39 * Initializes resources and verifies the number of CPUs on the system.
40 * Wraps librte_power int rte_power_init(unsigned lcore_id);
44 * - Negative on error.
46 int power_manager_init(void);
49 * Exit power management. Must be called prior to exiting the application.
53 * - Negative on error.
55 int power_manager_exit(void);
58 * Scale up the frequency of the cores specified in core_mask.
62 * The uint64_t bit-mask of cores to change frequency.
66 * - Negative on error.
68 int power_manager_scale_mask_up(uint64_t core_mask);
71 * Scale down the frequency of the cores specified in core_mask.
75 * The uint64_t bit-mask of cores to change frequency.
79 * - Negative on error.
81 int power_manager_scale_mask_down(uint64_t core_mask);
84 * Scale to the minimum frequency of the cores specified in core_mask.
88 * The uint64_t bit-mask of cores to change frequency.
92 * - Negative on error.
94 int power_manager_scale_mask_min(uint64_t core_mask);
97 * Scale to the maximum frequency of the cores specified in core_mask.
101 * The uint64_t bit-mask of cores to change frequency.
105 * - Negative on error.
107 int power_manager_scale_mask_max(uint64_t core_mask);
110 * Enable Turbo Boost on the cores specified in core_mask.
114 * The uint64_t bit-mask of cores to change frequency.
118 * - Negative on error.
120 int power_manager_enable_turbo_mask(uint64_t core_mask);
123 * Disable Turbo Boost on the cores specified in core_mask.
127 * The uint64_t bit-mask of cores to change frequency.
131 * - Negative on error.
133 int power_manager_disable_turbo_mask(uint64_t core_mask);
136 * Scale up frequency for the core specified by core_num.
140 * The core number to change frequency
144 * - Negative on error.
146 int power_manager_scale_core_up(unsigned core_num);
149 * Scale down frequency for the core specified by core_num.
153 * The core number to change frequency
157 * - 0 if frequency not changed.
158 * - Negative on error.
160 int power_manager_scale_core_down(unsigned core_num);
163 * Scale to minimum frequency for the core specified by core_num.
167 * The core number to change frequency
171 * - 0 if frequency not changed.
172 * - Negative on error.
174 int power_manager_scale_core_min(unsigned core_num);
177 * Scale to maximum frequency for the core specified by core_num.
181 * The core number to change frequency
185 * - 0 if frequency not changed.
186 * - Negative on error.
188 int power_manager_scale_core_max(unsigned core_num);
191 * Enable Turbo Boost for the core specified by core_num.
195 * The core number to boost
199 * - Negative on error.
201 int power_manager_enable_turbo_core(unsigned int core_num);
204 * Disable Turbo Boost for the core specified by core_num.
208 * The core number to boost
212 * - Negative on error.
214 int power_manager_disable_turbo_core(unsigned int core_num);
217 * Get the current freuency of the core specified by core_num
220 * The core number to get the current frequency
224 * - >0 for current frequency.
226 uint32_t power_manager_get_current_frequency(unsigned core_num);
229 * Scale to medium frequency for the core specified by core_num.
233 * The core number to change frequency
237 * - 0 if frequency not changed.
238 * - Negative on error.
240 int power_manager_scale_core_med(unsigned int core_num);
247 #endif /* POWER_MANAGER_H_ */