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

Function check_power_freqs

dpdk/app/test/test_power_cpufreq.c:135–182  ·  view source on GitHub ↗

Check rte_power_freqs() */

Source from the content-addressed store, hash-verified

133
134/* Check rte_power_freqs() */
135static int
136check_power_freqs(void)
137{
138 uint32_t ret;
139
140 total_freq_num = 0;
141 memset(freqs, 0, sizeof(freqs));
142
143 /* test with an invalid lcore id */
144 ret = rte_power_freqs(TEST_POWER_LCORE_INVALID, freqs,
145 TEST_POWER_FREQS_NUM_MAX);
146 if (ret > 0) {
147 printf("Unexpectedly get available freqs successfully on "
148 "lcore %u\n", TEST_POWER_LCORE_INVALID);
149 return -1;
150 }
151
152 /* test with NULL buffer to save available freqs */
153 ret = rte_power_freqs(TEST_POWER_LCORE_ID, NULL,
154 TEST_POWER_FREQS_NUM_MAX);
155 if (ret > 0) {
156 printf("Unexpectedly get available freqs successfully with "
157 "NULL buffer on lcore %u\n", TEST_POWER_LCORE_ID);
158 return -1;
159 }
160
161 /* test of getting zero number of freqs */
162 ret = rte_power_freqs(TEST_POWER_LCORE_ID, freqs, 0);
163 if (ret > 0) {
164 printf("Unexpectedly get available freqs successfully with "
165 "zero buffer size on lcore %u\n", TEST_POWER_LCORE_ID);
166 return -1;
167 }
168
169 /* test with all valid input parameters */
170 ret = rte_power_freqs(TEST_POWER_LCORE_ID, freqs,
171 TEST_POWER_FREQS_NUM_MAX);
172 if (ret == 0 || ret > TEST_POWER_FREQS_NUM_MAX) {
173 printf("Fail to get available freqs on lcore %u\n",
174 TEST_POWER_LCORE_ID);
175 return -1;
176 }
177
178 /* Save the total number of available freqs */
179 total_freq_num = ret;
180
181 return 0;
182}
183
184/* Check rte_power_get_freq() */
185static int

Callers 1

test_power_cpufreqFunction · 0.85

Calls 2

memsetFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected