MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_power_freq_down

Function check_power_freq_down

dpdk/app/test/test_power_cpufreq.c:265–319  ·  view source on GitHub ↗

Check rte_power_freq_down() */

Source from the content-addressed store, hash-verified

263
264/* Check rte_power_freq_down() */
265static int
266check_power_freq_down(void)
267{
268 int ret;
269
270 rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID);
271
272 /* test with an invalid lcore id */
273 ret = rte_power_freq_down(TEST_POWER_LCORE_INVALID);
274 if (ret >= 0) {
275 printf("Unexpectedly scale down successfully the freq on "
276 "lcore %u\n", TEST_POWER_LCORE_INVALID);
277 return -1;
278 }
279
280 /* Scale down to min and then scale down one step */
281 ret = rte_power_freq_min(TEST_POWER_LCORE_ID);
282 if (ret < 0) {
283 printf("Fail to scale down the freq to min on lcore %u\n",
284 TEST_POWER_LCORE_ID);
285 return -1;
286 }
287 ret = rte_power_freq_down(TEST_POWER_LCORE_ID);
288 if (ret < 0) {
289 printf("Fail to scale down the freq on lcore %u\n",
290 TEST_POWER_LCORE_ID);
291 return -1;
292 }
293
294 /* Check the current frequency */
295 ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false);
296 if (ret < 0)
297 return -1;
298
299 /* Scale up to max and then scale down one step */
300 ret = rte_power_freq_max(TEST_POWER_LCORE_ID);
301 if (ret < 0) {
302 printf("Fail to scale up the freq to max on lcore %u\n",
303 TEST_POWER_LCORE_ID);
304 return -1;
305 }
306 ret = rte_power_freq_down(TEST_POWER_LCORE_ID);
307 if (ret < 0) {
308 printf("Fail to scale down the freq on lcore %u\n",
309 TEST_POWER_LCORE_ID);
310 return -1;
311 }
312
313 /* Check the current frequency */
314 ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false);
315 if (ret < 0)
316 return -1;
317
318 return 0;
319}
320
321/* Check rte_power_freq_up() */
322static int

Callers 1

test_power_cpufreqFunction · 0.85

Calls 2

check_cur_freqFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected