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
36 * Initialize power management.
37 * Initializes resources and verifies the number of CPUs on the system.
38 * Wraps librte_power int rte_power_init(unsigned lcore_id);
42 * - Negative on error.
44 int power_manager_init(void);
47 * Exit power management. Must be called prior to exiting the application.
51 * - Negative on error.
53 int power_manager_exit(void);
56 * Scale up the frequency of the cores specified in core_mask.
60 * The uint64_t bit-mask of cores to change frequency.
64 * - Negative on error.
66 int power_manager_scale_mask_up(uint64_t core_mask);
69 * Scale down the frequency of the cores specified in core_mask.
73 * The uint64_t bit-mask of cores to change frequency.
77 * - Negative on error.
79 int power_manager_scale_mask_down(uint64_t core_mask);
82 * Scale to the minimum frequency of the cores specified in core_mask.
86 * The uint64_t bit-mask of cores to change frequency.
90 * - Negative on error.
92 int power_manager_scale_mask_min(uint64_t core_mask);
95 * Scale to the maximum frequency of the cores specified in core_mask.
99 * The uint64_t bit-mask of cores to change frequency.
103 * - Negative on error.
105 int power_manager_scale_mask_max(uint64_t core_mask);
108 * Enable Turbo Boost on the cores specified in core_mask.
112 * The uint64_t bit-mask of cores to change frequency.
116 * - Negative on error.
118 int power_manager_enable_turbo_mask(uint64_t core_mask);
121 * Disable Turbo Boost on the cores specified in core_mask.
125 * The uint64_t bit-mask of cores to change frequency.
129 * - Negative on error.
131 int power_manager_disable_turbo_mask(uint64_t core_mask);
134 * Scale up frequency for the core specified by core_num.
138 * The core number to change frequency
142 * - Negative on error.
144 int power_manager_scale_core_up(unsigned core_num);
147 * Scale down frequency for the core specified by core_num.
151 * The core number to change frequency
155 * - 0 if frequency not changed.
156 * - Negative on error.
158 int power_manager_scale_core_down(unsigned core_num);
161 * Scale to minimum frequency for the core specified by core_num.
165 * The core number to change frequency
169 * - 0 if frequency not changed.
170 * - Negative on error.
172 int power_manager_scale_core_min(unsigned core_num);
175 * Scale to maximum frequency for the core specified by core_num.
179 * The core number to change frequency
183 * - 0 if frequency not changed.
184 * - Negative on error.
186 int power_manager_scale_core_max(unsigned core_num);
189 * Enable Turbo Boost for the core specified by core_num.
193 * The core number to boost
197 * - Negative on error.
199 int power_manager_enable_turbo_core(unsigned int core_num);
202 * Disable Turbo Boost for the core specified by core_num.
206 * The core number to boost
210 * - Negative on error.
212 int power_manager_disable_turbo_core(unsigned int core_num);
215 * Get the current freuency of the core specified by core_num
218 * The core number to get the current frequency
222 * - >0 for current frequency.
224 uint32_t power_manager_get_current_frequency(unsigned core_num);
227 * Scale to medium frequency for the core specified by core_num.
231 * The core number to change frequency
235 * - 0 if frequency not changed.
236 * - Negative on error.
238 int power_manager_scale_core_med(unsigned int core_num);
245 #endif /* POWER_MANAGER_H_ */