Date:2011-10-11 08:25:46 (8 years 2 months ago)
Author:Werner Almesberger
Commit:5ac8800b98b509dfa1ff36ca0b2dd24710603235
Message:m1rc3/norruption/2/plot: analyze console log and plot probability distribution

Files: m1rc3/norruption/2/plot (1 diff)

Change Details

m1rc3/norruption/2/plot
1#!/usr/bin/perl
2$n = 1;
3while (<>) {
4    next unless /^=== (\d+) ===/;
5    while ($1 != $n) {
6        push(@f, $n);
7        $n++;
8    }
9    $n++;
10}
11
12$n--;
13$f = int($n/@f+0.5);
14
15$last = 0;
16for (@f) {
17    push(@d, $_-$last);
18    $last = $_;
19}
20
21$cmd = "|gnuplot -e '".
22    'set term postscript color eps enhanced solid lw 2 20;'.
23    'set output "out.eps";'.
24    'set title "Probability distribution of time between NOR corruptions";'.
25    'set xlabel "Power cycles";'.
26    'set ylabel "Cumulative probability";'.
27    'set key bottom;'.
28    'plot "-" with lines title "Corruptions observed (N='.@f.')", '.
29      '1-exp(-'.1/$f.'*x) with lines lt 3 '.
30      'title "Exponential distribution ({/Symbol l}=1/'.$f.')"'.
31    "'";
32
33open(PIPE, $cmd) || die "open: $!";
34$i = 0;
35for (sort { $a <=> $b } @d) {
36    $i++;
37    print PIPE $_, " ", $i/@f, "\n";
38}
39close(PIPE) || die "close: $!";
40
41system("cat out.eps | ".
42    "gs -sDEVICE=ppmraw -r100 -sOutputFile=- ".
43    "-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sPAPERSIZE=a4 -q - | ".
44    "convert -trim - out.png");
45unlink("out.eps");

Archive Download the corresponding diff file

Branches:
master



interactive