Showing posts with label Coding best pratice. Show all posts
Showing posts with label Coding best pratice. Show all posts

Tuesday, April 6, 2010

Transfert Speed Calculation

Whats the best way to calculate transfer speed?
Currently i made a byte transfered counter, which is resetted everytime its read by an external module. External module is responsible for calculating the time interval between each read, but if I want to use the speed in another module i'm screwed..
Also thought of having a map with ticks since started as key and packetsize as value. This way i could get every packet size that happened in the last X seconds and calculate current speed but I think that cleanup would require too much cpu...