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

Function check_power_set_freq

dpdk/app/test/test_power_cpufreq.c:215–262  ·  view source on GitHub ↗

Check rte_power_set_freq() */

Source from the content-addressed store, hash-verified

213
214/* Check rte_power_set_freq() */
215static int
216check_power_set_freq(void)
217{
218 int ret;
219
220 /* test with an invalid lcore id */
221 ret = rte_power_set_freq(TEST_POWER_LCORE_INVALID, 0);
222 if (ret >= 0) {
223 printf("Unexpectedly set freq index successfully on "
224 "lcore %u\n", TEST_POWER_LCORE_INVALID);
225 return -1;
226 }
227
228 /* test with an invalid freq index */
229 ret = rte_power_set_freq(TEST_POWER_LCORE_ID,
230 TEST_POWER_FREQS_NUM_MAX);
231 if (ret >= 0) {
232 printf("Unexpectedly set an invalid freq index (%u)"
233 "successfully on lcore %u\n", TEST_POWER_FREQS_NUM_MAX,
234 TEST_POWER_LCORE_ID);
235 return -1;
236 }
237
238 /**
239 * test with an invalid freq index which is right one bigger than
240 * total number of freqs
241 */
242 ret = rte_power_set_freq(TEST_POWER_LCORE_ID, total_freq_num);
243 if (ret >= 0) {
244 printf("Unexpectedly set an invalid freq index (%u)"
245 "successfully on lcore %u\n", total_freq_num,
246 TEST_POWER_LCORE_ID);
247 return -1;
248 }
249 ret = rte_power_set_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
250 if (ret < 0) {
251 printf("Fail to set freq index on lcore %u\n",
252 TEST_POWER_LCORE_ID);
253 return -1;
254 }
255
256 /* Check the current frequency */
257 ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false);
258 if (ret < 0)
259 return -1;
260
261 return 0;
262}
263
264/* Check rte_power_freq_down() */
265static int

Callers 1

test_power_cpufreqFunction · 0.85

Calls 2

check_cur_freqFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected