#!/usr/bin/bc -l # # Compute the allowed sending rate X_calc using the formula of [RFC 3448, 3.1]. # # This script can be run standalone, or using a pipe. # For example, to compute for # * s=1424 bytes, # * RTT= 150 milliseconds, and # * p = 10 %, # use # echo 1424 150 10 | ./throughput_calculator.bc # # The result is about 132 Kbits/sec scale = 3 define f(p) { return sqrt(2*p/3) + 12 * sqrt(3*p/8) * (32 * p^3 + p) } define xcalc(s,r,p) { return s*8 * 10^3/(r * f(p/100.0)) } print "TFRC throughput calculator\n\n" print "s in bytes: "; s = read() print "RTT in msecs: "; r = read() print "p in % : "; p = read() print "\nXcalc = ", xcalc(s,r,p) / 1024.0, " Kbits/sec\n" quit