| 293 | } |
| 294 | |
| 295 | static void |
| 296 | print_route_distribution(const struct route_rule *table, uint32_t n) |
| 297 | { |
| 298 | unsigned int i, j; |
| 299 | |
| 300 | printf("Route distribution per prefix width:\n"); |
| 301 | printf("DEPTH QUANTITY (PERCENT)\n"); |
| 302 | printf("---------------------------\n"); |
| 303 | |
| 304 | /* Count depths. */ |
| 305 | for (i = 1; i <= 32; i++) { |
| 306 | unsigned int depth_counter = 0; |
| 307 | double percent_hits; |
| 308 | |
| 309 | for (j = 0; j < n; j++) |
| 310 | if (table[j].depth == (uint8_t) i) |
| 311 | depth_counter++; |
| 312 | |
| 313 | percent_hits = ((double)depth_counter)/((double)n) * 100; |
| 314 | printf("%.2u%15u (%.2f)\n", i, depth_counter, percent_hits); |
| 315 | } |
| 316 | printf("\n"); |
| 317 | } |
| 318 | |
| 319 | static int |
| 320 | test_fib_perf(void) |
no test coverage detected