I created some Java code that measures latency, packet size, and throughput.
What is the equation needed to calculate latency?
This is what I am currently using, but not sure if this is correct:
//latency = packetsize / delay + bandwidth System.out.println("latency is " + (len*2) / (duration + transferRateMb));
CHANGE length is multiplied by 2 to give the correct value in bytes
duration is the time it takes to complete ping
transfer rate is determined by:
double transferRateMb = ((len*524288.0) / (duration/ 1000000000.0) ) ; //amount of data in megabytes transferred in 1 second.
I read various manuals and do not understand them, this is just a requirement for the project
it will also be executed 20 times, and the average value
any ideas?
source share