mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2025-04-21 12:27:27 +03:00
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".
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
DIR=d
|
DIR=d
|
||||||
|
|
||||||
.SILENT:
|
.SILENT:
|
||||||
.PHONY: all list plot corr coll
|
.PHONY: all list plot corr dump coll
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(MAKE) plot
|
$(MAKE) plot
|
||||||
echo
|
echo
|
||||||
$(MAKE) corr
|
$(MAKE) dump
|
||||||
echo
|
echo
|
||||||
$(MAKE) coll
|
$(MAKE) coll
|
||||||
echo
|
echo
|
||||||
@@ -18,6 +18,9 @@ plot:
|
|||||||
./plot-cdf $(DIR)/log && display out.png &
|
./plot-cdf $(DIR)/log && display out.png &
|
||||||
|
|
||||||
corr:
|
corr:
|
||||||
|
./plot-corr $(DIR)/log && display out.png &
|
||||||
|
|
||||||
|
dump:
|
||||||
./bscmp $(DIR)/*-corrupt.bin
|
./bscmp $(DIR)/*-corrupt.bin
|
||||||
|
|
||||||
coll:
|
coll:
|
||||||
|
|||||||
75
m1rc3/norruption/2/plot-corr
Executable file
75
m1rc3/norruption/2/plot-corr
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
sub usage
|
||||||
|
{
|
||||||
|
print STDERR "usage: $0 [-s] [log_file]\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($ARGV[0] eq "-s") {
|
||||||
|
shift @ARGV;
|
||||||
|
$sim = 1;
|
||||||
|
}
|
||||||
|
&usage if $ARGV[0] =~ /^-/;
|
||||||
|
|
||||||
|
$n = 1;
|
||||||
|
while (<>) {
|
||||||
|
next unless /^=== (\d+) ===/;
|
||||||
|
while ($1 != $n) {
|
||||||
|
push(@f, $n);
|
||||||
|
$n++;
|
||||||
|
}
|
||||||
|
$n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$n--;
|
||||||
|
$t = int($n/@f+0.5);
|
||||||
|
|
||||||
|
$last = 0;
|
||||||
|
for (@f) {
|
||||||
|
push(@d, $_-$last);
|
||||||
|
$last = $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sim) {
|
||||||
|
# y = 1-exp(-x/T)
|
||||||
|
# 1-y = exp(-x/T)
|
||||||
|
# ln(1-y) = -x/T
|
||||||
|
# -T*ln(1-y) = x
|
||||||
|
|
||||||
|
$type = " (SIMULATED)";
|
||||||
|
@d = ();
|
||||||
|
for ($i = 0; $i != @f; $i++) {
|
||||||
|
push(@d, -$t*log(1-rand));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (@d) {
|
||||||
|
$max = $_ if $_ > $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd = "|gnuplot -e '".
|
||||||
|
'set term postscript color eps enhanced solid lw 2 20;'.
|
||||||
|
'set output "out.eps";'.
|
||||||
|
'set xrange [0:'.$max*1.05.'];'.
|
||||||
|
'set yrange [0:'.$max*1.05.'];'.
|
||||||
|
'set title "Correlation of time to adjacent corruptions'.$type.'";'.
|
||||||
|
'set xlabel "Cycles since previous event";'.
|
||||||
|
'set ylabel "Cycles until next event";'.
|
||||||
|
'plot "-" with points pt 7 notitle'.
|
||||||
|
"'";
|
||||||
|
|
||||||
|
open(PIPE, $cmd) || die "open: $!";
|
||||||
|
undef $last;
|
||||||
|
for (@d) {
|
||||||
|
print PIPE "$last $_\n" if defined $last;
|
||||||
|
$last = $_;
|
||||||
|
}
|
||||||
|
close(PIPE) || die "close: $!";
|
||||||
|
|
||||||
|
system("cat out.eps | ".
|
||||||
|
"gs -sDEVICE=ppmraw -r100 -sOutputFile=- ".
|
||||||
|
"-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sPAPERSIZE=a4 -q - | ".
|
||||||
|
"convert -trim - out.png");
|
||||||
|
unlink("out.eps");
|
||||||
Reference in New Issue
Block a user