| 28 | #define NUMBER_TBL8S (1 << 16) |
| 29 | |
| 30 | static void |
| 31 | print_route_distribution(const struct rules_tbl_entry *table, uint32_t n) |
| 32 | { |
| 33 | unsigned int i, j; |
| 34 | |
| 35 | printf("Route distribution per prefix width:\n"); |
| 36 | printf("DEPTH QUANTITY (PERCENT)\n"); |
| 37 | printf("---------------------------\n"); |
| 38 | |
| 39 | /* Count depths. */ |
| 40 | for (i = 1; i <= 128; i++) { |
| 41 | unsigned int depth_counter = 0; |
| 42 | double percent_hits; |
| 43 | |
| 44 | for (j = 0; j < n; j++) |
| 45 | if (table[j].depth == (uint8_t) i) |
| 46 | depth_counter++; |
| 47 | |
| 48 | percent_hits = ((double)depth_counter)/((double)n) * 100; |
| 49 | printf("%.2u%15u (%.2f)\n", i, depth_counter, percent_hits); |
| 50 | } |
| 51 | printf("\n"); |
| 52 | } |
| 53 | |
| 54 | static inline uint8_t |
| 55 | bits_in_nh(uint8_t nh_sz) |
no test coverage detected