User Tools

Site Tools


howtos:calculate_average

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:calculate_average [d/m/Y H:i] (current)
Line 1: Line 1:
 +Given result.txt looks like shown bellow, this two example calculates the Upload and Download average values:
  
 +<​code>​
 +cat result.txt |grep Upload|awk '{ sum += $2 } END { if (NR > 0) print sum / NR }'
 +
 +cat result.txt |grep Download|awk '{ sum += $2 } END { if (NR > 0) print sum / NR }'
 +
 +</​code>​
 +
 +<​file>​
 +Tue Aug  8 16:44:15 CEST 2017
 +Ping: 14.859 ms
 +Download: 444.21 Mbit/s
 +Upload: 38.20 Mbit/s
 +Tue Aug  8 16:44:38 CEST 2017
 +Ping: 14.195 ms
 +Download: 363.48 Mbit/s
 +Upload: 76.13 Mbit/s
 +Tue Aug  8 16:45:00 CEST 2017
 +Ping: 15.078 ms
 +Download: 244.67 Mbit/s
 +Upload: 82.88 Mbit/s
 +Tue Aug  8 16:45:27 CEST 2017
 +Ping: 14.327 ms
 +Download: 508.94 Mbit/s
 +Upload: 57.22 Mbit/s
 +Tue Aug  8 16:45:50 CEST 2017
 +Ping: 14.84 ms
 +Download: 529.74 Mbit/s
 +Upload: 80.20 Mbit/s
 +Tue Aug  8 16:46:09 CEST 2017
 +Ping: 14.47 ms
 +Download: 520.76 Mbit/s
 +Upload: 76.64 Mbit/s
 +Tue Aug  8 16:46:29 CEST 2017
 +Ping: 13.952 ms
 +Download: 442.88 Mbit/s
 +Upload: 56.64 Mbit/s
 +</​file>​
howtos/calculate_average.txt · Last modified: d/m/Y H:i (external edit)