| 164 | } |
| 165 | |
| 166 | int |
| 167 | main(int argc, char **argv) |
| 168 | { |
| 169 | int ret; |
| 170 | |
| 171 | ret = rte_eal_init(argc, argv); |
| 172 | if (ret < 0) |
| 173 | rte_panic("Cannot init EAL\n"); |
| 174 | |
| 175 | uint32_t i; |
| 176 | for (i = 0; i < NUM_SERVICES; i++) { |
| 177 | services[i].callback_userdata = 0; |
| 178 | uint32_t id; |
| 179 | /* Register a service as an application. 8< */ |
| 180 | ret = rte_service_component_register(&services[i], &id); |
| 181 | if (ret) |
| 182 | rte_exit(-1, "service register() failed"); |
| 183 | |
| 184 | /* set the service itself to be ready to run. In the case of |
| 185 | * ethdev, eventdev etc PMDs, this will be set when the |
| 186 | * appropriate configure or setup function is called. |
| 187 | */ |
| 188 | rte_service_component_runstate_set(id, 1); |
| 189 | |
| 190 | /* Collect statistics for the service */ |
| 191 | rte_service_set_stats_enable(id, 1); |
| 192 | |
| 193 | /* the application sets the service to be active. Note that the |
| 194 | * previous component_runstate_set() is the PMD indicating |
| 195 | * ready, while this function is the application setting the |
| 196 | * service to run. Applications can choose to not run a service |
| 197 | * by setting runstate to 0 at any time. |
| 198 | */ |
| 199 | ret = rte_service_runstate_set(id, 1); |
| 200 | if (ret) |
| 201 | return -ENOEXEC; |
| 202 | /* >8 End of registering a service as an application. */ |
| 203 | } |
| 204 | |
| 205 | i = 0; |
| 206 | while (1) { |
| 207 | const char clr[] = { 27, '[', '2', 'J', '\0' }; |
| 208 | const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' }; |
| 209 | printf("%s%s", clr, topLeft); |
| 210 | |
| 211 | apply_profile(i); |
| 212 | printf("\n==> Profile: %s\n\n", profiles[i].name); |
| 213 | |
| 214 | rte_delay_us_sleep(1 * US_PER_S); |
| 215 | rte_service_dump(stdout, UINT32_MAX); |
| 216 | |
| 217 | rte_delay_us_sleep(5 * US_PER_S); |
| 218 | rte_service_dump(stdout, UINT32_MAX); |
| 219 | |
| 220 | i++; |
| 221 | if (i >= NUM_PROFILES) |
| 222 | i = 0; |
| 223 | } |
nothing calls this directly
no test coverage detected