summaryrefslogtreecommitdiff
path: root/src/ddist.sh
blob: b632572534ea52865339bcd5d3bcf9b416f7a4eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
awk '/^d k/ { print $5 - $3 }' \
| sort -n \
| awk '
  { x += 1; cumulative[$1] = x }
  END {
    if (x > 0) {
      for (p = 0;p <= 100;++p) mindel[p] = -1
      for (d in cumulative) {
        p = int((cumulative[d] * 100) / x)
        if (mindel[p] == -1) mindel[p] = d
        else if (d < mindel[p]) mindel[p] = d
        totdel[p] += d
        numdel[p] += 1
      }
      td = 0
      nd = 0
      for (p = 0;p <= 100;++p) {
        td += totdel[p]
        nd += numdel[p]
        if (p >= 10)
	  if (nd > 0)
            if (mindel[p] >= 0) {
	      str1 = sprintf("%.2f",mindel[p])
	      str2 = sprintf("%.2f",td / nd)
	      print str1, str2, p
	    }
      }
    }
  }
'