Clarified the dscp-tos documentation a bit.
[doldaconnect.git] / clients / gaim / statcomp
CommitLineData
416d1179 1#!/usr/bin/perl
2
3$x = -1;
4$data = {};
5
6while(<>) {
7 if(/^(\d+):/) {
8 if($x != -1) {
9 for $k (keys %$data) {
10 $sum = $num = 0;
11 $min = $max = -1;
12 for $v (@{$data->{$k}}) {
13 $sum += $v;
14 $num++;
15 if(($min == -1) || ($min > $v)) {
16 $min = $v;
17 }
18 if(($max == -1) || ($max < $v)) {
19 $max = $v;
20 }
21 }
22 $avg = $sum / $num;
23 $devsum = 0;
24 for $v (@{$data->{$k}}) {
25 $devsum += ($v - $avg) ** 2;
26 }
27 $dev = sqrt($devsum / $num);
28 $devmin = $avg - $dev;
29 $devmax = $avg + $dev;
30 print "$k $x $avg $dev $devmin $devmax $min $max\n";
31 }
32 }
33 $x = $1;
34 $data = {};
35 } elsif(/(\w+): ([\d.]+)/) {
36 push @{$data->{$1}}, $2;
37 }
38}