Date:2011-10-12 12:33:10 (8 years 1 day ago)
Author:Werner Almesberger
Commit:bb2589386f9d240aee3a35eadf1e2273f85893a8
Message:m1rc3/norruption/2/plot-corr: make scatter plot of time between corruptions

With simulation (-s). Also updated the Makefile and renamed the previous
"corr"(uption) to "dump", to free it for "correlation".
Files: m1rc3/norruption/2/Makefile (2 diffs)
m1rc3/norruption/2/plot-corr (1 diff)

Change Details

m1rc3/norruption/2/Makefile
11DIR=d
22
33.SILENT:
4.PHONY: all list plot corr coll
4.PHONY: all list plot corr dump coll
55
66all:
77    $(MAKE) plot
88    echo
9    $(MAKE) corr
9    $(MAKE) dump
1010    echo
1111    $(MAKE) coll
1212    echo
...... 
1818    ./plot-cdf $(DIR)/log && display out.png &
1919
2020corr:
21    ./plot-corr $(DIR)/log && display out.png &
22
23dump:
2124    ./bscmp $(DIR)/*-corrupt.bin
2225
2326coll:
m1rc3/norruption/2/plot-corr
1#!/usr/bin/perl
2
3sub usage
4{
5    print STDERR "usage: $0 [-s] [log_file]\n";
6    exit(1);
7}
8
9
10if ($ARGV[0] eq "-s") {
11    shift @ARGV;
12    $sim = 1;
13}
14&usage if $ARGV[0] =~ /^-/;
15
16$n = 1;
17while (<>) {
18    next unless /^=== (\d+) ===/;
19    while ($1 != $n) {
20        push(@f, $n);
21        $n++;
22    }
23    $n++;
24}
25
26$n--;
27$t = int($n/@f+0.5);
28
29$last = 0;
30for (@f) {
31    push(@d, $_-$last);
32    $last = $_;
33}
34
35if ($sim) {
36    # y = 1-exp(-x/T)
37    # 1-y = exp(-x/T)
38    # ln(1-y) = -x/T
39    # -T*ln(1-y) = x
40
41    $type = " (SIMULATED)";
42    @d = ();
43    for ($i = 0; $i != @f; $i++) {
44        push(@d, -$t*log(1-rand));
45    }
46}
47
48for (@d) {
49    $max = $_ if $_ > $max;
50}
51
52$cmd = "|gnuplot -e '".
53    'set term postscript color eps enhanced solid lw 2 20;'.
54    'set output "out.eps";'.
55    'set xrange [0:'.$max*1.05.'];'.
56    'set yrange [0:'.$max*1.05.'];'.
57    'set title "Correlation of time to adjacent corruptions'.$type.'";'.
58    'set xlabel "Cycles since previous event";'.
59    'set ylabel "Cycles until next event";'.
60    'plot "-" with points pt 7 notitle'.
61    "'";
62
63open(PIPE, $cmd) || die "open: $!";
64undef $last;
65for (@d) {
66    print PIPE "$last $_\n" if defined $last;
67    $last = $_;
68}
69close(PIPE) || die "close: $!";
70
71system("cat out.eps | ".
72    "gs -sDEVICE=ppmraw -r100 -sOutputFile=- ".
73    "-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sPAPERSIZE=a4 -q - | ".
74    "convert -trim - out.png");
75unlink("out.eps");

Archive Download the corresponding diff file

Branches:
master



interactive