* calculate the drop probability */
| 212 | * calculate the drop probability |
| 213 | */ |
| 214 | static double calc_drop_prob(uint32_t min_th, uint32_t max_th, |
| 215 | uint32_t maxp_inv, uint32_t avg) |
| 216 | { |
| 217 | double drop_prob = 0.0; |
| 218 | |
| 219 | if (avg < min_th) { |
| 220 | drop_prob = 0.0; |
| 221 | } else if (avg < max_th) { |
| 222 | drop_prob = (1.0 / (double)maxp_inv) |
| 223 | * ((double)(avg - min_th) |
| 224 | / (double)(max_th - min_th)); |
| 225 | } else { |
| 226 | drop_prob = 1.0; |
| 227 | } |
| 228 | return drop_prob; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * check if drop rate matches drop probability within tolerance |
no outgoing calls
no test coverage detected