Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to average upload and download speed using dstat -n. How can I add all the received and sent datas that appear after dstat -n , so that I can add them and find average upload and download speed over some period of time

share|improve this question

1 Answer 1

As no one answered,I have figured it out. Here is how to do it. Let's say we need to average it for "2 min(120 sec)". First write it to a file named stat.txt.Refresh every second fro 120 times.

dstat -n 1 120 >> stat.txt

Add the columns of stat.txt

awk -F" " '{t1=t1+$1;t2=t2+$2}END{t1=t1/120;t2=t2/120;print t1"\t"t2}' stat.txt

Remove stat.txt

rm stat.txt

We can make a script too from these commands.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.